seapopym.function.compiled_functions package
Submodules
seapopym.function.compiled_functions.biomass_compiled_functions module
This module contains the compiled (JIT) functions used by the biomass generator.
- seapopym.function.compiled_functions.biomass_compiled_functions.biomass_sequence(recruited: ndarray, mortality: ndarray, initial_conditions: ndarray | None) ndarray
Compute the biomass of the recruited individuals.
- Formula :
B(t) = R(t) + (M(t) * B(t-1))
Parameters
- recruitednp.ndarray
The number of recruited individuals. Minimum dims : (F, T, <Y, X, …>). Type : np.float64
- mortalitynp.ndarray
The mortality rate of the recruited individuals. Minimum dims : (F, T, <Y, X, …>). Type : np.float64
- initial_conditionsnp.ndarray
The initial biomass. Minimum dims : (F, <Y, X, …>). Type : np.float64 If None, the initial biomass is set to np.zeros(recruited[:, 0, …].shape).
Warning
Be sure to use floats for the input arrays.
seapopym.function.compiled_functions.production_compiled_functions module
This module contains the compiled (JIT) functions used by the production generator.
- seapopym.function.compiled_functions.production_compiled_functions.ageing(production: ndarray, nb_timestep_by_cohort: ndarray) ndarray
Age the production by rolling over part of it to the next age. The proportion of production moved to the next age cohort is defined by the inverse of the number of time steps per cohort.
Parameters
- productionnp.ndarray
The production to age.
- nb_timestep_by_cohortnp.ndarray
The number of timestep by cohort.
Returns
- aged_productionnp.ndarray
The aged production.
- seapopym.function.compiled_functions.production_compiled_functions.expand_dims(data: ndarray, dim_len: int) ndarray
Add a new dimension to the DataArray and fill it with O.
Parameters
- datanp.ndarray
The data to expand.
- dim_lenint
The length of the new dimension.
Returns
- expanded_datanp.ndarray
The expanded data.
- seapopym.function.compiled_functions.production_compiled_functions.production(primary_production: ndarray, mask_temperature: ndarray, timestep_number: ndarray, initial_production: ndarray | None = None) ndarray
Simply compute the production, can use initial conditions.
- seapopym.function.compiled_functions.production_compiled_functions.production_export_initial(primary_production: ndarray, mask_temperature: ndarray, timestep_number: ndarray, initial_production: ndarray | None = None) tuple[ndarray, ndarray]
Compute the production but also the last timestep of the unrecruited production (pre-production) field.
Useful for initial conditions.
- seapopym.function.compiled_functions.production_compiled_functions.production_export_preproduction(primary_production: ndarray, mask_temperature: ndarray, timestep_number: ndarray, initial_production: ndarray | None = None) tuple[ndarray, ndarray]
Compute the production but also the unrecruited production (pre-production) field for each timestep.
- seapopym.function.compiled_functions.production_compiled_functions.time_loop(primary_production: ndarray, mask_temperature: ndarray, timestep_number: ndarray, initial_production: ndarray | None = None, export_preproduction: ndarray | None = None) tuple[ndarray, ndarray | None]
The processes done during the time range.
Parameters
- primary_productionnp.ndarray
The primary production. Dims : [T, X, Y].
- mask_temperaturenp.ndarray
The temperature mask. Dims : [T, X, Y, Cohort].
- timestep_numbernp.ndarray
The number of timestep. Dims : [Cohort]
- initial_productionnp.ndarray | None
The initial production. Dims : [X, Y, Cohort] If None is given then initial_production is set to np.zeros((T.size, Y.size, X.size)).
- export_preproductionnp.ndarray | None
An array containing the time-index (i.e. timestamps) to export the pre-production. If None, the pre-production is not exported.
Returns
- output_recruitednp.ndarray
The recruited production. Dims : [T, X, Y, Cohort]
- output_preproductionnp.ndarray
The pre-production if export_preproduction is True, None otherwise. Dims : [T, X, Y, Cohort]
Warning:
Be sure to transform nan values into 0.
The dimensions order of the input arrays must be [Time, Latitude, Longitude, Cohort].