Skip to content

Spectra

Frequency definitions for spectral wave models.

logger module-attribute

logger = logging.getLogger(__name__)

Frequency pydantic-model

Frequency(**data: Any)

Bases: RompyBaseModel

Wave frequency.

Fields:

model_type pydantic-field

model_type: Literal['frequency', 'FREQUENCY'] = 'frequency'

Model type discriminator

freq pydantic-field

freq: list[float]

Frequency array

f0 property

f0

f1 property

f1

nf property

nf

flen property

flen

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.

LogFrequency pydantic-model

LogFrequency(**data: Any)

Bases: RompyBaseModel

Logarithmic wave frequencies.

Frequencies are defined according to f(i+1) = γ · f(i).

Note

The number of frequency bins nbin is always kept unchanged when provided. This implies other parameters may be adjusted so nbin bins can be defined. Specify f0, f1 and finc and let nbin be calculated to avoid those values changing.

Note

Choose finc=0.1 for a 10% increment between frequencies that satisfies the DIA.

Examples:

from rompy.core.spectrum import LogFrequency

print(LogFrequency(f0=0.04, f1=1.0, nbin=34))
print(LogFrequency(f0=0.04, f1=1.0, finc=0.1))
print(LogFrequency(f0=0.04, nbin=34, finc=0.1))
print(LogFrequency(f1=1.0, nbin=34, finc=0.1))
LogFrequency:
  model_type: log
  f0: 0.04
  f1: 1.0
  finc: 0.0992991258103799
  nbin: 34
LogFrequency:
  model_type: log
  f0: 0.04
  f1: 1.0
  finc: 0.0992991258103799
  nbin: 34
LogFrequency:
  model_type: log
  f0: 0.04
  f1: 1.0219067944750664
  finc: 0.1000000000000006
  nbin: 34
LogFrequency:
  model_type: log
  f0: 0.03914251301220403
  f1: 1.0
  finc: 0.10000000000000035
  nbin: 34

Fields:

Validators:

model_type pydantic-field

model_type: Literal['log', 'LOG'] = 'log'

Model type discriminator

f0 pydantic-field

f0: Optional[float] = None

Lower frequency boundary (Hz)

f1 pydantic-field

f1: Optional[float] = None

Upper frequency boundary (Hz)

finc pydantic-field

finc: Optional[float] = None

Log frequency increment

nbin pydantic-field

nbin: Optional[int] = None

Number of frequency bins, one less the size of frequency array

nf property

nf

gamma property

gamma

flen property

flen

init_options pydantic-validator

init_options() -> LogFrequency

Set the missing frequency parameters.

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.