rompy.swan.components.group.OUTPUT#

pydantic model rompy.swan.components.group.OUTPUT[source]#

Output group component.

FRAME 'sname' ...
GROUP 'sname' ...
CURVE 'sname' ...
RAY 'rname' ...
ISOLINE 'sname' 'rname' ...
POINTS 'sname ...
NGRID 'sname' ...
QUANTITY ...
OUTPUT OPTIONS ...
BLOCK 'sname' ...
TABLE 'sname' ...
SPECOUT 'sname' ...
NESTOUT 'sname ...

This group component is used to define multiple types of output locations and write components in a single model. Only fields that are explicitly prescribed are rendered by this group component.

Note

The components prescribed are validated according to some constraints as defined in the SWAN manual:

  • The name ‘sname’ of each Locations component must be unique.

  • The Locations ‘sname’ assigned to each write component must be defined.

  • The BLOCK component must be associated with either a FRAME or GROUP.

  • The ISOLINE write component must be associated with a RAY component.

  • The NGRID and NESTOUT components must be defined together.

Examples

In [40]: from rompy.swan.components.output import POINTS, BLOCK, QUANTITIES, TABLE

In [41]: from rompy.swan.components.group import OUTPUT

In [42]: points = POINTS(sname="outpts", xp=[172.3, 172.4], yp=[-39, -39])

In [43]: quantity = QUANTITIES(
   ....:     quantities=[
   ....:         dict(output=["depth", "hsign", "tps", "dir", "tm01"], excv=-9),
   ....:     ]
   ....: )
   ....: 

In [44]: times = dict(tbeg="2012-01-01T00:00:00", delt="PT30M", tfmt=1, dfmt="min")

In [45]: block = BLOCK(
   ....:     model_type="block",
   ....:     sname="COMPGRID",
   ....:     fname="./swangrid.nc",
   ....:     output=["depth", "hsign", "tps", "dir"],
   ....:     times=times,
   ....: )
   ....: 

In [46]: table = TABLE(
   ....:     sname="outpts",
   ....:     format="noheader",
   ....:     fname="./swantable.nc",
   ....:     output=["hsign", "hswell", "dir", "tps", "tm01", "watlev", "qp"],
   ....:     times=times,
   ....: )
   ....: 

In [47]: out = OUTPUT(
   ....:     points=points,
   ....:     quantity=quantity,
   ....:     block=block,
   ....:     table=table,
   ....: )
   ....: 

In [48]: print(out.render())
POINTS sname='outpts' &
    xp=172.3 yp=-39.0 &
    xp=172.4 yp=-39.0

QUANTITY DEPTH HSIGN TPS DIR TM01 excv=-9.0

BLOCK sname='COMPGRID' fname='./swangrid.nc' &
    DEPTH &
    HSIGN &
    TPS &
    DIR &
    OUTPUT tbegblk=20120101.000000 deltblk=30.0 MIN

TABLE sname='outpts' NOHEADER fname='./swantable.nc' &
    HSIGN &
    HSWELL &
    DIR &
    TPS &
    TM01 &
    WATLEV &
    QP &
    OUTPUT tbegtbl=20120101.000000 delttbl=30.0 MIN
Fields:
Validators:
field block: BLOCK | None = None#
Validated by:
field curve: CURVES | None = None#
Validated by:
field frame: FRAME | None = None#
Validated by:
field group: GROUP | None = None#
Validated by:
field isoline: ISOLINE | None = None#
Validated by:
field model_type: Literal['output', 'OUTPUT'] = 'output'#

Model type discriminator

Validated by:
field nestout: NESTOUT | None = None#
Validated by:
field ngrid: NGRID | NGRID_UNSTRUCTURED | None = None#
Validated by:
field output_options: OUTPUT_OPTIONS | None = None#
Validated by:
field points: POINTS | POINTS_FILE | None = None#
Validated by:
field quantity: QUANTITIES | None = None#
Validated by:
field ray: RAY | None = None#
Validated by:
field specout: SPECOUT | None = None#
Validated by:
field table: TABLE | None = None#
Validated by:
field test: TEST | None = None#
Validated by:
validator block_with_frame_or_group  »  all fields[source]#

Ensure Block is only defined for FRAME or GROUP locations.

cmd() list[source]#

Command file string for this component.

validator isoline_ray_defined  »  all fields[source]#

Ensure the isoline ray has been defined.

validator locations_sname_unique  »  all fields[source]#

Ensure same sname isn’t used in more than one set of output locations.

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

validator ngrid_and_nestout  »  all fields[source]#

Ensure NGRID and NESTOUT are specified together.

validator write_locations_exists  »  all fields[source]#

Ensure the location component requested by a write component exists.

property locations_set#

List of specified location fields.

property snames#

List of snames from specified location components.

property write_set#

List of specified write fields.