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, environment: EnvironmentParameter | None = None, kernel: KernelParameter = NOTHING)
Bases:
AbstractConfigurationConfiguration for the NoTransportModel.
Method generated by attrs for class NoTransportConfiguration.
- environment: EnvironmentParameter | None
- 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
A module to manage the environment parameters of the simulation.
- class seapopym.configuration.no_transport.environment_parameter.ChunkParameter(functional_group: Literal['auto'] | int | None = 1, latitude: Literal['auto'] | int | None = None, longitude: Literal['auto'] | int | None = None)
Bases:
AbstractChunkParameterThe chunk size of the different dimensions.
Method generated by attrs for class ChunkParameter.
- as_dict() dict
Format to a dictionary as expected by xarray.
- functional_group: Literal['auto'] | int | None
- latitude: Literal['auto'] | int | None
- longitude: Literal['auto'] | int | None
- time: Literal[-1]
- class seapopym.configuration.no_transport.environment_parameter.EnvironmentParameter(*, chunk: ChunkParameter = NOTHING)
Bases:
AbstractEnvironmentParameterManage the different environment parameters of the simulation.
Method generated by attrs for class EnvironmentParameter.
- chunk: ChunkParameter
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.ForcingParameter(*, temperature: ForcingUnit, primary_production: ForcingUnit, initial_condition_production: ForcingUnit | None = None, initial_condition_biomass: ForcingUnit | None = None)
Bases:
AbstractForcingParameterThis 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.
- initial_condition_biomass: ForcingUnit | None
- initial_condition_production: ForcingUnit | None
- 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:
AbstractForcingUnitThis 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.
- 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.forcing_parameter.verify_init(value: ForcingUnit, unit: str | Unit, parameter_name: str) ForcingUnit
This function is used to check if the unit of a parameter is correct. It raises a DimensionalityError if the unit is not correct.
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:
AbstractFunctionalGroupParameterThis 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
Return all the functional groups as a xarray.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:
AbstractFunctionalGroupUnitRepresent 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: ParameterUnit
- 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: int) ndarray[int]
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:
AbstractFunctionalTypeParameterThis 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: ParameterUnit
- gamma_tr: ParameterUnit
- lambda_temperature_0: ParameterUnit
- tr_0: ParameterUnit
- class seapopym.configuration.no_transport.functional_group_parameter.MigratoryTypeParameter(*, day_layer, night_layer)
Bases:
AbstractMigratoryTypeParameterThis 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.functional_group_parameter.verify_init(value: Number, unit: str | pint.Unit, parameter_name: str) ParameterUnit
This function is used to check if the value of a parameter is correct. It raises a ValueError if the value is not correct.
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:
AbstractKernelParameterThis 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.