seapopym.configuration.no_transport package

Submodules

seapopym.configuration.no_transport.configuration module

This module contains the configuration of the model as a xarray.Dataset. It allows to store the model parameters and the forcings (lazily).

class seapopym.configuration.no_transport.configuration.NoTransportConfiguration(*, forcing: ForcingParameter, functional_group: FunctionalGroupParameter, kernel: KernelParameter = NOTHING)

Bases: object

Configuration for the NoTransportModel.

Method generated by attrs for class NoTransportConfiguration.

forcing: ForcingParameter
functional_group: FunctionalGroupParameter
kernel: KernelParameter
classmethod parse(configuration_file: str | Path | IO) NoTransportConfiguration

Parse the configuration file and create a NoTransportConfiguration object.

property state: SeapopymState

The xarray.Dataset that stores the state of the model. Data is sent to worker if chunked.

seapopym.configuration.no_transport.environment_parameter module

seapopym.configuration.no_transport.forcing_parameter module

Define the ForcingUnit data class used to store access paths to a forcing field.

class seapopym.configuration.no_transport.forcing_parameter.ChunkParameter(functional_group: Literal['auto'] | int | None = 1, Y: Literal['auto'] | int | None = None, X: Literal['auto'] | int | None = None)

Bases: object

The chunk size of the different dimensions.

Method generated by attrs for class ChunkParameter.

T: Literal[-1]
X: Literal['auto'] | int | None
Y: Literal['auto'] | int | None
as_dict() dict

Format to a dictionary as expected by xarray with standardized coordinates.

functional_group: Literal['auto'] | int | None
class seapopym.configuration.no_transport.forcing_parameter.ForcingParameter(*, temperature, primary_production, initial_condition_production=None, initial_condition_biomass=None, parallel: bool = False, chunk: ChunkParameter = NOTHING)

Bases: object

This data class is used to store access paths to forcing fields. You can inherit it to add further forcings, but in this case you’ll need to add new behaviors to the functions and classes that follow.

Method generated by attrs for class ForcingParameter.

property all_forcings: dict[str, ForcingUnit]

Return all the not null ForcingUnit as a dictionary.

chunk: ChunkParameter
initial_condition_biomass: ForcingUnit | None
initial_condition_production: ForcingUnit | None
parallel: bool
primary_production: ForcingUnit
temperature: ForcingUnit
to_dataset() Dataset

An xarray.Dataset containing all the forcing fields used to construct the SeapoPymState.

class seapopym.configuration.no_transport.forcing_parameter.ForcingUnit(*, forcing: Any)

Bases: object

This data class is used to store a forcing field.

Parameters

forcing: xr.DataArray

Forcing field.

Notes

  • This class is used to store a forcing field.

  • Be sure to follow the CF conventions for the forcing file. To do so you can use the cf_xarray package.

Method generated by attrs for class ForcingUnit.

convert(units: str | Unit) ForcingUnit

Create a new ForcingUnit with the same forcing field but with a different unit.

Parameters.

units: str | Unit

The unit to convert the forcing field to. If a string is provided, it will be converted to a Pint Unit. If a Pint Unit is provided, it will be used as is.

forcing: DataArray
classmethod from_dataset(forcing: Dataset, name: str) ForcingUnit

Create a ForcingUnit from a path and a name with standardized coordinate names.

classmethod from_path(forcing: Path | str, name: str, engine: Literal['zarr', 'netcdf'] = 'zarr', *args: ParamSpecArgs, **kwargs: ParamSpecKwargs) ForcingUnit

Create a ForcingUnit from a path and a name.

seapopym.configuration.no_transport.forcing_parameter.path_validation(path: str | Path) str | Path

Check if the path exists.

seapopym.configuration.no_transport.functional_group_parameter module

This module define the data classes used to store the parameters of a functional group in the no transport model.

class seapopym.configuration.no_transport.functional_group_parameter.FunctionalGroupParameter(*, functional_group: list[FunctionalGroupUnit])

Bases: object

This data class is used to store the parameters of all functional groups.

Method generated by attrs for class FunctionalGroupParameter.

are_all_instance_of_functional_group_unit(attribute: str, value: list[FunctionalGroupUnit]) None

This method is used to check the consistency of the functional groups.

functional_group: list[FunctionalGroupUnit]
to_dataset(timestep: int) Dataset
class seapopym.configuration.no_transport.functional_group_parameter.FunctionalGroupUnit(*, name: str, energy_transfert: Number, functional_type: FunctionalTypeParameter, migratory_type: MigratoryTypeParameter, cohort_timestep: list[int] | None = None)

Bases: object

Represent a functional group.

Method generated by attrs for class FunctionalGroupUnit.

age_to_dataset(timestep: int) Dataset

Computes the mean, minimum, and maximum age of the cohorts at each timestep. The last cohort is always one timestep long and has an age equal to tr_0, which represents the maximum age of the pre-production in the coldest water conditions.

check_cohort_timestep(attribute: str, value: list[int]) None

Check that the last cohort is equal to 1.

cohort_timestep: list[int] | None
energy_transfert: Quantity
functional_type: FunctionalTypeParameter
migratory_type: MigratoryTypeParameter
name: str
parameter_to_dataset: Dataset
to_dataset(timestep: int) Dataset

This method is used to create the dataset of the functional group. It contains the parameters of the functional group and the age of the cohorts.

update_cohort_timestep(timestep: Quantity) ndarray[Quantity]

This method updates the cohorts timesteps. The last cohort is always one timestep long and has an age equal to tr_0, which represents the maximum age of the pre-production in the coldest water conditions.

class seapopym.configuration.no_transport.functional_group_parameter.FunctionalTypeParameter(*, lambda_temperature_0: Number, gamma_lambda_temperature: Number, tr_0: Number, gamma_tr: Number)

Bases: object

This data class is used to store the parameters linked to the relation between temperature and functional group.

Method generated by attrs for class FunctionalTypeParameter.

gamma_lambda_temperature: Quantity
gamma_tr: Quantity
lambda_temperature_0: Quantity
tr_0: Quantity
class seapopym.configuration.no_transport.functional_group_parameter.MigratoryTypeParameter(*, day_layer, night_layer)

Bases: object

This data class is used to store the parameters liked to the migratory behavior of a single functional group.

Method generated by attrs for class MigratoryTypeParameter.

day_layer: int
night_layer: int

seapopym.configuration.no_transport.kernel_parameter module

This module defines the kernel parameters which are used to modify behaviour of kernel functions. These meta-parameters are integrated in the model state and used in kernel functions.

class seapopym.configuration.no_transport.kernel_parameter.KernelParameter(*, angle_horizon_sun: Number = 0.0, compute_initial_conditions: bool = False, compute_preproduction: bool = False)

Bases: object

This data class is used to store the parameters of the kernel.

Method generated by attrs for class KernelParameter.

angle_horizon_sun: Number
compute_initial_conditions: bool
compute_preproduction: bool
to_dataset() Dataset

Convert the kernel parameters to a dictionary.

Module contents