API documentation for the abiotic_model module#
The abiotic_model module creates a
AbioticModel
class as a child of the BaseModel class.
This implements the full complexity abiotic model.
The AbioticModel class#
- class virtual_ecosystem.models.abiotic.abiotic_model.AbioticModel(data: Data, latitude: float, core_components: CoreComponents, model_constants: AbioticConstants = AbioticConstants(), pyrealm_core_constants: CoreConst = PyrealmCoreConst(), bounds: AbioticSimpleBounds = AbioticSimpleBounds(), static: bool = False)[source]#
A class describing the abiotic model.
- Parameters:
data – The data object to be used in the model.
latitude – Mean latitude of the study grid
core_components – The core components used across models.
model_constants – Set of constants for the abiotic model.
pyrealm_core_constants – Additional configuration options to the pyrealm package.
bounds – A set of bounds to be applied to abiotic variables.
static – Boolean flag indicating if the model should run in static mode.
Attributes:
A set of bounds on microclimates variables, used with both the simple model of the initial state and the full energy balance calculations.
The core constants used in the model.
A Data instance providing access to the shared simulation data.
The Grid details used in the model.
Latitude in degrees.
The LayerStructure details used in the model.
Set of constants for the abiotic model.
The ModelTiming details used in the model.
Bounds on model update frequencies.
Pyrealm core constants.
Variables that are initialised by the model during the first update.
Variables that are initialised by the model during the setup.
Required variables for model initialisation.
Variables that are required by the update method of the model.
Variables that are updated by the model.
Methods:
Check the init data contains the required variables.
cleanup()Placeholder function for abiotic model cleanup.
from_config(data, configuration, core_components)Factory function to initialise the abiotic model from configuration.
spinup()Placeholder function to spin up the abiotic model.
update(time_index, **kwargs)Function to update the model.
- bounds: AbioticSimpleBounds#
A set of bounds on microclimates variables, used with both the simple model of the initial state and the full energy balance calculations.
- check_init_data() None#
Check the init data contains the required variables.
This method is used to check that the set of variables defined in the
vars_required_for_initclass attribute are present in theDatainstance used to create a new instance of the class.- Raises:
ValueError – If the Data instance does not contain all the required variables or if those variables do not map onto the required axes.
- core_constants: CoreConstants#
The core constants used in the model.
- classmethod from_config(data: Data, configuration: CompiledConfiguration, core_components: CoreComponents) AbioticModel[source]#
Factory function to initialise the abiotic model from configuration.
This function unpacks the relevant information from the configuration file, and then uses it to initialise the model. If any information from the config is invalid rather than returning an initialised model instance an error is raised.
- Parameters:
data – A
Datainstance.configuration – A validated Virtual Ecosystem model configuration object.
core_components – The core components used across models.
- layer_structure: LayerStructure#
The LayerStructure details used in the model.
- model_constants: AbioticConstants#
Set of constants for the abiotic model.
- model_timing: ModelTiming#
The ModelTiming details used in the model.
- model_update_bounds: tuple[Quantity, Quantity] = (<Quantity(1, 'hour')>, <Quantity(1, 'month')>)#
Bounds on model update frequencies.
This class attribute defines two time intervals that define a lower and upper bound on the update frequency that can reasonably be used with a model. Models updated more often than the lower bound may fail to capture transient dynamics and models updated more slowly than the upper bound may fail to capture important temporal patterns.
- pyrealm_core_constants: PyrealmCoreConst#
Pyrealm core constants.
- update(time_index: int, **kwargs: Any) None#
Function to update the model.
If the model is static, the inner update method, self._update will only run once, at most.
- Parameters:
time_index – The index representing the current time step in the data object.
**kwargs – Further arguments to the update method.
- vars_populated_by_first_update: tuple[str, ...] = ()#
Variables that are initialised by the model during the first update.
These are the variables that are initialised by the model and stored in the data object when running the update method for the first time. They will be available for other models to use in their update methods but not in the setup methods.
- vars_populated_by_init: tuple[str, ...] = ('soil_temperature', 'vapour_pressure_ref', 'vapour_pressure_deficit_ref', 'air_temperature', 'relative_humidity', 'vapour_pressure_deficit', 'wind_speed', 'atmospheric_pressure', 'atmospheric_co2', 'canopy_temperature', 'sensible_heat_flux', 'latent_heat_flux', 'ground_heat_flux', 'net_radiation', 'longwave_emission', 'vapour_pressure', 'diurnal_temperature_range')#
Variables that are initialised by the model during the setup.
These are the variables that are initialised by the model and stored in the data object when running the setup method and that will be available for other models to use in their own setup or update methods.
- vars_required_for_init: tuple[str, ...] = ('air_temperature_ref', 'atmospheric_co2_ref', 'atmospheric_pressure_ref', 'layer_heights', 'leaf_area_index', 'mean_annual_temperature', 'relative_humidity_ref', 'shortwave_absorption', 'wind_speed_ref', 'downward_longwave_radiation', 'aerodynamic_resistance_canopy', 'specific_heat_air', 'latent_heat_vapourisation', 'density_air', 'condensation')#
Required variables for model initialisation.
This class property defines a set of variable names that must be present in the
Datainstance used to initialise an instance of this class. It is a tuple containing zero or more tuples, each providing a variable name and then a tuple of zero or more core axes that the variable must map onto.For example:
(('temperature', ('spatial', 'temporal')),)
- vars_required_for_update: tuple[str, ...] = ('air_temperature_ref', 'relative_humidity_ref', 'vapour_pressure_deficit_ref', 'atmospheric_pressure_ref', 'atmospheric_co2_ref', 'wind_speed_ref', 'leaf_area_index', 'layer_heights', 'downward_shortwave_radiation', 'stomatal_conductance', 'shortwave_absorption', 'downward_longwave_radiation', 'aerodynamic_resistance_soil', 'soil_evaporation', 'canopy_evaporation', 'transpiration', 'condensation')#
Variables that are required by the update method of the model.
These variables should have been initialised by another model or loaded from external sources, but in either case they will be available in the data object.
- vars_updated: tuple[str, ...] = ('air_temperature', 'canopy_temperature', 'soil_temperature', 'vapour_pressure', 'vapour_pressure_deficit', 'relative_humidity', 'wind_speed', 'sensible_heat_flux', 'latent_heat_flux', 'ground_heat_flux', 'density_air', 'specific_heat_air', 'latent_heat_vapourisation', 'aerodynamic_resistance_canopy', 'net_radiation', 'longwave_emission', 'diurnal_temperature_range', 'condensation')#
Variables that are updated by the model.
At the moment, this tuple is used to decide which variables to output from the
Dataobject, i.e. every variable updated by a model used in the specific simulation. It is also be used warn if multiple models will be updating the same variable and to verify that these variables are indeed initialised by another model, and therefore will be available.