seapopym.standard package

Submodules

seapopym.standard.attributs module

Store all default attributs for the seapopym xarray.DataArray.

seapopym.standard.attributs.apply_coefficient_to_primary_production_desc = {'description': 'Primary production by functional group according to their energy transfert coefficient.', 'long_name': 'primary production by functional group', 'standard_name': 'primary production', 'units': 'kilogram / day / meter ** 2'}

dict: Apply coefficient to primary production attributs.

seapopym.standard.attributs.compute_cell_area_desc = {'description': 'Cell area computed from the latitude and longitude centroid.', 'long_name': 'cell area', 'standard_name': 'cell_area', 'units': 'meter ** 2'}

dict: Compute cell area attributs.

seapopym.standard.attributs.functional_group_desc(f_group_coord_data: Iterable, groups_name: list[str]) dict

Functional group attributs. Standard name is used as an accessor by cf_xarray.

seapopym.standard.attributs.global_mask_desc = {'flag_meanings': '0:land, 1:ocean', 'flag_values': '[0, 1]', 'long_name': 'mask', 'standard_name': 'mask'}

dict: Global mask attributs.

seapopym.standard.attributs.mask_by_fgroup_desc = {'flag_meanings': '0:land, 1:ocean', 'flag_values': '[0, 1]', 'long_name': 'mask', 'standard_name': 'mask'}

dict: Mask by fgroup attributs.

seapopym.standard.attributs.mask_temperature_desc = {'description': 'Mask to recruit a cohort according to the temperature.', 'flag_meanings': '0:not recruited, 1:recruited', 'flag_values': '[0, 1]', 'long_name': 'cohort recruitment mask by functional group', 'standard_name': 'mask'}

dict: Mask temperature attributs.

seapopym.standard.attributs.min_temperature_by_cohort_desc = {'description': 'Minimum temperature to recruit a cohort according to its age.', 'long_name': 'minimum temperature by cohort', 'standard_name': 'minimum temperature', 'units': 'degree_Celsius'}

dict: Minimum temperature by cohort attributs.

seapopym.standard.attributs.mortality_field_desc = {'description': 'Mortality coefficient according to the temperature.', 'long_name': 'mortality coefficient', 'standard_name': 'mortality'}

dict: Mortality field attributs.

seapopym.standard.coordinates module

Defines the structure of the coordinates of the data.

seapopym.standard.coordinates.list_available_dims(data: Dataset | DataArray) list[str]

Return the standard name of all available coordinates in the data.

seapopym.standard.coordinates.new_cohort(cohort_data: Iterable) DataArray

Create a new cohort coordinate.

seapopym.standard.coordinates.new_latitude(latitude_data: np.ndarray) xr.DataArray

Create a new latitude coordinate.

seapopym.standard.coordinates.new_layer(layer_data: Iterable | None = None) DataArray

Create a new layer coordinate.

seapopym.standard.coordinates.new_longitude(longitude_data: Iterable) DataArray

Create a new longitude coordinate.

seapopym.standard.coordinates.new_time(time_data: Iterable) DataArray

Create a new time coordinate.

seapopym.standard.coordinates.reorder_dims(data: Dataset | DataArray) Dataset | DataArray

Follow the standard order of dimensions for a xarray.Dataset or xarray.DataArray.

seapopym.standard.labels module

Store all labels used in the No Transport model.

class seapopym.standard.labels.ConfigurationLabels(*values)

Bases: StrEnum

A single place to store all labels as declared in parameters module.

angle_horizon_sun = 'angle_horizon_sun'
cohort = 'cohort'
compute_initial_conditions = 'compute_initial_conditions'
compute_preproduction = 'compute_preproduction'
day_layer = 'day_layer'
energy_transfert = 'energy_transfert'
fgroup_name = 'name'
gamma_lambda_acidity = 'gamma_lambda_acidity'
gamma_lambda_temperature = 'gamma_lambda_temperature'
gamma_tr = 'gamma_tr'
initial_condition_biomass = 'initial_condition_biomass'
initial_condition_production = 'initial_condition_production'
lambda_acidity_0 = 'lambda_acidity_0'
lambda_temperature_0 = 'lambda_temperature_0'
max_timestep = 'max_timestep'
mean_timestep = 'mean_timestep'
min_timestep = 'min_timestep'
night_layer = 'night_layer'
resolution_latitude = 'resolution_latitude'
resolution_longitude = 'resolution_longitude'
timestep = 'timestep'
timesteps_number = 'timesteps_number'
tr_0 = 'tr_0'
class seapopym.standard.labels.CoordinatesLabels(*values)

Bases: StrEnum

A single place to store all labels as declared in coordinates module. It follow the cf_xarray convention.

X = 'X'
Y = 'Y'
Z = 'Z'
cohort = 'cohort'
functional_group = 'functional_group'
classmethod order_data(data: xr.Dataset | xr.DataArray) xr.Dataset

Return the dataset with the coordinates ordered as in the CF convention.

classmethod ordered() tuple[CoordinatesLabels]

Return all labels in the order they should be used in a dataset. It follow the CF convention.

time = 'T'
class seapopym.standard.labels.ForcingLabels(*values)

Bases: StrEnum

A single place to store all labels as declared in forcing module.

acidity = 'acidity'
avg_acidity_by_fgroup = 'average_acidity'
avg_temperature_by_fgroup = 'average_temperature'
biomass = 'biomass'
cell_area = 'cell_area'
day_length = 'day_length'
global_mask = 'mask'
mask_by_fgroup = 'mask_fgroup'
mask_temperature = 'mask_temperature'
min_temperature = 'min_temperature'
mortality_field = 'mortality_field'
preproduction = 'preproduction'
primary_production = 'primary_production'
primary_production_by_fgroup = 'primary_production_by_fgroup'
recruited = 'recruited'
temperature = 'temperature'
class seapopym.standard.labels.SeaLayers(*values)

Bases: Enum

Enumerate the sea layers.

EPI = ('epipelagic', 1)
LOWMESO = ('lower-mesopelagic', 3)
UPMESO = ('upper-mesopelagic', 2)
property depth: Literal[1, 2, 3]

Return the depth of the sea layer.

property standard_name: Literal['epipelagic', 'upper-mesopelagic', 'lower-mesopelagic']

Return the standard_name of the sea layer.

seapopym.standard.types module

Defines type aliases for Seapopym standard types.

seapopym.standard.types.ForcingAttrs

ForcingAttrs is the attributes of the forcing used as xarray.DataArray.attrs in the SeapopymState.

alias of dict[str, object]

seapopym.standard.types.ForcingName: TypeAlias = seapopym.standard.labels.ConfigurationLabels | seapopym.standard.labels.ForcingLabels | str

ForcingName is the name of the forcing used as key in the SeapopymState.

seapopym.standard.types.SeapopymDims: TypeAlias = seapopym.standard.labels.CoordinatesLabels | str

SeapopymDims is the name of the dimensions used in the SeapopymState.

seapopym.standard.types.SeapopymForcing

SeapopymForcing is the forcing used as a xarray.DataArray in the SeapopymState.

seapopym.standard.types.SeapopymState

SeapopymState is the model state that stores all forcings (IN/OUT) and parameters.

seapopym.standard.units module

A module for handling units in the forcing data following the CF conventions.

class seapopym.standard.units.StandardUnitsLabels(*values)

Bases: StrEnum

Unit of measurement as used in the model.

Prevent the instantiation of this class.

acidity = 'dimensionless'
biomass = 'kilogram / meter**2'
height = 'meter'
production = 'kilogram / meter**2 / day'
temperature = 'celsius'
time = 'day'
property units: Unit

Convert the string unit to the equivalent pint unit.

weight = 'kilogram'

Module contents