Skip to content

Subcomponents

Parts of commands shared by several components, such as spectral shapes, time specifications and source term options.

rompy_swan.subcomponents.startup

SWAN startup subcomponents.

CARTESIAN pydantic-model

CARTESIAN(**data: Any)

Bases: BaseSubComponent

Cartesian coordinates.

CARTESIAN

All locations and distances are in m. Coordinates are given with respect to x- and y-axes chosen by the user in the various commands.

Examples
from rompy_swan.components.startup import CARTESIAN
coords = CARTESIAN()
print(coords.render())
CARTESIAN

Config:

  • extra: forbid

Fields:

model_type pydantic-field

model_type: Literal['cartesian', 'CARTESIAN'] = 'cartesian'

Model type discriminator

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

SPHERICAL pydantic-model

SPHERICAL(**data: Any)

Bases: BaseSubComponent

Spherical coordinates.

SPHERICAL [->CCM|QC]
Notes

projection options:

  • CCM: central conformal Mercator. The horizontal and vertical scales are uniform in terms of cm/degree over the area shown. In the centre of the scale is identical to that of the conventional Mercator projection (but only at that centre). The area in the projection centre is therefore exactly conformal.
  • QC: the projection method is quasi-cartesian, i.e. the horizontal and vertical scales are equal to one another in terms of cm/degree.

All coordinates of locations and geographical grid sizes are given in degrees;x is longitude with x = 0 being the Greenwich meridian and x > 0 is East of this meridian; y is latitude with y > 0 being the Northern hemisphere. Input and output grids have to be oriented with their x-axis to the East; mesh sizes are in degrees. All other distances are in meters.

Note that spherical coordinates can also be used for relatively small areas, say 10 or 20 km horizontal dimension. This may be useful if one obtains the boundary conditions by nesting in an oceanic model which is naturally formulated in spherical coordinates. Note that in case of spherical coordinates regular grids must always be oriented E-W, N-S, i.e. alpc=0, alpinp=0, alpfr=0 (see commands CGRID, INPUT GRID and FRAME, respectively).

Examples
from rompy_swan.components.startup import SPHERICAL
coords = SPHERICAL()
print(coords.render())
coords = SPHERICAL(projection="qc")
print(coords.render())
SPHERICAL CCM
SPHERICAL QC

Fields:

model_type pydantic-field

model_type: Literal['spherical', 'SPHERICAL'] = 'spherical'

Model type discriminator

projection pydantic-field

projection: Literal['ccm', 'qc'] = 'ccm'

Defines the projection method in case of spherical coordinates, ccm Central Conformal Mercator, qc means Quasi-cartesian

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

rompy_swan.subcomponents.spectrum

Spectrum subcomponents.

logger module-attribute

logger = logging.getLogger(__name__)

SPECTRUM pydantic-model

SPECTRUM(**data: Any)

Bases: BaseSubComponent

SWAN spectrum specification.

->CIRCLE|SECTOR ([dir1] [dir2]) [mdc] [flow] [fhigh] [msc]
Notes

Directions in the spectra are defined either as a CIRCLE or as a SECTOR. In the case of a SECTOR, both dir1 and dir2 must be specified. In the case of a CIRCLE, neither dir1 nor dir2 should be specified.

At least two of flow, fhigh and msc must be specified in which case the third parameter will be calculated by SWAN such that the frequency resolution df/f = 0.1 (10% increments).

Examples
from rompy_swan.subcomponents.spectrum import SPECTRUM
spec = SPECTRUM(mdc=36, flow=0.04, fhigh=1.0)
print(spec.render())
spec = SPECTRUM(mdc=36, dir1=0, dir2=180, flow=0.04, msc=31)
print(spec.render())
CIRCLE mdc=36 flow=0.04 fhigh=1.0
SECTOR 0.0 180.0 mdc=36 flow=0.04 msc=31

Fields:

Validators:

model_type pydantic-field

model_type: Literal['spectrum', 'SPECTRUM'] = 'spectrum'

Model type discriminator

mdc pydantic-field

mdc: int

Number of meshes in theta-space. In the case of CIRCLE, this is the number of subdivisions of the 360 degrees of a circle so dtheta = [360]/[mdc] is the spectral directional resolution. In the case of SECTOR, dtheta = ([dir2] - [dir1])/[mdc]. The minimum number of directional bins is 3 per directional quadrant.

flow pydantic-field

flow: Optional[float] = None

Lowest discrete frequency that is used in the calculation (in Hz).

fhigh pydantic-field

fhigh: Optional[float] = None

Highest discrete frequency that is used in the calculation (in Hz).

msc pydantic-field

msc: Optional[int] = None

One less than the number of frequencies. This defines the grid resolution in frequency-space between the lowest discrete frequency flow and the highest discrete frequency fhigh. This resolution is not constant, since the frequencies are distributed logarithmical: fi+1 = yfi where y is a constant. The minimum number of frequencies is 4

dir1 pydantic-field

dir1: Optional[float] = None

The direction of the right-hand boundary of the sector when looking outward from the sector (required for option SECTOR) in degrees.

dir2 pydantic-field

dir2: Optional[float] = None

The direction of the left-hand boundary of the sector when looking outward from the sector (required for option SECTOR) in degrees.

dir_sector property

dir_sector

check_direction_definition pydantic-validator

check_direction_definition(data: Any) -> Any

Check that dir1 and dir2 are specified together.

check_frequency_definition pydantic-validator

check_frequency_definition() -> SPECTRUM

Check spectral frequencies are prescribed correctly.

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

JONSWAP pydantic-model

JONSWAP(**data: Any)

Bases: BaseSubComponent

Jonswap spectral shape.

JONSWAP [gamma]
Examples
from rompy_swan.subcomponents.spectrum import JONSWAP
shape = JONSWAP(gamma=3.3)
print(shape.render())
JONSWAP gamma=3.3

Fields:

model_type pydantic-field

model_type: Literal['jonswap', 'JONSWAP'] = 'jonswap'

Model type discriminator

gamma pydantic-field

gamma: float = 3.3

Peak enhancement parameter of the JONSWAP spectrum.

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

TMA pydantic-model

TMA(**data: Any)

Bases: JONSWAP

TMA spectral shape.

TMA [gamma] [d]
Examples
from rompy_swan.subcomponents.spectrum import TMA
shape = TMA(gamma=2.0, d=18)
print(shape.render())
TMA gamma=2.0 d=18.0

Fields:

model_type pydantic-field

model_type: Literal['tma', 'TMA'] = 'tma'

Model type discriminator

d pydantic-field

d: float

The reference depth at the wave maker in meters.

gamma pydantic-field

gamma: float = 3.3

Peak enhancement parameter of the JONSWAP spectrum.

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

GAUSS pydantic-model

GAUSS(**data: Any)

Bases: BaseSubComponent

Gaussian spectral shape.

GAUSS [sigfr]
Examples
from rompy_swan.subcomponents.spectrum import GAUSS
shape = GAUSS(sigfr=0.02)
print(shape.render())
GAUSS sigfr=0.02

Fields:

model_type pydantic-field

model_type: Literal['gauss', 'GAUSS'] = 'gauss'

Model type discriminator

sigfr pydantic-field

sigfr: float

Width of the Gaussian frequency spectrum expressed as a standard deviation in Hz.

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

PM pydantic-model

PM(**data: Any)

Bases: BaseSubComponent

Pearson-Moskowitz spectral shape.

PM
Examples
from rompy_swan.subcomponents.spectrum import PM
shape = PM()
print(shape.render())
PM

Fields:

model_type pydantic-field

model_type: Literal['pm', 'PM'] = 'pm'

Model type discriminator

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

BIN pydantic-model

BIN(**data: Any)

Bases: BaseSubComponent

Single frequency bin spectral shape.

BIN
Examples
from rompy_swan.subcomponents.spectrum import BIN
shape = BIN()
print(shape.render())
BIN

Fields:

model_type pydantic-field

model_type: Literal['bin', 'BIN'] = 'bin'

Model type discriminator

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

SHAPESPEC pydantic-model

SHAPESPEC(**data: Any)

Bases: BaseSubComponent

Spectral shape specification.

BOUND SHAPESPEC JONSWAP|PM|GAUSS|BIN|TMA PEAK|MEAN DSPR [POWER|DEGREES]

This command BOUND SHAPESPEC defines the shape of the spectra (both in frequency and direction) at the boundary of the computational grid in case of parametric spectral input.

Notes

While technically a component BOUND SHAPESPEC, this is only intended to be used as a subcomponent of the BOUNDSPEC component.

Examples
from rompy_swan.subcomponents.spectrum import SHAPESPEC
shapespec = SHAPESPEC()
print(shapespec.render())
shapespec = SHAPESPEC(
    shape=dict(model_type="tma", gamma=3.1, d=12),
    per_type="mean",
    dspr_type="degrees",
)
print(shapespec.render())
BOUND SHAPESPEC JONSWAP gamma=3.3 PEAK DSPR POWER
BOUND SHAPESPEC TMA gamma=3.1 d=12.0 MEAN DSPR DEGREES

Fields:

model_type pydantic-field

model_type: Literal['shapespec', 'SHAPESPEC'] = 'shapespec'

Model type discriminator

shape pydantic-field

shape: JONSWAP | PM | GAUSS | BIN | TMA

The spectral shape

per_type pydantic-field

per_type: Literal['peak', 'mean'] = 'peak'

The type of characteristic wave period

dspr_type pydantic-field

dspr_type: Literal['power', 'degrees'] = 'power'

The type of directional spreading

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

rompy_swan.subcomponents.time

SWAN Time Subcomponents

This module contains subcomponents for handling time specifications in SWAN, including time ranges, intervals, and time format conversions.

logger module-attribute

logger = get_logger(__name__)

DEFAULT_TIME module-attribute

DEFAULT_TIME = datetime(1970, 1, 1, 0, 0, 0)

DEFAULT_TEND module-attribute

DEFAULT_TEND = DEFAULT_TIME + timedelta(days=1)

DEFAULT_DELT module-attribute

DEFAULT_DELT = timedelta(hours=1)

TIME_FORMAT module-attribute

TIME_FORMAT = {
    1: "%Y%m%d.%H%M%S",
    2: "'%d-%b-%y %H:%M:%S'",
    3: "%m/%d/%y.%H:%M:%S",
    4: "%H:%M:%S",
    5: "%y/%m/%d %H:%M:%S'",
    6: "%y%m%d%H%M",
}

Time pydantic-model

Time(**data: Any)

Bases: BaseSubComponent

Time specification in SWAN.

[time]

Time is rendered in one of the following formats:

  • 1: ISO-notation 19870530.153000
  • 2: (as in HP compiler) '30-May-87 15:30:00'
  • 3: (as in Lahey compiler) 05/30/87.15:30:00
  • 4: 15:30:00
  • 5: 87/05/30 15:30:00'
  • 6: as in WAM 8705301530
Note

The time field can be specified as:

  • existing datetime object
  • int or float, assumed as Unix time, i.e. seconds (if >= -2e10 or <= 2e10) or milliseconds (if < -2e10 or > 2e10) since 1 January 1970.
  • ISO 8601 time string.

Examples:

from rompy_swan.subcomponents.time import Time
from datetime import datetime
time = Time(time=datetime(1990, 1, 1))
print(time.render())
time = Time(time="2012-01-01T00:00:00", tfmt=2)
print(time.render())
19900101.000000
'01-Jan-12 00:00:00'

Fields:

Validators:

model_type pydantic-field

model_type: Literal['time', 'Time', 'TIME'] = 'time'

Model type discriminator

time pydantic-field

time: datetime

Datetime specification

tfmt pydantic-field

tfmt: Union[Literal[1, 2, 3, 4, 5, 6], str] = 1

Format to render time specification

set_time_format pydantic-validator

set_time_format(v: int | str) -> str

Set the time format to render.

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

Delt pydantic-model

Delt(**data: Any)

Bases: BaseSubComponent

Time interval specification in SWAN.

[delt] SEC|MIN|HR|DAY
Note

The tdelta field can be specified as:

  • existing timedelta object
  • int or float, assumed as seconds
  • ISO 8601 duration string, following formats work:

  • [-][DD ][HH:MM]SS[.ffffff]

  • [±]P[DD]DT[HH]H[MM]M[SS]S (ISO 8601 format for timedelta)

Examples:

from rompy_swan.subcomponents.time import Delt
from datetime import timedelta
delt = Delt(delt=timedelta(minutes=30))
print(delt.render())
delt = Delt(delt="PT1H", dfmt="hr")
print(delt.render())
1800.0 SEC
1.0 HR

Fields:

model_type pydantic-field

model_type: Literal['delt'] = 'delt'

Model type discriminator

delt pydantic-field

delt: timedelta

Time interval

dfmt pydantic-field

dfmt: Literal['sec', 'min', 'hr', 'day'] = 'sec'

Format to render time interval specification

delt_float property

delt_float

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

TimeRangeOpen pydantic-model

TimeRangeOpen(**data: Any)

Bases: BaseSubComponent

Regular times with an open boundary.

[tbeg] [delt] SEC|MIN|HR|DAY

Time is rendered in one of the following formats:

  • 1: ISO-notation 19870530.153000
  • 2: (as in HP compiler) '30-May-87 15:30:00'
  • 3: (as in Lahey compiler) 05/30/87.15:30:00
  • 4: 15:30:00
  • 5: 87/05/30 15:30:00'
  • 6: as in WAM 8705301530
Note

The tbeg field can be specified as:

  • existing datetime object
  • int or float, assumed as Unix time, i.e. seconds (if >= -2e10 or <= 2e10) or milliseconds (if < -2e10 or > 2e10) since 1 January 1970.
  • ISO 8601 time string.
Note

The tdelta field can be specified as:

  • existing timedelta object
  • int or float, assumed as seconds
  • ISO 8601 duration string, following formats work:

    • [-][DD ][HH:MM]SS[.ffffff]
    • [±]P[DD]DT[HH]H[MM]M[SS]S (ISO 8601 format for timedelta)
Note

Default values for the time specification fields are provided for the case where the user wants to set times dynamically after instantiating this subcomponent.

Examples:

from rompy_swan.subcomponents.time import TimeRangeOpen
from datetime import datetime, timedelta
times = TimeRangeOpen(
    tbeg=datetime(1990, 1, 1), delt=timedelta(minutes=30), dfmt="min"
)
print(times.render())
times = TimeRangeOpen(
    tbeg="2012-01-01T00:00:00", delt="PT1H", tfmt=2, dfmt="hr", suffix="blk"
)
print(times.render())
tbeg=19900101.000000 delt=30.0 MIN
tbegblk='01-Jan-12 00:00:00' deltblk=1.0 HR

Fields:

model_type pydantic-field

model_type: Literal['open', 'OPEN'] = 'open'

Model type discriminator

tbeg pydantic-field

Start time

delt pydantic-field

Time interval

tfmt pydantic-field

tfmt: Union[Literal[1, 2, 3, 4, 5, 6], str] = 1

Format to render time specification

dfmt pydantic-field

dfmt: Literal['sec', 'min', 'hr', 'day'] = 'sec'

Format to render time interval specification

suffix pydantic-field

suffix: str = ''

Suffix to prepend to argument names when rendering

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

TimeRangeClosed pydantic-model

TimeRangeClosed(**data: Any)

Bases: TimeRangeOpen

Regular times with a closed boundary.

[tbeg] [delt] SEC|MIN|HR|DAY [tend]
Note

Default values for the time specification fields are provided for the case where the user wants to set times dynamically after instantiating this subcomponent.

Examples:

from rompy_swan.subcomponents.time import TimeRangeClosed
from datetime import datetime, timedelta
times = TimeRangeClosed(
    tbeg=datetime(1990, 1, 1),
    tend=datetime(1990, 1, 7),
    delt=timedelta(minutes=30),
    dfmt="min",
)
print(times.render())
times = TimeRangeClosed(
    tbeg="2012-01-01T00:00:00",
    tend="2012-02-01T00:00:00",
    delt="PT1H",
    tfmt=2,
    dfmt="hr",
    suffix="blk",
)
print(times.render())
tbeg=19900101.000000 delt=30.0 MIN tend=19900107.000000
tbegblk='01-Jan-12 00:00:00' deltblk=1.0 HR tendblk='01-Feb-12 00:00:00'

Fields:

model_type pydantic-field

model_type: Literal['closed', 'CLOSED'] = 'closed'

Model type discriminator

tend pydantic-field

End time

tbeg pydantic-field

Start time

delt pydantic-field

Time interval

tfmt pydantic-field

tfmt: Union[Literal[1, 2, 3, 4, 5, 6], str] = 1

Format to render time specification

dfmt pydantic-field

dfmt: Literal['sec', 'min', 'hr', 'day'] = 'sec'

Format to render time interval specification

suffix pydantic-field

suffix: str = ''

Suffix to prepend to argument names when rendering

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

NONSTATIONARY pydantic-model

NONSTATIONARY(**data: Any)

Bases: TimeRangeClosed

Nonstationary time specification.

NONSTATIONARY [tbeg] [delt] SEC|MIN|HR|DAY [tend]
Note

Default values for the time specification fields are provided for the case where the user wants to set times dynamically after instantiating this subcomponent.

Examples:

from rompy_swan.subcomponents.time import NONSTATIONARY
nonstat = NONSTATIONARY(
    tbeg="2012-01-01T00:00:00",
    tend="2012-02-01T00:00:00",
    delt="PT1H",
    dfmt="hr",
)
print(nonstat.render())
from datetime import datetime, timedelta
nonstat = NONSTATIONARY(
    tbeg=datetime(1990, 1, 1),
    tend=datetime(1990, 1, 7),
    delt=timedelta(minutes=30),
    tfmt=1,
    dfmt="min",
    suffix="tbl",
)
print(nonstat.render())
NONSTATIONARY tbeg=20120101.000000 delt=1.0 HR tend=20120201.000000
NONSTATIONARY tbegtbl=19900101.000000 delttbl=30.0 MIN tendtbl=19900107.000000

Fields:

model_type pydantic-field

model_type: Literal["nonstationary", "NONSTATIONARY"] = (
    "nonstationary"
)

Model type discriminator

tbeg pydantic-field

Start time

tend pydantic-field

End time

delt pydantic-field

Time interval

tfmt pydantic-field

tfmt: Union[Literal[1, 2, 3, 4, 5, 6], str] = 1

Format to render time specification

dfmt pydantic-field

dfmt: Literal['sec', 'min', 'hr', 'day'] = 'sec'

Format to render time interval specification

suffix pydantic-field

suffix: str = ''

Suffix to prepend to argument names when rendering

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

STATIONARY pydantic-model

STATIONARY(**data: Any)

Bases: BaseSubComponent

Stationary time specification.

STATIONARY [time]
Note

The field time is optional to allow for the case where the user wants to set the time dynamically after instantiating this component.

Examples:

from rompy_swan.subcomponents.time import STATIONARY
stat = STATIONARY(time="2012-01-01T00:00:00")
print(stat.render())
STATIONARY time=20120101.000000

Fields:

model_type pydantic-field

model_type: Literal["stationary", "STATIONARY"] = (
    "stationary"
)

Model type discriminator

time pydantic-field

Stationary time

tfmt pydantic-field

tfmt: Union[Literal[1, 2, 3, 4, 5, 6], str] = 1

Format to render time specification

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

rompy_swan.subcomponents.readgrid

SWAN Read Grid Subcomponents

This module contains subcomponents for reading grid data in SWAN, including regular grids and various input formats.

logger module-attribute

logger = get_logger(__name__)

GRIDREGULAR pydantic-model

GRIDREGULAR(**data: Any)

Bases: BaseSubComponent

SWAN Regular Grid subcomponent.

xp yp alp xlen ylen mx my
Note

The direction of the x-axis alp must be 0 in case of spherical coordinates

Note

All coordinates and distances should be given in m when Cartesian coordinates are used or degrees when Spherical coordinates are used (see command COORD).

Examples:

from rompy_swan.subcomponents.readgrid import GRIDREGULAR
kwargs = dict(xp=173, yp=-40, alp=0, xlen=2, ylen=2, mx=199, my=199)
grid = GRIDREGULAR(suffix="c", **kwargs)
print(grid.render())
grid = GRIDREGULAR(suffix="inp", **kwargs)
print(grid.render())
xpc=173.0 ypc=-40.0 alpc=0.0 xlenc=2.0 ylenc=2.0 mxc=199 myc=199
xpinp=173.0 ypinp=-40.0 alpinp=0.0 xleninp=2.0 yleninp=2.0 mxinp=199 myinp=199

Fields:

model_type pydantic-field

model_type: Literal["gridregular", "GRIDREGULAR"] = (
    "gridregular"
)

Model type discriminator

xp pydantic-field

xp: float

The x-coordinate of the origin in problem coordinates

yp pydantic-field

yp: float

The y-coordinate of the origin in problem coordinates

alp pydantic-field

alp: Optional[float] = 0.0

Direction of the xaxis in degrees

xlen pydantic-field

xlen: float

Length of the computational grid in the x-direction

ylen pydantic-field

ylen: float

Length of the computational grid in the y-direction

mx pydantic-field

mx: int

Number of meshes in computational grid in x-direction (this number is one less than the number of grid points in this domain)

my pydantic-field

my: int

Number of meshes in computational grid in y-direction (this number is one less than the number of grid points in this domain)

suffix pydantic-field

suffix: Optional[str] = ''

Suffix for rendering with each output grid parameter.

dx property

dx

Grid spacing in x-direction.

dy property

dy

Grid spacing in y-direction.

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

READGRID pydantic-model

READGRID(**data: Any)

Bases: BaseSubComponent, ABC

SWAN grid reader abstract class.

READGRID [grid_type] [fac] 'fname1' [idla] [nhedf] ([nhedt]) ([nhedvec]) &
    ->FREE|FORMAT|UNFORMATTED ('form'|[idfm])

This is the base class for all input grids. It is not meant to be used directly.

Note

File format identifier:

  • 1: Format according to BODKAR convention (a standard of the Ministry of Transport and Public Works in the Netherlands). Format string: (10X,12F5.0)
  • 5: Format (16F5.0), an input line consists of 16 fields of 5 places each
  • 6: Format (12F6.0), an input line consists of 12 fields of 6 places each
  • 8: Format (10F8.0), an input line consists of 10 fields of 8 places each

Fields:

Validators:

model_type pydantic-field

model_type: Literal['readgrid', 'READGRID'] = 'readgrid'

Model type discriminator

grid_type pydantic-field

grid_type: Union[GridOptions, Literal['coordinates']]

Type of the SWAN grid file

fac pydantic-field

fac: float = 1.0

SWAN multiplies all values that are read from file by fac. For instance if the values are given in unit decimeter, one should make fac=0.1 to obtain values in m. To change sign use a negative fac

idla pydantic-field

idla: IDLA = IDLA.ONE

Prescribes the order in which the values of bottom levels and other fields should be given in the file

nhedf pydantic-field

nhedf: int = 0

The number of header lines at the start of the file. The text in the header lines is reproduced in the print file created by SWAN . The file may start with more header lines than nhedf because the start of the file is often also the start of a time step and possibly also of a vector variable (each having header lines, see nhedt and nhedvec)

nhedvec pydantic-field

nhedvec: int = 0

For each vector variable: number of header lines in the file at the start of each component (e.g., x- or y-component)

format pydantic-field

format: Literal['free', 'fixed', 'unformatted'] = 'free'

File format, one of 'free', 'fixed' or 'unformatted'. If 'free', the file is assumed to use the FREE FORTRAN format. If 'fixed', the file is assumed to use a fixed format that must be specified by (only) one of 'form' or 'idfm' arguments. Use 'unformatted' to read unformatted (binary) files (not recommended for ordinary use)

form pydantic-field

form: Optional[str] = None

A user-specified format string in Fortran convention, e.g., '(10X,12F5.0)'.Only used if format='fixed', do not use it if idfm is specified

idfm pydantic-field

idfm: Optional[Literal[1, 5, 6, 8]] = None

File format identifier, only used if format='fixed'

format_repr property

format_repr

fac_not_zero pydantic-validator

fac_not_zero(fac: float) -> float

SWAN multiplies the values by fac, so it must not be zero.

check_format_definition pydantic-validator

check_format_definition() -> READGRID

Check the arguments specifying the file format are specified correctly.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

READCOORD pydantic-model

READCOORD(**data: Any)

Bases: READGRID

SWAN coordinates reader.

READGRID COORDINATES [fac] 'fname' [idla] [nhedf] [nhedvec] &
    FREE|FORMAT ('form'|idfm)
Examples
from rompy_swan.subcomponents.readgrid import READCOORD
readcoord = READCOORD(
    fac=1.0,
    fname="coords.txt",
    idla=3,
    format="free",
)
print(readcoord.render())
READGRID COORDINATES fac=1.0 fname='coords.txt' idla=3 nhedf=0 nhedvec=0 FREE

Fields:

Validators:

model_type pydantic-field

model_type: Literal['readcoord', 'READCOORD'] = 'readcoord'

Model type discriminator

grid_type pydantic-field

grid_type: Literal['coordinates'] = 'coordinates'

Type of the SWAN grid file

fname pydantic-field

fname: str

Name of the SWAN coordinates file

fac pydantic-field

fac: float = 1.0

SWAN multiplies all values that are read from file by fac. For instance if the values are given in unit decimeter, one should make fac=0.1 to obtain values in m. To change sign use a negative fac

idla pydantic-field

idla: IDLA = IDLA.ONE

Prescribes the order in which the values of bottom levels and other fields should be given in the file

nhedf pydantic-field

nhedf: int = 0

The number of header lines at the start of the file. The text in the header lines is reproduced in the print file created by SWAN . The file may start with more header lines than nhedf because the start of the file is often also the start of a time step and possibly also of a vector variable (each having header lines, see nhedt and nhedvec)

nhedvec pydantic-field

nhedvec: int = 0

For each vector variable: number of header lines in the file at the start of each component (e.g., x- or y-component)

format pydantic-field

format: Literal['free', 'fixed', 'unformatted'] = 'free'

File format, one of 'free', 'fixed' or 'unformatted'. If 'free', the file is assumed to use the FREE FORTRAN format. If 'fixed', the file is assumed to use a fixed format that must be specified by (only) one of 'form' or 'idfm' arguments. Use 'unformatted' to read unformatted (binary) files (not recommended for ordinary use)

form pydantic-field

form: Optional[str] = None

A user-specified format string in Fortran convention, e.g., '(10X,12F5.0)'.Only used if format='fixed', do not use it if idfm is specified

idfm pydantic-field

idfm: Optional[Literal[1, 5, 6, 8]] = None

File format identifier, only used if format='fixed'

format_repr property

format_repr

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

fac_not_zero pydantic-validator

fac_not_zero(fac: float) -> float

SWAN multiplies the values by fac, so it must not be zero.

check_format_definition pydantic-validator

check_format_definition() -> READGRID

Check the arguments specifying the file format are specified correctly.

READINP pydantic-model

READINP(**data: Any)

Bases: READGRID

SWAN input grid reader.

READINP GRID_TYPE [fac] ('fname1' | SERIES 'fname2') [idla] [nhedf] &
    ([nhedt]) [nhedvec] FREE|FORMAT ('form'|idfm)|UNFORMATTED`
Examples
from rompy_swan.subcomponents.readgrid import READINP
readinp = READINP(
    grid_type="wind",
    fname1="wind.txt",
    fac=1.0,
    idla=3,
    format="free",
)
print(readinp.render())
READINP WIND fac=1.0 fname1='wind.txt' idla=3 nhedf=0 nhedt=0 nhedvec=0 FREE

Fields:

Validators:

model_type pydantic-field

model_type: Literal['readinp', 'READINP'] = 'readinp'

Model type discriminator

grid_type pydantic-field

grid_type: Optional[GridOptions] = None

Type of the SWAN grid file

fname1 pydantic-field

fname1: str

Name of the file with the values of the variable.

fname2 pydantic-field

fname2: Optional[str] = None

Name of file that contains the names of the files where the variables are given when the SERIES option is used. These names are to be given in proper time sequence. SWAN reads the next file when the previous file end has been encountered. In these files the input should be given in the same format as in the above file 'fname1' (that implies that a file should start with the start of an input time step)

nhedt pydantic-field

nhedt: int = 0

Only if variable is time dependent: number of header lines in the file at the start of each time level. A time step may start with more header lines than nhedt because the variable may be a vector variable which has its own header lines (see nhedvec)

fac pydantic-field

fac: float = 1.0

SWAN multiplies all values that are read from file by fac. For instance if the values are given in unit decimeter, one should make fac=0.1 to obtain values in m. To change sign use a negative fac

idla pydantic-field

idla: IDLA = IDLA.ONE

Prescribes the order in which the values of bottom levels and other fields should be given in the file

nhedf pydantic-field

nhedf: int = 0

The number of header lines at the start of the file. The text in the header lines is reproduced in the print file created by SWAN . The file may start with more header lines than nhedf because the start of the file is often also the start of a time step and possibly also of a vector variable (each having header lines, see nhedt and nhedvec)

nhedvec pydantic-field

nhedvec: int = 0

For each vector variable: number of header lines in the file at the start of each component (e.g., x- or y-component)

format pydantic-field

format: Literal['free', 'fixed', 'unformatted'] = 'free'

File format, one of 'free', 'fixed' or 'unformatted'. If 'free', the file is assumed to use the FREE FORTRAN format. If 'fixed', the file is assumed to use a fixed format that must be specified by (only) one of 'form' or 'idfm' arguments. Use 'unformatted' to read unformatted (binary) files (not recommended for ordinary use)

form pydantic-field

form: Optional[str] = None

A user-specified format string in Fortran convention, e.g., '(10X,12F5.0)'.Only used if format='fixed', do not use it if idfm is specified

idfm pydantic-field

idfm: Optional[Literal[1, 5, 6, 8]] = None

File format identifier, only used if format='fixed'

format_repr property

format_repr

set_undefined pydantic-validator

set_undefined(v: str | None) -> str

Allow for undefined value so it can be redefined in INPGRID components.

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

fac_not_zero pydantic-validator

fac_not_zero(fac: float) -> float

SWAN multiplies the values by fac, so it must not be zero.

check_format_definition pydantic-validator

check_format_definition() -> READGRID

Check the arguments specifying the file format are specified correctly.

rompy_swan.subcomponents.boundary

SWAN Boundary Subcomponents

This module contains subcomponents for defining boundary conditions in SWAN, including boundary segments, spectral parameters, and initial conditions.

logger module-attribute

logger = get_logger(__name__)

SIDE pydantic-model

SIDE(**data: Any)

Bases: BaseSubComponent

Boundary over one side of computational domain.

SIDE NORTH|NW|WEST|SW|SOUTH|SE|E|NE CCW|CLOCKWISE

The boundary is one full side of the computational grid (in 1D cases either of the two ends of the 1D-grid).

Note

Should not be used in case of CURVILINEAR grids.

Examples:

from rompy_swan.subcomponents.boundary import SIDE
side = SIDE(side="west", direction="ccw")
print(side.render())
SIDE WEST CCW 

Fields:

model_type pydantic-field

model_type: Literal['side', 'SIDE'] = 'side'

Model type discriminator

side pydantic-field

side: Literal[
    "north", "nw", "west", "sw", "south", "se", "east", "ne"
]

The side of the grid to apply the boundary to

direction pydantic-field

direction: Literal['ccw', 'clockwise'] = 'ccw'

The direction to apply the boundary in

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

SIDES pydantic-model

SIDES(**data: Any)

Bases: BaseSubComponent

Boundary over multiple side of computational domain.

SIDE NORTH|NW|WEST|SW|SOUTH|SE|E|NE CCW|CLOCKWISE
SIDE NORTH|NW|WEST|SW|SOUTH|SE|E|NE CCW|CLOCKWISE
...
Note

Should not be used in case of CURVILINEAR grids.

Examples:

from rompy_swan.subcomponents.boundary import SIDE, SIDES
side1 = SIDE(side="west", direction="ccw")
side2 = SIDE(side="north", direction="ccw")
sides = SIDES(sides=[side1, side2])
print(sides.render())
['S', 'I', 'D', 'E', ' ', 'W', 'E', 'S', 'T', ' ', 'C', 'C', 'W', ' ', 'S', 'I', 'D', 'E', ' ', 'N', 'O', 'R', 'T', 'H', ' ', 'C', 'C', 'W', ' ']

Fields:

model_type pydantic-field

model_type: Literal['sides', 'SIDES'] = 'sides'

Model type discriminator

sides pydantic-field

sides: list[SIDE]

The sides of the grid to apply the boundary to

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

SEGMENT pydantic-model

SEGMENT(**data: Any)

Bases: BaseSubComponent

Boundary over a segment defined from points.

SEGMENT XY < [x] [y] >
SEGMENT IJ < [i] [j] >

The segment is defined either by means of a series of points in terms of problem coordinates (XY) or by means of a series of points in terms of grid indices (IJ). The points do not have to include all or coincide with actual grid points.

Examples
from rompy_swan.subcomponents.boundary import SEGMENT
seg = SEGMENT(
    points=dict(
        model_type="xy",
        x=[172, 172, 172, 172.5, 173],
        y=[-41, -40.5, -40, -40, -40],
        fmt="0.2f",
    ),
)
print(seg.render())
seg = SEGMENT(
    points=dict(
        model_type="ij",
        i=[0, 0, 5],
        j=[0, 19, 19],
    ),
)
print(seg.render())
SEGMENT XY 
172.00 -41.00
172.00 -40.50
172.00 -40.00
172.50 -40.00
173.00 -40.00

SEGMENT IJ 
i=0 j=0
i=0 j=19
i=5 j=19

Fields:

model_type pydantic-field

model_type: Literal['segment', 'SEGMENT'] = 'segment'

Model type discriminator

points pydantic-field

points: Union[XY, IJ]

Points to define the segment

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

PAR pydantic-model

PAR(**data: Any)

Bases: BaseSubComponent

Spectral parameters.

PAR [hs] [per] [dir] [dd]
Examples
from rompy_swan.subcomponents.boundary import PAR
par = PAR(hs=1.5, per=8.1, dir=225)
print(par.render())
PAR hs=1.5 per=8.1 dir=225.0

Fields:

model_type pydantic-field

model_type: Literal['par'] = 'par'

Model type discriminator

hs pydantic-field

hs: float

The significant wave height (m)

per pydantic-field

per: float

The characteristic period (s) of the energy spectrum (relative frequency; which is equal to absolute frequency in the absence of currents); per is the value of the peak period if option PEAK is chosen in command BOUND SHAPE or per is the value of the mean period, if option MEAN was chosen in command BOUND SHAPE.

dir pydantic-field

dir: float

The peak wave direction thetapeak (degree), constant over frequencies

dd pydantic-field

dd: Optional[float] = None

Coefficient of directional spreading; a cos^m(θ) distribution is assumed. dd is interpreted as the directional standard deviation in degrees, if the option DEGREES is chosen in the command BOUND SHAPE (SWAN default: 30). dd is interpreted as the power m, if the option POWER is chosen in the command BOUND SHAPE (SWAN default: 2)

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

CONSTANTPAR pydantic-model

CONSTANTPAR(**data: Any)

Bases: PAR

Constant spectral parameters.

CONSTANT PAR [hs] [per] [dir] ([dd])
Examples
from rompy_swan.subcomponents.boundary import CONSTANTPAR
par = CONSTANTPAR(hs=1.5, per=8.1, dir=225)
print(par.render())
CONSTANT PAR hs=1.5 per=8.1 dir=225.0

Fields:

model_type pydantic-field

model_type: Literal["constantpar", "CONSTANTPAR"] = (
    "constantpar"
)

Model type discriminator

hs pydantic-field

hs: float

The significant wave height (m)

per pydantic-field

per: float

The characteristic period (s) of the energy spectrum (relative frequency; which is equal to absolute frequency in the absence of currents); per is the value of the peak period if option PEAK is chosen in command BOUND SHAPE or per is the value of the mean period, if option MEAN was chosen in command BOUND SHAPE.

dir pydantic-field

dir: float

The peak wave direction thetapeak (degree), constant over frequencies

dd pydantic-field

dd: Optional[float] = None

Coefficient of directional spreading; a cos^m(θ) distribution is assumed. dd is interpreted as the directional standard deviation in degrees, if the option DEGREES is chosen in the command BOUND SHAPE (SWAN default: 30). dd is interpreted as the power m, if the option POWER is chosen in the command BOUND SHAPE (SWAN default: 2)

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

VARIABLEPAR pydantic-model

VARIABLEPAR(**data: Any)

Bases: BaseSubComponent

Variable spectral parameter.

VARIABLE PAR < [len] [hs] [per] [dir] [dd] >
Examples
from rompy_swan.subcomponents.boundary import VARIABLEPAR
par = VARIABLEPAR(
    hs=[1.5, 1.4, 1.1],
    per=[8.1, 8.0, 8.1],
    dir=[225, 226, 228],
    dd=[25, 22, 23],
    len=[0, 0.5, 1.0],
)
print(par.render())
VARIABLE PAR &
    len=0.0 hs=1.5 per=8.1 dir=225.0 dd=25.0 &
    len=0.5 hs=1.4 per=8.0 dir=226.0 dd=22.0 &
    len=1.0 hs=1.1 per=8.1 dir=228.0 dd=23.0

Fields:

Validators:

model_type pydantic-field

model_type: Literal["variablepar", "VARIABLEPAR"] = (
    "variablepar"
)

Model type discriminator

hs pydantic-field

hs: list[Annotated[float, Field(ge=0.0)]]

The significant wave height (m)

per pydantic-field

per: list[Annotated[float, Field(ge=0.0)]]

The characteristic period (s) of the energy spectrum (relative frequency; which is equal to absolute frequency in the absence of currents); per is the value of the peak period if option PEAK is chosen in command BOUND SHAPE or per is the value of the mean period, if option MEAN was chosen in command BOUND SHAPE

dir pydantic-field

dir: list[Annotated[float, Field(ge=-360.0, le=360.0)]]

The peak wave direction thetapeak (degrees), constant over frequencies

dd pydantic-field

dd: list[Annotated[float, Field(ge=0.0, le=360.0)]]

Coefficient of directional spreading; a $cos^m(θ)$ distribution is assumed. dd is interpreted as the directional standard deviation in degrees, if the option DEGREES is chosen in the command BOUND SHAPE (SWAN default: 30). dd is interpreted as the power m, if the option POWER is chosen in the command BOUND SHAPE (SWAN default: 2)

dist pydantic-field

dist: list[Annotated[float, Field(ge=0)]]

Is the distance from the first point of the side or segment to the point along the side or segment for which the incident wave spectrum is prescribed. Note: these points do no have to coincide with grid points of the computational grid. len is the distance in m or degrees in the case of spherical coordinates, not in grid steps. The values of len should be given in ascending order. The length along a SIDE is measured in clockwise or counterclockwise direction, depending on the options CCW or CLOCKWISE (see above). The option CCW is default. In case of a SEGMENT the length is measured from the indicated begin point of the segment

ensure_equal_size pydantic-validator

ensure_equal_size() -> VARIABLEPAR

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

CONSTANTFILE pydantic-model

CONSTANTFILE(**data: Any)

Bases: BaseSubComponent

Constant file specification.

CONSTANT FILE 'fname' [seq]

There are three types of files:

  • TPAR files containing nonstationary wave parameters
  • files containing stationary or nonstationary 1D spectra (usually from measurements)
  • files containing stationary or nonstationary 2D spectra (from other computer programs or other SWAN runs)

A TPAR file is for only one location; it has the string TPAR on the first line of the file and a number of lines which each contain 5 numbers, i.e.: Time (ISO-notation), Hs, Period (average or peak period depending on the choice given in command BOUND SHAPE), Peak Direction (Nautical or Cartesian, depending on command SET), Directional spread (in degrees or as power of cos depending on the choice given in command BOUND SHAPE).

Note

Example of a TPAR file:

TPAR
19920516.130000 4.2 12. -110. 22.
19920516.180000 4.2 12. -110. 22.
19920517.000000 1.2 8. -110. 22.
19920517.120000 1.4 8.5 -80. 26
19920517.200000 0.9 6.5 -95. 28

Examples:

from rompy_swan.subcomponents.boundary import CONSTANTFILE
par = CONSTANTFILE(fname="tpar.txt")
print(par.render())
CONSTANT FILE fname='tpar.txt'

Fields:

model_type pydantic-field

model_type: Literal["constantfile", "CONSTANTFILE"] = (
    "constantfile"
)

Model type discriminator

fname pydantic-field

fname: str

Name of the file containing the boundary condition.

seq pydantic-field

seq: Optional[int] = None

sequence number of geographic location in the file (see Appendix D); useful for files which contain spectra for more than one location. Note: a TPAR file always contains only one location so in this case seq must always be 1

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

VARIABLEFILE pydantic-model

VARIABLEFILE(**data: Any)

Bases: BaseSubComponent

Variable file specification.

VARIABLE FILE < [len] 'fname' [seq] >

There are three types of files:

  • TPAR files containing nonstationary wave parameters
  • files containing stationary or nonstationary 1D spectra (usually from measurements)
  • files containing stationary or nonstationary 2D spectra (from other computer programs or other SWAN runs)

A TPAR file is for only one location; it has the string TPAR on the first line of the file and a number of lines which each contain 5 numbers, i.e.: Time (ISO-notation), Hs, Period (average or peak period depending on the choice given in command BOUND SHAPE), Peak Direction (Nautical or Cartesian, depending on command SET), Directional spread (in degrees or as power of cos depending on the choice given in command BOUND SHAPE).

Note

Example of a TPAR file:

TPAR
19920516.130000 4.2 12. -110. 22.
19920516.180000 4.2 12. -110. 22.
19920517.000000 1.2 8. -110. 22.
19920517.120000 1.4 8.5 -80. 26
19920517.200000 0.9 6.5 -95. 28

Examples:

from rompy_swan.subcomponents.boundary import VARIABLEFILE
par = VARIABLEFILE(
    fname=["tpar1.txt", "tpar2.txt", "tpar3.txt"],
    len=[0.0, 0.5, 1.0],
)
print(par.render())
VARIABLE FILE &
    len=0.0 fname='tpar1.txt' seq=1 &
    len=0.5 fname='tpar2.txt' seq=1 &
    len=1.0 fname='tpar3.txt' seq=1

Fields:

Validators:

model_type pydantic-field

model_type: Literal["variablefile", "VARIABLEFILE"] = (
    "variablefile"
)

Model type discriminator

fname pydantic-field

fname: list[Annotated[str, Field(max_length=36)]]

Names of the files containing the boundary condition

seq pydantic-field

seq: Optional[list[Annotated[int, Field(ge=1)]]] = None

sequence number of geographic location in the file (see Appendix D); useful for files which contain spectra for more than one location. Note: a TPAR file always contains only one location so in this case [seq] must always be 1.

dist pydantic-field

dist: list[Annotated[float, Field(ge=0)]]

Is the distance from the first point of the side or segment to the point along the side or segment for which the incident wave spectrum is prescribed. Note: these points do no have to coincide with grid points of the computational grid. [len] is the distance in m or degrees in the case of spherical coordinates, not in grid steps. The values of len should be given in ascending order. The length along a SIDE is measured in clockwise or counterclockwise direction, depending on the options CCW or CLOCKWISE (see above). The option CCW is default. In case of a SEGMENT the length is measured from the indicated begin point of the segment.

ensure_equal_size pydantic-validator

ensure_equal_size() -> VARIABLEFILE

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

DEFAULT pydantic-model

DEFAULT(**data: Any)

Bases: BaseSubComponent

Default initial conditions.

DEFAULT

The initial spectra are computed from the local wind velocities, using the deep-water growth curve of Kahma and Calkoen (1992), cut off at values of significant wave height and peak frequency from Pierson and Moskowitz (1964). The average (over the model area) spatial step size is used as fetch with local wind. The shape of the spectrum is default JONSWAP with a cos2-directional distribution (options are available: see command BOUND SHAPE).

Examples
from rompy_swan.subcomponents.boundary import DEFAULT
init = DEFAULT()
print(init.render())
DEFAULT

Fields:

model_type pydantic-field

model_type: Literal['default', 'DEFAULT'] = 'default'

Model type discriminator

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

ZERO pydantic-model

ZERO(**data: Any)

Bases: BaseSubComponent

Zero initial conditions.

ZERO

The initial spectral densities are all 0; note that if waves are generated in the model only by wind, waves can become non-zero only by the presence of the ”A” term in the growth model; see the keyword AGROW in command GEN3.

Examples
from rompy_swan.subcomponents.boundary import ZERO
init = ZERO()
print(init.render())
ZERO

Fields:

model_type pydantic-field

model_type: Literal['zero', 'ZERO'] = 'zero'

Model type discriminator

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

HOTSINGLE pydantic-model

HOTSINGLE(**data: Any)

Bases: BaseSubComponent

Hotstart single initial conditions.

HOTSTART SINGLE fname='fname' FREE|UNFORMATTED

Initial wave field is read from file; this file was generated in a previous SWAN run by means of the HOTFILE command. If the previous run was nonstationary, the time found on the file will be assumed to be the initial time of computation. It can also be used for stationary computation as first guess. The computational grid (both in geographical space and in spectral space) must be identical to the one in the run in which the initial wave field was computed

Input will be read from a single (concatenated) hotfile. In the case of a previous parallel MPI run, the concatenated hotfile can be created from a set of multiple hotfiles using the program hcat.exe, see Implementation Manual.

Examples
from rompy_swan.subcomponents.boundary import HOTSINGLE
init = HOTSINGLE(fname="hotstart.swn", format="free")
print(init.render())
HOTSTART SINGLE fname='hotstart.swn' FREE

Fields:

model_type pydantic-field

model_type: Literal['hotsingle', 'HOTSINGLE'] = 'hotsingle'

Model type discriminator

fname pydantic-field

fname: str

Name of the file containing the initial wave field

format pydantic-field

format: Literal['free', 'unformatted'] = 'free'

Format of the file containing the initial wave field. FREE: free format, UNFORMATTED: binary format

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

HOTMULTIPLE pydantic-model

HOTMULTIPLE(**data: Any)

Bases: BaseSubComponent

Hotstart multiple initial conditions.

HOTSTART MULTIPLE fname='fname' FREE|UNFORMATTED

Initial wave field is read from file; this file was generated in a previous SWAN run by means of the HOTFILE command. If the previous run was nonstationary, the time found on the file will be assumed to be the initial time of computation. It can also be used for stationary computation as first guess. The computational grid (both in geographical space and in spectral space) must be identical to the one in the run in which the initial wave field was computed

Input will be read from multiple hotfiles obtained from a previous parallel MPI run. The number of files equals the number of processors. Hence, for the present run the same number of processors must be chosen.

Examples
from rompy_swan.subcomponents.boundary import HOTMULTIPLE
init = HOTMULTIPLE(fname="hotstart.swn", format="free")
print(init.render())
HOTSTART MULTIPLE fname='hotstart.swn' FREE

Fields:

model_type pydantic-field

model_type: Literal["hotmultiple", "HOTMULTIPLE"] = (
    "hotmultiple"
)

Model type discriminator

fname pydantic-field

fname: str

Name of the file containing the initial wave field

format pydantic-field

format: Literal['free', 'unformatted'] = 'free'

Format of the file containing the initial wave field. FREE: free format, UNFORMATTED: binary format

cmd

cmd() -> str

Render subcomponent cmd.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

rompy_swan.subcomponents.physics

SWAN physics subcomponents.

SourceTerms pydantic-model

SourceTerms(**data: Any)

Bases: BaseSubComponent, ABC

Source term subcomponent base class.

Fields:

wind_drag pydantic-field

wind_drag: Literal['wu', 'fit'] = 'wu'

Indicates the wind drag formulation

agrow pydantic-field

agrow: bool = False

Activate the Cavaleri and Malanotte (1981) wave growth term

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

model_type pydantic-field

model_type: Literal['subcomponent']

Model type discriminator

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

JANSSEN pydantic-model

JANSSEN(**data: Any)

Bases: SourceTerms

Janssen source terms subcomponent.

JANSSEN [cds1] [delta] (AGROW [a])
References

Janssen, P.A., 1989. Wave-induced stress and the drag of air flow over sea waves. Journal of Physical Oceanography, 19(6), pp.745-754.

Janssen, P.A.E.M., Lionello, P. and Zambresky, L., 1989. On the interaction of wind and waves. Philosophical transactions of the royal society of London. Series A, Mathematical and Physical Sciences, 329(1604), pp.289-301.

Janssen, P.A., 1991. Quasi-linear theory of wind-wave generation applied to wave forecasting. Journal of physical oceanography, 21(11), pp.1631-1642.

Examples
from rompy_swan.subcomponents.physics import JANSSEN
janssen = JANSSEN()
print(janssen.render())
janssen = JANSSEN(cds1=4.5, delta=0.5, agrow=True)
print(janssen.render())
JANSSEN DRAG WU
JANSSEN cds1=4.5 delta=0.5 DRAG WU AGROW

Fields:

model_type pydantic-field

model_type: Literal['janssen', 'JANSSEN'] = 'janssen'

Model type discriminator

cds1 pydantic-field

cds1: Optional[float] = None

Coefficient for determining the rate of whitecapping dissipation ($Cds / s^4_{PM}$) (SWAN default: 4.5)

delta pydantic-field

delta: Optional[float] = None

Coefficient which determines the dependency of the whitecapping on wave number (mix with Komen et al. formulation) (SWAN default: 0.5)

wind_drag pydantic-field

wind_drag: Literal['wu', 'fit'] = 'wu'

Indicates the wind drag formulation

agrow pydantic-field

agrow: bool = False

Activate the Cavaleri and Malanotte (1981) wave growth term

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

KOMEN pydantic-model

KOMEN(**data: Any)

Bases: SourceTerms

Komen source terms subcomponent.

KOMEN [cds2] [stpm] (AGROW [a])
References

Komen, G.J., Hasselmann, S. and Hasselmann, K., 1984. On the existence of a fully developed wind-sea spectrum. Journal of physical oceanography, 14(8), pp.1271-1285.

Examples
from rompy_swan.subcomponents.physics import KOMEN
komen = KOMEN()
print(komen.render())
komen = KOMEN(cds2=2.36e-5, stpm=3.02e-3, agrow=True, a=0.0015)
print(komen.render())
KOMEN DRAG WU
KOMEN cds2=2.36e-05 stpm=0.00302 DRAG WU AGROW a=0.0015

Fields:

model_type pydantic-field

model_type: Literal['komen', 'KOMEN'] = 'komen'

Model type discriminator

cds2 pydantic-field

cds2: Optional[float] = None

Coefficient for determining the rate of whitecapping dissipation (Cds) (SWAN default: 2.36e-5)

stpm pydantic-field

stpm: Optional[float] = None

Value of the wave steepness for a Pierson-Moskowitz spectrum (s^2_PM) (SWAN default: 3.02e-3)

wind_drag pydantic-field

wind_drag: Literal['wu', 'fit'] = 'wu'

Indicates the wind drag formulation

agrow pydantic-field

agrow: bool = False

Activate the Cavaleri and Malanotte (1981) wave growth term

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

WESTHUYSEN pydantic-model

WESTHUYSEN(**data: Any)

Bases: SourceTerms

Westhuysen source terms subcomponent.

WESTHUYSEN [cds2] [br] (AGROW [a])

Nonlinear saturation-based whitecapping combined with wind input of Yan (1987).

Notes

The two arguments are specified in the Appendix C of the User manual but not in the command description for WESTH in Section 4.5.4. They are also options in the WCAPPING command. It is not entirely clear if they should/could be specified here.

References

van der Westhuysen, A.J., Zijlema, M. and Battjes, J.A., 2007. Nonlinear saturation-based whitecapping dissipation in SWAN for deep and shallow water. Coastal Engineering, 54(2), pp.151-170.

Examples
from rompy_swan.subcomponents.physics import WESTHUYSEN
westhuysen = WESTHUYSEN()
print(westhuysen.render())
westhuysen = WESTHUYSEN(cds2=5.0e-5, br=1.75e-3)
print(westhuysen.render())
WESTHUYSEN DRAG WU
WESTHUYSEN cds2=5e-05 br=0.00175 DRAG WU

Fields:

model_type pydantic-field

model_type: Literal["westhuysen", "WESTHUYSEN"] = (
    "westhuysen"
)

Model type discriminator

cds2 pydantic-field

cds2: Optional[float] = None

proportionality coefficient due to Alves and Banner (2003) (SWAN default: 5.0e-5).

br pydantic-field

br: Optional[float] = None

Threshold saturation level (SWAN default: 1.75e-3)

wind_drag pydantic-field

wind_drag: Literal['wu', 'fit'] = 'wu'

Indicates the wind drag formulation

agrow pydantic-field

agrow: bool = False

Activate the Cavaleri and Malanotte (1981) wave growth term

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

ST6 pydantic-model

ST6(**data: Any)

Bases: SourceTerms

St6 source terms subcomponent.

ST6 [a1sds] [a2sds] [p1sds] [p2sds] UP|DOWN HWANG|FAN|ECMWF VECTAU|SCATAU &
    TRUE10|U10PROXY [windscaling] DEBIAS [cdfac] (AGROW [a])

wind input and whitecapping from Rogers et al. (2012) (RBW12).

Notes

The two arguments are specified in the Appendix C of the User manual but not in the command description for WESTH in Section 4.5.4. They are also options in the WCAPPING command. It is not entirely clear if they should/could be specified here.

References

Fan, Y., Lin, S.J., Held, I.M., Yu, Z. and Tolman, H.L., 2012. Global ocean surface wave simulation using a coupled atmosphere–wave model. Journal of Climate, 25(18), pp.6233-6252.

Rogers, W.E., Babanin, A.V. and Wang, D.W., 2012. Observation-consistent input and whitecapping dissipation in a model for wind-generated surface waves: Description and simple calculations. Journal of Atmospheric and Oceanic Technology, 29(9), pp.1329-1346.

Examples
from rompy_swan.subcomponents.physics import ST6
st6 = ST6(a1sds=4.7e-7, a2sds=6.6e-6)
print(st6.render())
kwargs = dict(
    a1sds=2.8e-6,
    a2sds=3.5e-5,
    normalization="up",
    wind_drag="hwang",
    tau="vectau",
    u10="u10proxy",
    windscaling=32.0,
    cdfac=0.89,
    agrow=True,
    a=0.0015,
)
st6 = ST6(**kwargs)
print(st6.render())
ST6 a1sds=4.7e-07 a2sds=6.6e-06 UP HWANG VECTAU U10PROXY windscaling=32.0
ST6 a1sds=2.8e-06 a2sds=3.5e-05 UP HWANG VECTAU U10PROXY windscaling=32.0 DEBIAS cdfac=0.89 AGROW a=0.0015

Fields:

Validators:

model_type pydantic-field

model_type: Literal['st6'] = 'st6'

Model type discriminator

a1sds pydantic-field

a1sds: float

Coefficient related to local dissipation term T1 (a1 in RBW12)

a2sds pydantic-field

a2sds: float

Coefficient related to local dissipation term T2 (a2 in RBW12)

p1sds pydantic-field

p1sds: Optional[float] = None

Power coefficient controlling strength of dissipation term T1 (L in RBW12, SWAN default: 4)

p2sds pydantic-field

p2sds: Optional[float] = None

Power coefficient controlling strength of dissipation term T2 (M in RBW12, SWAN default: 4)

normalization pydantic-field

normalization: Literal['up', 'down'] = 'up'

Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended

wind_drag pydantic-field

wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'

Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology

tau pydantic-field

tau: Literal['vectau', 'scatau'] = 'vectau'

Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended

u10 pydantic-field

u10: Literal['u10proxy', 'true10'] = 'u10proxy'

Wind velocity definition

windscaling pydantic-field

windscaling: Optional[float] = 32.0

Factor to scale U10 with U* when using U10PROXY

cdfac pydantic-field

cdfac: Optional[float] = None

Counter bias in the input wind fields by providing a multiplier on the drag coefficient

u10_cmd property

u10_cmd: str

agrow pydantic-field

agrow: bool = False

Activate the Cavaleri and Malanotte (1981) wave growth term

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

debias_only_with_hwang pydantic-validator

debias_only_with_hwang() -> ST6

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

ST6C1 pydantic-model

ST6C1(**data: Any)

Bases: ST6

First ST6 calibration in the SWAN user manual.

ST6 4.7e-7 6.6e-6 4.0 4.0 UP HWANG VECTAU U10PROXY 28.0 AGROW
Examples
from rompy_swan.subcomponents.physics import ST6C1
st6 = ST6C1()
print(st6.render())
ST6 a1sds=4.7e-07 a2sds=6.6e-06 p1sds=4.0 p2sds=4.0 UP HWANG VECTAU U10PROXY windscaling=28.0 AGROW

Fields:

Validators:

model_type pydantic-field

model_type: Literal['st6c1'] = 'st6c1'

a1sds pydantic-field

a1sds: Literal[4.7e-07] = 4.7e-07

a2sds pydantic-field

a2sds: Literal[6.6e-06] = 6.6e-06

p1sds pydantic-field

p1sds: Literal[4.0] = 4.0

p2sds pydantic-field

p2sds: Literal[4.0] = 4.0

windscaling pydantic-field

windscaling: Literal[28.0] = 28.0

agrow pydantic-field

agrow: Literal[True] = True

wind_drag pydantic-field

wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'

Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

normalization pydantic-field

normalization: Literal['up', 'down'] = 'up'

Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended

tau pydantic-field

tau: Literal['vectau', 'scatau'] = 'vectau'

Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended

u10 pydantic-field

u10: Literal['u10proxy', 'true10'] = 'u10proxy'

Wind velocity definition

cdfac pydantic-field

cdfac: Optional[float] = None

Counter bias in the input wind fields by providing a multiplier on the drag coefficient

u10_cmd property

u10_cmd: str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

debias_only_with_hwang pydantic-validator

debias_only_with_hwang() -> ST6

ST6C2 pydantic-model

ST6C2(**data: Any)

Bases: ST6C1

Second ST6 calibration in the SWAN user manual.

ST6 4.7e-7 6.6e-6 4.0 4.0 UP FAN VECTAU U10PROXY 28.0 AGROW
Examples
from rompy_swan.subcomponents.physics import ST6C2
st6 = ST6C2()
print(st6.render())
ST6 a1sds=4.7e-07 a2sds=6.6e-06 p1sds=4.0 p2sds=4.0 UP FAN VECTAU U10PROXY windscaling=28.0 AGROW

TODO: Ensure validator is reused here so fan and debias are not used together.

Fields:

Validators:

model_type pydantic-field

model_type: Literal['st6c2'] = 'st6c2'

wind_drag pydantic-field

wind_drag: Literal['fan'] = 'fan'

agrow pydantic-field

agrow: Literal[True] = True

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

a1sds pydantic-field

a1sds: Literal[4.7e-07] = 4.7e-07

a2sds pydantic-field

a2sds: Literal[6.6e-06] = 6.6e-06

p1sds pydantic-field

p1sds: Literal[4.0] = 4.0

p2sds pydantic-field

p2sds: Literal[4.0] = 4.0

normalization pydantic-field

normalization: Literal['up', 'down'] = 'up'

Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended

tau pydantic-field

tau: Literal['vectau', 'scatau'] = 'vectau'

Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended

u10 pydantic-field

u10: Literal['u10proxy', 'true10'] = 'u10proxy'

Wind velocity definition

windscaling pydantic-field

windscaling: Literal[28.0] = 28.0

cdfac pydantic-field

cdfac: Optional[float] = None

Counter bias in the input wind fields by providing a multiplier on the drag coefficient

u10_cmd property

u10_cmd: str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

debias_only_with_hwang pydantic-validator

debias_only_with_hwang() -> ST6

ST6C3 pydantic-model

ST6C3(**data: Any)

Bases: ST6C1

Third ST6 calibration in the SWAN user manual.

ST6 2.8e-6 3.5e-5 4.0 4.0 UP HWANG VECTAU U10PROXY 32.0 AGROW
Examples
from rompy_swan.subcomponents.physics import ST6C3
st6 = ST6C3()
print(st6.render())
ST6 a1sds=2.8e-06 a2sds=3.5e-05 p1sds=4.0 p2sds=4.0 UP HWANG VECTAU U10PROXY windscaling=32.0 AGROW

Fields:

Validators:

model_type pydantic-field

model_type: Literal['st6c3'] = 'st6c3'

a1sds pydantic-field

a1sds: Literal[2.8e-06] = 2.8e-06

a2sds pydantic-field

a2sds: Literal[3.5e-05] = 3.5e-05

windscaling pydantic-field

windscaling: Literal[32.0] = 32.0

wind_drag pydantic-field

wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'

Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology

agrow pydantic-field

agrow: Literal[True] = True

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

p1sds pydantic-field

p1sds: Literal[4.0] = 4.0

p2sds pydantic-field

p2sds: Literal[4.0] = 4.0

normalization pydantic-field

normalization: Literal['up', 'down'] = 'up'

Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended

tau pydantic-field

tau: Literal['vectau', 'scatau'] = 'vectau'

Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended

u10 pydantic-field

u10: Literal['u10proxy', 'true10'] = 'u10proxy'

Wind velocity definition

cdfac pydantic-field

cdfac: Optional[float] = None

Counter bias in the input wind fields by providing a multiplier on the drag coefficient

u10_cmd property

u10_cmd: str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

debias_only_with_hwang pydantic-validator

debias_only_with_hwang() -> ST6

ST6C4 pydantic-model

ST6C4(**data: Any)

Bases: ST6C3

Fourth ST6 calibration in the SWAN user manual.

ST6 2.8e-6 3.5e-5 4.0 4.0 UP HWANG VECTAU U10PROXY 32.0 DEBIAS 0.89 AGROW
Examples
from rompy_swan.subcomponents.physics import ST6C4
st6 = ST6C4()
print(st6.render())
ST6 a1sds=2.8e-06 a2sds=3.5e-05 p1sds=4.0 p2sds=4.0 UP HWANG VECTAU U10PROXY windscaling=32.0 DEBIAS cdfac=0.89 AGROW

Fields:

Validators:

model_type pydantic-field

model_type: Literal['st6c4'] = 'st6c4'

cdfac pydantic-field

cdfac: Literal[0.89] = 0.89

wind_drag pydantic-field

wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'

Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology

agrow pydantic-field

agrow: Literal[True] = True

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

a1sds pydantic-field

a1sds: Literal[2.8e-06] = 2.8e-06

a2sds pydantic-field

a2sds: Literal[3.5e-05] = 3.5e-05

p1sds pydantic-field

p1sds: Literal[4.0] = 4.0

p2sds pydantic-field

p2sds: Literal[4.0] = 4.0

normalization pydantic-field

normalization: Literal['up', 'down'] = 'up'

Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended

tau pydantic-field

tau: Literal['vectau', 'scatau'] = 'vectau'

Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended

u10 pydantic-field

u10: Literal['u10proxy', 'true10'] = 'u10proxy'

Wind velocity definition

windscaling pydantic-field

windscaling: Literal[32.0] = 32.0

u10_cmd property

u10_cmd: str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

debias_only_with_hwang pydantic-validator

debias_only_with_hwang() -> ST6

ST6C5 pydantic-model

ST6C5(**data: Any)

Bases: ST6C1

Fifth ST6 calibration in the SWAN user manual.

ST6 6.5e-6 8.5e-5 4.0 4.0 UP HWANG VECTAU U10PROXY 35.0 DEBIAS 0.89 AGROW
Examples
from rompy_swan.subcomponents.physics import ST6C5
st6 = ST6C5()
print(st6.render())
ST6 a1sds=6.5e-06 a2sds=8.5e-05 p1sds=4.0 p2sds=4.0 UP HWANG VECTAU U10PROXY windscaling=35.0 DEBIAS cdfac=0.89 AGROW

Fields:

Validators:

model_type pydantic-field

model_type: Literal['st6c5'] = 'st6c5'

cdfac pydantic-field

cdfac: Literal[0.89] = 0.89

a1sds pydantic-field

a1sds: Literal[6.5e-06] = 6.5e-06

a2sds pydantic-field

a2sds: Literal[8.5e-05] = 8.5e-05

windscaling pydantic-field

windscaling: Literal[35.0] = 35.0

wind_drag pydantic-field

wind_drag: Literal['hwang', 'fan', 'ecmwf'] = 'hwang'

Wind drag formula, hwang is the default and is unchanged from RBW12, fan is from Fan et al. (2012), ecmwf follows WAM Cycle 4 methodology

agrow pydantic-field

agrow: Literal[True] = True

a pydantic-field

a: Optional[float] = None

Proportionality coefficient when activating the Cavaleri and Malanotte (1981) wave growth term (SWAN default: 0.0015)

p1sds pydantic-field

p1sds: Literal[4.0] = 4.0

p2sds pydantic-field

p2sds: Literal[4.0] = 4.0

normalization pydantic-field

normalization: Literal['up', 'down'] = 'up'

Selection of normalization of exceedance level by ET(f) (up) or E(f) (down) as in RBW12 (right column, page 1333), up is default and strongly recommended

tau pydantic-field

tau: Literal['vectau', 'scatau'] = 'vectau'

Use vector (vectau) or scalar (scatau) calculation for the wind strerss (Eq. 12 in RBW12), vectau is the default and strongly recommended

u10 pydantic-field

u10: Literal['u10proxy', 'true10'] = 'u10proxy'

Wind velocity definition

u10_cmd property

u10_cmd: str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

cmd

cmd() -> str

render

render() -> str

Render the sub-component to a string.

debias_only_with_hwang pydantic-validator

debias_only_with_hwang() -> ST6

ELDEBERKY pydantic-model

ELDEBERKY(**data: Any)

Bases: BaseSubComponent

Biphase of Eldeberky (1999).

BIPHASE ELDEBERKY [urcrit]

Biphase parameterisation as a funtion of the Ursell number of Eldeberky (1999).

References

Eldeberky, Y., Polnikov, V. and Battjes, J.A., 1996. A statistical approach for modeling triad interactions in dispersive waves. In Coastal Engineering 1996 (pp. 1088-1101).

Eldeberky, Y. and Madsen, P.A., 1999. Deterministic and stochastic evolution equations for fully dispersive and weakly nonlinear waves. Coastal Engineering, 38(1), pp.1-24.

Doering, J.C. and Bowen, A.J., 1995. Parametrization of orbital velocity asymmetries of shoaling and breaking waves using bispectral analysis. Coastal engineering, 26(1-2), pp.15-33.

Examples
from rompy_swan.subcomponents.physics import ELDEBERKY
biphase = ELDEBERKY()
print(biphase.render())
biphase = ELDEBERKY(urcrit=0.63)
print(biphase.render())
BIPHASE ELDEBERKY
BIPHASE ELDEBERKY urcrit=0.63

Fields:

model_type pydantic-field

model_type: Literal['eldeberky'] = 'eldeberky'

Model type discriminator

urcrit pydantic-field

urcrit: Optional[float] = None

The critical Ursell number appearing in the parametrization. Note: the value of urcrit is setted by Eldeberky (1996) at 0.2 based on a laboratory experiment, whereas Doering and Bowen (1995) employed the value of 0.63 based on the field experiment data (SWAN default: 0.63)

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

DEWIT pydantic-model

DEWIT(**data: Any)

Bases: BaseSubComponent

Biphase of De Wit (2022).

BIPHASE DEWIT [lpar]

Biphase parameterization based on bed slope and peak period of De Wit (2022).

References

De Wit, F.P., 2022. Wave shape prediction in complex coastal systems (Doctoral dissertation, PhD. thesis. Delft University of Technology. https://repository. tudelft. nl/islandora/object/uuid% 3A0fb850a4-4294-4181-9d74-857de21265c2).

Examples
from rompy_swan.subcomponents.physics import DEWIT
biphase = DEWIT()
print(biphase.render())
biphase = DEWIT(lpar=0.0)
print(biphase.render())
BIPHASE DEWIT
BIPHASE DEWIT lpar=0.0

Fields:

model_type pydantic-field

model_type: Literal['dewit'] = 'dewit'

Model type discriminator

lpar pydantic-field

lpar: Optional[float] = None

Scales spatial averaging of the De Wit's biphase in terms of a multiple of peak wave length of the incident wave field. Note: lpar = 0` means no averaging (SWAN default: 0)

cmd

cmd() -> str

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

TRANSM pydantic-model

TRANSM(**data: Any)

Bases: BaseSubComponent

Constant transmission coefficient.

TRANSM [trcoef]
Examples
from rompy_swan.subcomponents.physics import TRANSM
transm = TRANSM()
print(transm.render())
transm = TRANSM(trcoef=0.5)
print(transm.render())
TRANSM
TRANSM trcoef=0.5

Fields:

model_type pydantic-field

model_type: Literal['transm', 'TRANSM'] = 'transm'

Model type discriminator

trcoef pydantic-field

trcoef: Optional[float] = None

Constant transmission coefficient (ratio of transmitted over incoming significant wave height) (SWAN default: 0.0) (no transmission = complete blockage)

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

TRANS1D pydantic-model

TRANS1D(**data: Any)

Bases: BaseSubComponent

Frequency dependent transmission.

TRANS1D < [trcoef] >
Examples
from rompy_swan.subcomponents.physics import TRANS1D
transm = TRANS1D(trcoef=[0.0, 0.0, 0.2, 0.5, 0.2, 0.0, 0.0])
print(transm.render())
TRANS1D 0.0 0.0 0.2 0.5 0.2 0.0 0.0

Fields:

model_type pydantic-field

model_type: Literal['trans1d', 'TRANS1D'] = 'trans1d'

Model type discriminator

trcoef pydantic-field

trcoef: list[Annotated[float, Field(ge=0.0, le=1.0)]]

Transmission coefficient (ratio of transmitted over incoming significant wave height) per frequency. The number of these transmission values must be equal to the number of frequencies, i.e. msc + 1

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

TRANS2D pydantic-model

TRANS2D(**data: Any)

Bases: BaseSubComponent

Frequency-direction dependent transmission.

TRANS2D < [trcoef] >
Examples
import numpy as np
from rompy_swan.subcomponents.physics import TRANS2D
trcoef = np.array([[0.0, 0.0], [0.1, 0.1], [0.2, 0.2]])
transm = TRANS2D(trcoef=trcoef)
print(transm.render())
TRANS2D &
    0.0 0.0 &
    0.1 0.1 &
    0.2 0.2 &

Fields:

Validators:

model_type pydantic-field

model_type: Literal['trans2d', 'TRANS2D'] = 'trans2d'

Model type discriminator

trcoef pydantic-field

trcoef: Np2DArray

Transmission coefficient (ratio of transmitted over incoming significant wave height) per frequency and direction, rows represent directions and columns represent frequencies

constrained_0_1 pydantic-validator

constrained_0_1(value: float) -> float

Ensure all directions have the same number of frequencies.

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

GODA pydantic-model

GODA(**data: Any)

Bases: BaseSubComponent

DAM transmission of Goda/Seelig (1979).

DAM GODA [hgt] [alpha] [beta]

This option specified transmission coefficients dependent on the incident wave conditions at the obstacle and on the obstacle height (which may be submerged).

References

Goda, Y. and Suzuki, Y., 1976. Estimation of incident and reflected waves in random wave experiments. In Coastal Engineering 1976 (pp. 828-845).

Seelig, W.N., 1979. Effects of breakwaters on waves: Laboratory test of wave transmission by overtopping. In Proc. Conf. Coastal Structures, 1979 (Vol. 79, No. 2, pp. 941-961).

Examples
from rompy_swan.subcomponents.physics import GODA
transm = GODA(hgt=3.0)
print(transm.render())
transm = GODA(hgt=3.0, alpha=2.6, beta=0.15)
print(transm.render())
DAM GODA hgt=3.0
DAM GODA hgt=3.0 alpha=2.6 beta=0.15

Fields:

model_type pydantic-field

model_type: Literal['goda', 'GODA'] = 'goda'

Model type discriminator

hgt pydantic-field

hgt: float

The elevation of the top of the obstacle above reference level (same reference level as for bottom etc.); use a negative value if the top is below that reference level

alpha pydantic-field

alpha: Optional[float] = None

coefficient determining the transmission coefficient for Goda's transmission formula (SWAN default: 2.6)

beta pydantic-field

beta: Optional[float] = None

Another coefficient determining the transmission coefficient for Goda's transmission formula (SWAN default: 0.15)

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

DANGREMOND pydantic-model

DANGREMOND(**data: Any)

Bases: BaseSubComponent

DAM transmission of d'Angremond et al. (1996).

DAM DANGREMOND [hgt] [slope] [Bk]

This option specifies transmission coefficients dependent on the incident wave conditions at the obstacle and on the obstacle height (which may be submerged).

References

d'Angremond, K., Van Der Meer, J.W. and De Jong, R.J., 1996. Wave transmission at low-crested structures. In Coastal Engineering 1996 (pp. 2418-2427).

Examples
from rompy_swan.subcomponents.physics import DANGREMOND
transm = DANGREMOND(hgt=3.0, slope=60, Bk=10.0)
print(transm.render())
DAM DANGREMOND hgt=3.0 slope=60.0 Bk=10.0

Fields:

model_type pydantic-field

model_type: Literal["dangremond", "DANGREMOND"] = (
    "dangremond"
)

Model type discriminator

hgt pydantic-field

hgt: float

The elevation of the top of the obstacle above reference level (same reference level as for bottom etc.); use a negative value if the top is below that reference level

slope pydantic-field

slope: float

The slope of the obstacle (in degrees)

Bk pydantic-field

Bk: float

The crest width of the obstacle

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

REFL pydantic-model

REFL(**data: Any)

Bases: BaseSubComponent

Obstacle reflections.

REFL [reflc]
Examples
from rompy_swan.subcomponents.physics import REFL
refl = REFL()
print(refl.render())
refl = REFL(reflc=0.5)
print(refl.render())
REFL
REFL reflc=0.5

Fields:

model_type pydantic-field

model_type: Literal['refl', 'REFL'] = 'refl'

Model type discriminator

reflc pydantic-field

reflc: Optional[float] = None

Constant reflection coefficient (ratio of reflected over incoming significant wave height) (SWAN default: 1.0)

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

RSPEC pydantic-model

RSPEC(**data: Any)

Bases: BaseSubComponent

Specular reflection.

RSPEC
Examples
from rompy_swan.subcomponents.physics import RSPEC
refl = RSPEC()
print(refl.render())
RSPEC

Fields:

model_type pydantic-field

model_type: Literal['rspec', 'RSPEC'] = 'rspec'

Model type discriminator

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

RDIFF pydantic-model

RDIFF(**data: Any)

Bases: BaseSubComponent

Diffuse reflection.

RDIFF [pown]

Specular reflection where incident waves are scattered over reflected direction.

Examples
from rompy_swan.subcomponents.physics import RDIFF
refl = RDIFF()
print(refl.render())
refl = RDIFF(pown=1.0)
print(refl.render())
RDIFF
RDIFF pown=1.0

Fields:

model_type pydantic-field

model_type: Literal['rdiff', 'RDIFF'] = 'rdiff'

Model type discriminator

pown pydantic-field

pown: Optional[float] = None

Each incoming direction θ is scattered over reflected direction θ_refl according to cos^pown(θ-θ_refl). The parameter pown indicates the widthof the redistribution function (SWAN default: 1.0)

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

FREEBOARD pydantic-model

FREEBOARD(**data: Any)

Bases: BaseSubComponent

Freeboard dependent transmission and reflection.

FREEBOARD [hgt] [gammat] [gammar] [QUAY]

With this option the user indicates that the fixed transmission trcoef and reflection reflc coefficients are freeboard dependent. The freeboard dependency has no effect on the transmission coefficient as computed using the DAM option.

Notes

See the Scientific/Technical documentation for background information on the gammat and gammar shape parameters.

Examples
from rompy_swan.subcomponents.physics import FREEBOARD
freeboard = FREEBOARD(hgt=2.0)
print(freeboard.render())
freeboard = FREEBOARD(hgt=2.0, gammat=1.0, gammar=1.0, quay=True)
print(freeboard.render())
FREEBOARD hgt=2.0
FREEBOARD hgt=2.0 gammat=1.0 gammar=1.0 QUAY

Fields:

model_type pydantic-field

model_type: Literal['freeboard', 'FREEBOARD'] = 'freeboard'

Model type discriminator

hgt pydantic-field

hgt: float

The elevation of the top of the obstacle or height of the quay above the reference level (same reference level as for the bottom). Use a negative value if the top is below that reference level. In case hgt is also specified in the DAM option, both values of hgt should be equal for consistency

gammat pydantic-field

gammat: Optional[float] = None

Shape parameter of relative freeboard dependency of transmission coefficient. This parameter should be higher than zero (SWAN default 1.0)

gammar pydantic-field

gammar: Optional[float] = None

Shape parameter of relative freeboard dependency of reflection coefficient. This parameter should be higher than zero (SWAN default 1.0)

quay pydantic-field

quay: bool = False

With this option the user indicates that the freeboard dependency of the transmission and reflection coefficients also depends on the relative position of an obstacle-linked grid point with respect to the position of the obstacle line representing the edge of a quay. In case the active grid point is on the deeper side of the obstacle, then the correction factors are applied using the parameters hgt, gammat and gammar.In case the active grid point is on the shallower side of the obstacle, the reflection coefficient is set to 0 and the transmission coefficient to 1.

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

LINE pydantic-model

LINE(**data: Any)

Bases: BaseSubComponent

Line of points to define obstacle location.

LINE < [xp] [yp] >

With this option the user indicates that the fixed transmission trcoef and reflection reflc coefficients are freeboard dependent. The freeboard dependency has no effect on the transmission coefficient as computed using the DAM option.

Notes

Points coordinates should be provided in m If Cartesian coordinates are used or in degrees if spherical coordinates are used (see command COORD). At least two corner points must be provided.

Examples
from rompy_swan.subcomponents.physics import LINE
line = LINE(xp=[174.1, 174.2, 174.3], yp=[-39.1, -39.1, -39.1])
print(line.render())
LINE 174.1 -39.1 174.2 -39.1 174.3 -39.1

Fields:

Validators:

model_type pydantic-field

model_type: Literal['line', 'LINE'] = 'line'

Model type discriminator

xp pydantic-field

xp: list[float]

The x-coordinates of the points defining the line

yp pydantic-field

yp: list[float]

The y-coordinates of the points defining the line

check_length pydantic-validator

check_length() -> LINE

Check that the length of xp and yp are the same.

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

rompy_swan.subcomponents.numerics

SWAN numerics subcomponents.

BSBT pydantic-model

BSBT(**data: Any)

Bases: BaseSubComponent

BSBT first order propagation scheme.

BSBT
Examples
from rompy_swan.subcomponents.numerics import BSBT
scheme = BSBT()
print(scheme.render())
BSBT

Fields:

model_type pydantic-field

model_type: Literal['bsbt', 'BSBT'] = 'bsbt'

Model type discriminator

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

GSE pydantic-model

GSE(**data: Any)

Bases: BaseSubComponent

Garden-sprinkler effect.

GSE [waveage] Sec|MIn|HR|DAy

Garden-sprinkler effect is to be counteracted in the S&L propagation scheme (default for nonstationary regular grid computations) or in the propagation scheme for unstructured grids by adding a diffusion term to the basic equation. This may affect the numerical stability of SWAN.

Examples
from rompy_swan.subcomponents.numerics import GSE
scheme = GSE(waveage=dict(delt=86400, dfmt="day"))
print(scheme.render())
GSE waveage=1.0 DAY

Fields:

model_type pydantic-field

model_type: Literal['gse', 'GSE'] = 'gse'

Model type discriminator

waveage pydantic-field

waveage: Optional[Delt] = None

The time interval used to determine the diffusion which counteracts the so-called garden-sprinkler effect. The default value of waveage is zero, i.e. no added diffusion. The value of waveage should correspond to the travel time of the waves over the computational region.

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

STAT pydantic-model

STAT(**data: Any)

Bases: BaseSubComponent

Computation parameters in stationary computation.

Fields:

model_type pydantic-field

model_type: Literal['stat', 'STAT'] = 'stat'

Model type discriminator

mxitst pydantic-field

mxitst: Optional[int] = None

The maximum number of iterations for stationary computations. The computation stops when this number is exceeded (SWAN default: 50)

alfa pydantic-field

alfa: Optional[float] = None

Proportionality constant used in the frequency-dependent under-relaxation technique. Based on experiences, a suggestion for this parameter is alfa = 0.01. In case of diffraction computations, the use of this parameter is recommended (SWAN default: 0.00)

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

NONSTAT pydantic-model

NONSTAT(**data: Any)

Bases: BaseSubComponent

Computation parameters in nonstationary computation.

Fields:

model_type pydantic-field

model_type: Literal['nonstat', 'NONSTAT'] = 'nonstat'

Model type discriminator

mxitns pydantic-field

mxitns: Optional[int] = None

The maximum number of iterations per time step for nonstationary computations. The computation moves to the next time step when this number is exceeded (SWAN default: mxitns = 1

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

STOPC pydantic-model

STOPC(**data: Any)

Bases: BaseSubComponent

Stopping criteria of Zijlema and Van der Westhuysen (2005).

STOPC [dabs] [drel] [curvat] [npnts] ->STAT|NONSTAT [limiter]

With this option the user can influence the criterion for terminating the iterative procedure in the SWAN computations (both stationary and nonstationary). The criterion makes use of the second derivative, or curvature, of the iteration curve of the significant wave height. As the solution of a simulation approaches full convergence, the curvature of the iteration curve will tend to zero. SWAN stops the process if the relative change in Hs from one iteration to the next is less than drel and the curvature of the iteration curve of Hs normalized with Hs is less than curvat or the absolute change in Hs from one iteration to the next is less than dabs. Both conditions need to be fulfilled in more than fraction npnts percent of all wet grid points.

With respect to the QC modelling, another stopping criteria will be employed. Namely, SWAN stops the iteration process if the absolute change in Hs from one iterate to another is less than dabs * Hinc, where Hinc is the representative incident wave height, or the relative change in Hs from one to the next iteration is less than drel. These criteria must be fulfilled in more than npnts percent of all active, well-defined points.

References
  • Zijlema, M. and Van der Westhuysen, A. (2005). On convergence behaviour and numerical accuracy in stationary SWAN simulations of nearshore wind wave spectra, Coastal Engineering, 52(3), p. 337-256.
Examples
from rompy_swan.subcomponents.numerics import STOPC
stop = STOPC()
print(stop.render())
stop = STOPC(
    dabs=0.005,
    drel=0.01,
    curvat=0.005,
    npnts=99.5,
    mode=dict(model_type="nonstat", mxitns=1),
    limiter=0.1,
)
print(stop.render())
STOPC
STOPC dabs=0.005 drel=0.01 curvat=0.005 npnts=99.5 NONSTATIONARY mxitns=1 limiter=0.1

Fields:

model_type pydantic-field

model_type: Literal['stopc', 'STOPC'] = 'stopc'

Model type discriminator

dabs pydantic-field

dabs: Optional[float] = None

Maximum absolute change in Hs from one iteration to the next (SWAN default: 0.005 [m] or 0.05 [-] in case of QC model)

drel pydantic-field

drel: Optional[float] = None

Maximum relative change in Hs from one iteration to the next (SWAN default: 0.01 [-])

curvat pydantic-field

curvat: Optional[float] = None

Maximum curvature of the iteration curve of Hs normalised with Hs (SWAN default: 0.005 [-] (not used in the QC model))

npnts pydantic-field

npnts: Optional[float] = None

Percentage of points in the computational grid above which the stopping criteria needs to be satisfied (SWAN default: 99.5 [-])

mode pydantic-field

mode: Optional[Union[STAT, NONSTAT]] = None

Termination criteria for stationary or nonstationary runs

limiter pydantic-field

limiter: Optional[float] = None

Determines the maximum change per iteration of the energy density per spectral-bin given in terms of a fraction of the omni-directional Phillips level (SWAN default: 0.1)

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

ACCUR pydantic-model

ACCUR(**data: Any)

Bases: BaseSubComponent

Stop the iterative procedure.

ACCUR [drel] [dhoval] [dtoval] [npnts] ->STAT|NONSTAT [limiter]

With this option the user can influence the criterion for terminating the iterative procedure in the SWAN computations (both stationary and non-stationary modes). SWAN stops the iterations if (a), (b) and (c) are all satisfied:

a) The change in the local significant wave height Hs from one iteration to the next is less than (1) fraction drel of that height or (2) fraction dhoval of the average Hs over all grid points.

b) The change in the local mean wave period Tm01 from one iteration to the next is less than (1) fraction drel of that period or (2) fraction dtoval of the average mean wave period over all wet grid points.

c) Conditions (a) and (b) are fulfilled in more than fraction npnts% of all wet grid points.

Note

This command has become obsolete in SWAN 41.01. The command STOPC should be used.

Examples:

from rompy_swan.subcomponents.numerics import ACCUR
accur = ACCUR()
print(accur.render())
accur = ACCUR(
    drel=0.01,
    dhoval=0.02,
    dtoval=0.02,
    npnts=98.0,
    mode=dict(model_type="nonstat", mxitns=1),
    limiter=0.1,
)
print(accur.render())
ACCUR
ACCUR drel=0.01 dhoval=0.02 dtoval=0.02 npnts=98.0 NONSTATIONARY mxitns=1 limiter=0.1

Fields:

model_type pydantic-field

model_type: Literal['accur', 'ACCUR'] = 'accur'

Model type discriminator

drel pydantic-field

drel: Optional[float] = None

Maximum relative change in Hs or Tm01 from one iteration to the next (SWAN default: 0.02)

dhoval pydantic-field

dhoval: Optional[float] = None

Fraction of the average Hs over all wet grid points below which the the stopping criteria needs to be satisfied (SWAN default: 0.02)

dtoval pydantic-field

dtoval: Optional[float] = None

Fraction of the average Tm01 over all wet grid points below which the the stopping criteria needs to be satisfied (SWAN default: 0.02)

npnts pydantic-field

npnts: Optional[float] = None

Percentage of points in the computational grid above which the stopping criteria needs to be satisfied (SWAN default: 98)

mode pydantic-field

mode: Optional[Union[STAT, NONSTAT]] = None

Termination criteria for stationary or nonstationary runs

limiter pydantic-field

limiter: Optional[float] = None

Determines the maximum change per iteration of the energy density per spectral-bin given in terms of a fraction of the omni-directional Phillips level (SWAN default: 0.1)

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

DIRIMPL pydantic-model

DIRIMPL(**data: Any)

Bases: BaseSubComponent

Numerical scheme for refraction.

DIRIMPL [cdd]
Examples
from rompy_swan.subcomponents.numerics import DIRIMPL
dirimpl = DIRIMPL()
print(dirimpl.render())
dirimpl = DIRIMPL(cdd=0.5)
print(dirimpl.render())
DIRIMPL
DIRIMPL cdd=0.5

Fields:

model_type pydantic-field

model_type: Literal['dirimpl', 'DIRIMPL'] = 'dirimpl'

Model type discriminator

cdd pydantic-field

cdd: Optional[float] = None

A value of cdd=0 corresponds to a central scheme and has the largest accuracy (diffusion ≈ 0) but the computation may more easily generatespurious fluctuations. A value of cdd=1 corresponds to a first orderupwind scheme and it is more diffusive and therefore preferable if (strong) gradients in depth or current are present (SWAN default: 0.5)

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

SIGIMPL pydantic-model

SIGIMPL(**data: Any)

Bases: BaseSubComponent

Frequency shifting accuracy.

SIGIMpl [css] [eps2] [outp] [niter]

Controls the accuracy of computing the frequency shifting and the stopping criterion and amount of output for the SIP solver (used in the computations in the presence of currents or time varying depth)

Examples
from rompy_swan.subcomponents.numerics import SIGIMPL
sigimpl = SIGIMPL()
print(sigimpl.render())
sigimpl = SIGIMPL(css=0.5, eps2=1e-4, outp=0, niter=20)
print(sigimpl.render())
SIGIMPL
SIGIMPL css=0.5 eps2=0.0001 outp=0 niter=20

Fields:

model_type pydantic-field

model_type: Literal['sigimpl', 'SIGIMPL'] = 'sigimpl'

Model type discriminator

css pydantic-field

css: Optional[float] = None

A value of css=0 corresponds to a central scheme and has the largest accuracy (diffusion ≈ 0) but the computation may more easily generate spurious fluctuations. A value of css=1 corresponds to a first order upwind scheme and it is more diffusive and therefore preferable if (strong) gradients in depth or current are present (SWAN default: 0.5)

eps2 pydantic-field

eps2: Optional[float] = None

Relative stopping criterion to terminate the linear solver (SIP or SOR). (SWAN default: 1.e-4 in case of SIP and 1.e-6 in case of SOR)

outp pydantic-field

outp: Optional[Literal[0, 1, 2, 3]] = None

Output for the iterative solver:

  • 0 = no output
  • 1 = additional information about the iteration process is written to the PRINT file
  • 2 = gives a maximal amount of output concerning the iteration process
  • 3 = summary of the iteration process

(SWAN default: 0)

niter pydantic-field

niter: Optional[int] = None

Maximum number of iterations for the linear solver (SWAN default: 20 in case of SIP and 1000 in case of SOR)

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

CTHETA pydantic-model

CTHETA(**data: Any)

Bases: BaseSubComponent

Prevents excessive directional turning.

CTheta [cfl]

This option prevents an excessive directional turning at a single grid point or vertex due to a very coarse bathymetry or current locally. This option limits the directional turning rate cθ based on the CFL restriction. (See Eq. 3.41 of Scientific/Technical documentation). See also the final remark in Section 2.6.3. Note that if this command is not specified, then the limiter is not activated.

Examples
from rompy_swan.subcomponents.numerics import CTHETA
ctheta = CTHETA()
print(ctheta.render())
ctheta = CTHETA(cfl=0.9)
print(ctheta.render())
CTHETA
CTHETA cfl=0.9

Fields:

model_type pydantic-field

model_type: Literal['ctheta', 'CTHETA'] = 'ctheta'

Model type discriminator

cfl pydantic-field

cfl: Optional[float] = None

Upper limit for the CFL restriction for ctheta. A suggestion for this parameter is cfl = 0.9 (SWAN default: 0.9 when CTHETA is activated)

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

CSIGMA pydantic-model

CSIGMA(**data: Any)

Bases: BaseSubComponent

Prevents excessive directional turning.

CSigma [cfl]

This option prevents an excessive frequency shifting at a single grid point or vertex due to a very coarse bathymetry or current locally. This option limits the frequency shifting rate csigma based on the CFL restriction. See also the final remark in Section 2.6.3. Note that if this command is not specified, then the limiter is not activated.

Examples
from rompy_swan.subcomponents.numerics import CSIGMA
csigma = CSIGMA()
print(csigma.render())
csigma = CSIGMA(cfl=0.9)
print(csigma.render())
CSIGMA
CSIGMA cfl=0.9

Fields:

model_type pydantic-field

model_type: Literal['csigma', 'CSIGMA'] = 'csigma'

Model type discriminator

cfl pydantic-field

cfl: Optional[float] = None

Upper limit for the CFL restriction for csigma. A suggestion for this parameter is cfl = 0.9 (SWAN default: 0.9 when CSIGMA is activated)

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

SETUP pydantic-model

SETUP(**data: Any)

Bases: BaseSubComponent

Stop criteria in the computation of wave setup.

SETUP [eps2] [outp] [niter]

Controls the stopping criterion and amount of output for the SOR solver in the computation of the wave-induced set-up.

Examples
from rompy_swan.subcomponents.numerics import SETUP
setup = SETUP()
print(setup.render())
setup = SETUP(eps2=1e-4, outp=0, niter=20)
print(setup.render())
SETUP
SETUP eps2=0.0001 outp=0 niter=20

Fields:

model_type pydantic-field

model_type: Literal['setup', 'SETUP'] = 'setup'

Model type discriminator

eps2 pydantic-field

eps2: Optional[float] = None

Relative stopping criterion to terminate the linear solver (SIP or SOR). (SWAN default: 1.e-4 in case of SIP and 1.e-6 in case of SOR)

outp pydantic-field

outp: Optional[Literal[0, 1, 2, 3]] = None

Output for the iterative solver:

  • 0 = no output
  • 1 = additional information about the iteration process is written to the PRINT file
  • 2 = gives a maximal amount of output concerning the iteration process
  • 3 = summary of the iteration process

(SWAN default: 0)

niter pydantic-field

niter: Optional[int] = None

Maximum number of iterations for the linear solver (SWAN default: 20 in case of SIP and 1000 in case of SOR)

cmd

cmd() -> str

Command file string for this component.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

rompy_swan.subcomponents.output

SWAN Output Subcomponents

This module contains subcomponents for defining output specifications in SWAN, including spectral output types and frequency representations.

SPEC1D pydantic-model

SPEC1D(**data: Any)

Bases: BaseSubComponent

Frequency 1D spectra.

SPEC1D
Examples
from rompy_swan.subcomponents.output import SPEC1D
spec = SPEC1D()
print(spec.render())
SPEC1D

Fields:

model_type pydantic-field

model_type: Literal['spec1d', 'SPEC1D'] = 'spec1d'

Model type discriminator

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

SPEC2D pydantic-model

SPEC2D(**data: Any)

Bases: BaseSubComponent

Frequency-direction 2D spectra.

SPEC2D
Examples
from rompy_swan.subcomponents.output import SPEC2D
spec = SPEC2D()
print(spec.render())
SPEC2D

Fields:

model_type pydantic-field

model_type: Literal['spec2d', 'SPEC2D'] = 'spec2d'

Model type discriminator

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

ABS pydantic-model

ABS(**data: Any)

Bases: BaseSubComponent

Absolute frequency spectra.

ABS

Spectra are computed as a function of absolute frequency, i.e., the frequency as measured in a fixed point.

Examples
from rompy_swan.subcomponents.output import ABS
freq = ABS()
print(freq.render())
ABS

Fields:

model_type pydantic-field

model_type: Literal['abs', 'ABS'] = 'abs'

Model type discriminator

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.

REL pydantic-model

REL(**data: Any)

Bases: BaseSubComponent

Relative frequency spectra.

REL

Spectra are computed as a function of relative frequency, i.e., the frequency as measured when moving with current.

Examples
from rompy_swan.subcomponents.output import REL
freq = REL()
print(freq.render())
REL

Fields:

model_type pydantic-field

model_type: Literal['rel', 'REL'] = 'rel'

Model type discriminator

cmd

cmd() -> str

Command file string for this subcomponent.

check_for_typos classmethod

check_for_typos(data: Any) -> Any

Suggest the closest field name for an unknown input key.

A field can be given by its name or, like in pydantic, by its alias.

dump_inputs_dict

dump_inputs_dict() -> dict

Return the original inputs as a dictionary.

dump_inputs_json

dump_inputs_json() -> str

Return the original inputs as a JSON string.

render

render() -> str

Render the sub-component to a string.