pygetm.fabm module

class pygetm.fabm.FABM(path: PathLike[str] | str | Mapping[str, Any] = 'fabm.yaml', repair: bool = True, bioshade_feedback: bool = False, libname: str = '/home/docs/checkouts/readthedocs.org/user_builds/pygetm/conda/latest/lib/python3.14/site-packages/pygetm/fabm', time_varying: TimeVarying = TimeVarying.MACRO, squeeze: bool = False)[source]

Bases: object

Interface to the Framework for Aquatic Biogeochemical Models (FABM).

Initialize FABM interface.

Parameters:
  • path – Path to FABM configuration file, in YAML format, or a mapping representing the parsed content of such a file.

  • repair – Whether to attempt to repair invalid FABM state values by clipping them to valid ranges.

  • bioshade_feedback – Whether to obtain the attenuation coefficient for photosynthetic active radiation from FABM. This will be available as attribute kc. It can be used to contribute to light absorption, e.g., by providing it as argument kc2_add to pygetm.radiation.TwoBand. There it in turn affects the heat distribution in the water column.

  • libname – Path to FABM shared library, excluding any platform-specific prefix/suffix

  • time_varying – Model step at which FABM variables will be updated. FABM arrays will be flagged with this attribute to tell the output manager when they are updated.

  • squeeze – Whether FABM’s internal representation of arrays has all singleton dimensions (with length 1) squeezed out.

add_vertical_movement_to_sources()[source]
advance(timestep: float)[source]

Time-integrate source terms of all state variables (3D pelagic tracers as well as bottom- and surface-attached variables).

Parameters:

timestep – time step (s)

property default_outputs: Iterable[Array]
get_dependency(name: str, array: Array | None = None) Array[source]

Retrieve the array that will hold values for the specified FABM dependency. This array can subsequently be assigned a value or be linked to a time/space-varying input with pygetm.core.Array.set().

Parameters:

name – name of the dependency

has_dependency(name: str) bool[source]
initialize(grid: Grid, tracer_collection: TracerCollection, tracer_totals: list[TracerTotal], logger: Logger)[source]
start(timestep: float, time: datetime | None = None)[source]

Prepare FABM. This includes flagging which diagnostics need saving based on the output manager configuration, offering fields registered with the field manager to FABM if they have a standard name assigned, and subsequently verifying whether FABM has all its dependencies fulfilled.

property state_variables: Iterable[Array]
update_sources(seconds_passed: float, time: datetime | None = None)[source]

Update sources, vertical velocities, and diagnostics. This does not update the state variables themselves; that is done by advance()

update_totals()[source]

Ensure sums of conserved quantities are up to date.