Configuration

Pydantic models that parse and validate gotm.yaml configuration files. Every GOTM 6.0.7 test case YAML is accepted directly.

Runtime configuration modules.

class pygotm.config.FABMConf(chunk_size=None)[source]

Bases: object

Parameters:

chunk_size (int | None)

chunk_size: int | None = None
class pygotm.config.PyGotmConf(fabm=<factory>)[source]

Bases: object

Parameters:

fabm (FABMConf)

fabm: FABMConf
pygotm.config.load_pygotm_conf(yaml_path)[source]

Load pygotm-conf.yaml from the same directory as gotm.yaml.

Returns default PyGotmConf if the file does not exist. If the file exists but has no ‘fabm’ key, fabm defaults apply.

Return type:

PyGotmConf

Parameters:

yaml_path (Path)

class pygotm.config.ExtPressureSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: str
dpdx: ScalarTidalSettings
dpdy: ScalarTidalSettings
h: InputSetting
period_1: float
period_2: float
class pygotm.config.GotmConfig(settings, document, source_path=None)[source]

Bases: object

A GOTM YAML document plus a typed view and source-location metadata.

Parameters:
classmethod from_path(path)[source]

Load a GOTM YAML document from path.

Return type:

GotmConfig

Parameters:

path (str | Path)

classmethod from_settings(settings, *, source_path=None, document=None)[source]

Construct a config wrapper from an in-memory settings object.

Return type:

GotmConfig

Parameters:
materialize_document()[source]

Return the saved YAML document with typed settings merged back in.

Return type:

dict[str, Any]

resolved_document()[source]

Return a document copy with relative file entries resolved.

Return type:

dict[str, Any]

resolved_settings()[source]

Return a settings model with relative input paths resolved.

Return type:

GotmSettings

save(path)[source]

Write the current configuration document to path.

Return type:

None

Parameters:

path (str | Path)

property source_dir: Path | None

Directory containing the source YAML document, if known.

source_path: Path | None = None
settings: GotmSettings
document: dict[str, Any]
class pygotm.config.GotmSettings(**data)[source]

Bases: _SettingsModel

Top-level GOTM YAML settings used by Phase 5 and 6 modules.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

version: int
title: str
location: LocationSettings
time: TimeSettings
grid: GridSettings
temperature: TemperatureSettings
salinity: SalinitySettings
light_extinction: LightExtinctionSettings
mimic_3d: Mimic3DSettings
velocities: VelocitySettings
w: VerticalVelocitySettings
waves: WaveSettings
turbulence: ObservationTurbulenceSettings
surface: dict[str, Any]
bottom: dict[str, Any]
restart: dict[str, Any]
output: dict[str, Any]
equation_of_state: dict[str, Any]
class pygotm.config.GradientCollectionSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

dtdx: InputSetting
dtdy: InputSetting
dsdx: InputSetting
dsdy: InputSetting
class pygotm.config.GridSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

nlev: int
method: str
ddu: float
ddl: float
file: str
class pygotm.config.InputSetting(**data)[source]

Bases: _SettingsModel

Configuration for a scalar or profile input in GOTM YAML.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
property add_offset: float

Offset applied to values read from file.

model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

property path: str

Path to the external data file, if any.

method: str
constant_value: float
file: str
column: int
scale_factor: float
offset: float
class pygotm.config.IntPressureSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: str
gradients: GradientCollectionSettings
plume: PlumeSettings
t_adv: bool
s_adv: bool
class pygotm.config.LightExtinctionSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

method: str
A: InputSetting
g1: InputSetting
g2: InputSetting
class pygotm.config.LocationSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
latitude: float
longitude: float
depth: float
class pygotm.config.Mimic3DSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

ext_pressure: ExtPressureSettings
int_pressure: IntPressureSettings
zeta: ScalarTidalSettings
w: VerticalVelocitySettings
class pygotm.config.ObservationTurbulenceSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

epsprof (InputSetting)

model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

epsprof: InputSetting
class pygotm.config.PlumeSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: str
x_slope: float
y_slope: float
class pygotm.config.ProfileRelaxationSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tau: float
h_s: float
tau_s: float
h_b: float
tau_b: float
class pygotm.config.SalinitySettings(**data)[source]

Bases: InputSetting

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

method: str
type: str
two_layer: SalinityTwoLayerSettings
NN: float
relax: ProfileRelaxationSettings
class pygotm.config.ScalarTidalSettings(**data)[source]

Bases: InputSetting

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

method: str
tidal: TidalConstituentSettings
period_1: float
period_2: float
class pygotm.config.TemperatureSettings(**data)[source]

Bases: InputSetting

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

method: str
type: str
two_layer: TemperatureTwoLayerSettings
NN: float
relax: ProfileRelaxationSettings
class pygotm.config.TidalConstituentSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

period_1: float
amp_1: float
phase_1: float
period_2: float
amp_2: float
phase_2: float
class pygotm.config.TimeSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

method: int
start: str
stop: str
dt: float
cnpar: float
max_steps: int
class pygotm.config.VelocitySettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

u: InputSetting
v: InputSetting
relax: VelocityRelaxationSettings
class pygotm.config.VerticalVelocitySettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

max: InputSetting
height: InputSetting
adv_discr: str
class pygotm.config.WaveSettings(**data)[source]

Bases: _SettingsModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Hs: InputSetting
Tz: InputSetting
phiw: InputSetting
pygotm.config.coerce_config(config)[source]

Normalise config-like inputs into GotmConfig.

Return type:

GotmConfig

Parameters:

config (GotmConfig | GotmSettings | str | Path)

pygotm.config.load_config(path)[source]

Load a GotmConfig from path.

Return type:

GotmConfig

Parameters:

path (str | Path)

pygotm.config.load_settings(path)[source]

Load GOTM YAML settings from path.

Return type:

GotmSettings

Parameters:

path (str | Path)

pygotm.config.save_config(config, path)[source]

Write a configuration document or settings model to path.

Return type:

None

Parameters:
pygotm.config.save_settings(settings, path, *, detail=1)[source]

Write a normalised YAML representation of settings to path.

Return type:

None

Parameters: