rompy.swan.components.output.BLOCK#

pydantic model rompy.swan.components.output.BLOCK[source]#

Write spatial distributions.

BLOCK 'sname' ->HEADER|NOHEADER 'fname' (LAYOUT [idla]) < output > &
    [unit] (OUTPUT [tbegblk] [deltblk]) SEC|MIN|HR|DAY

With this optional command the user indicates that one or more spatial distributions should be written to a file.

Note

The SWAN special frames ‘BOTTGRID’ or ‘COMPGRID’ can be set with the sname field.

Note

The text of the header indicates run identification (see command PROJECT), time, frame or group name (‘sname’), variable and unit. The number of header lines is 8.

Note

Cannot be used in 1D-mode.

Examples

In [1]: from rompy.swan.components.output import BLOCK

In [2]: block = BLOCK(sname="outgrid", fname="./depth-frame.nc", output=["depth"])

In [3]: print(block.render())
BLOCK sname='outgrid' fname='./depth-frame.nc' DEPTH

In [4]: block = BLOCK(
   ...:     sname="COMPGRID",
   ...:     header=False,
   ...:     fname="./output-grid.nc",
   ...:     idla=3,
   ...:     output=["hsign", "hswell", "dir", "tps", "tm01", "watlev", "qp"],
   ...:     times=dict(
   ...:         tbeg="2012-01-01T00:00:00",
   ...:         delt="PT30M",
   ...:         tfmt=1,
   ...:         dfmt="min",
   ...:         suffix="",
   ...:     )
   ...: )
   ...: 

In [5]: print(block.render())
BLOCK sname='COMPGRID' NOHEADER fname='./output-grid.nc' LAYOUT idla=3 &
    HSIGN &
    HSWELL &
    DIR &
    TPS &
    TM01 &
    WATLEV &
    QP &
    OUTPUT tbegblk=20120101.000000 deltblk=30.0 MIN
Fields:
Validators:
field header: bool | None = None#

Indicate if the output should be written to a file with header lines (SWAN default: True)

Validated by:
field idla: IDLA | None = None#

Prescribe the lay-out of the output to file (supported options here are 1, 3, 4). Option 4 is recommended for postprocessing an ASCII file by MATLAB, however option 3 is recommended in case of binary MATLAB output (SWAN default: 1)

Validated by:
field model_type: Literal['block', 'BLOCK'] = 'block'#

Model type discriminator

Validated by:
field output: list[BlockOptions] [Required]#

The output variables to output to block file

Constraints:
  • min_length = 1

Validated by:
field unit: float | None = None#

Controls the scaling of the output. The program divides computed values by unit before writing to file, so the user should multiply the written value by unit to obtain the proper value. By default, if HEADER is selected, value is written as a 5 position integer. SWAN takes unit such that the largest number occurring in the block can be printed. If NOHEADER is selected, values are printed in floating-point format by default (unit=1)

Validated by:
cmd() str[source]#

Command file string for this component.

validator validate_idla  »  idla[source]#
property suffix: str#