rompy.swan.subcomponents.spectrum.SPECTRUM#

pydantic model rompy.swan.subcomponents.spectrum.SPECTRUM[source]#

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

In [120]: from rompy.swan.subcomponents.spectrum import SPECTRUM

In [121]: spec = SPECTRUM(mdc=36, flow=0.04, fhigh=1.0)

In [122]: print(spec.render())
CIRCLE mdc=36 flow=0.04 fhigh=1.0

In [123]: spec = SPECTRUM(mdc=36, dir1=0, dir2=180, flow=0.04, msc=31)

In [124]: print(spec.render())
SECTOR 0.0 180.0 mdc=36 flow=0.04 msc=31
Fields:
Validators:
field dir1: float | None = None#

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

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

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

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

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

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

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

Validated by:
field mdc: int [Required]#

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.

Validated by:
field model_type: Literal['spectrum', 'SPECTRUM'] = 'spectrum'#

Model type discriminator

Validated by:
field msc: int | None = 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

Constraints:
  • ge = 3

Validated by:
validator check_direction_definition  »  all fields[source]#

Check that dir1 and dir2 are specified together.

validator check_frequency_definition  »  all fields[source]#

Check spectral frequencies are prescribed correctly.

cmd() str[source]#
property dir_sector#