API documentation for the abiotic_simple_model module#
The abiotic_simple_model module
creates a
AbioticSimpleModel
class as a child of the BaseModel class.
Todo: * update temperatures to Kelvin * pressure and CO2 profiles should only be filled for filled/true above ground layers
The AbioticSimpleModel class#
- class virtual_ecosystem.models.abiotic_simple.abiotic_simple_model.AbioticSimpleModel(data: Data, core_components: CoreComponents, model_configuration: AbioticSimpleConfiguration = AbioticSimpleConfiguration(), pyrealm_core_constants: CoreConst = PyrealmCoreConst(), static: bool = False)[source]#
A class describing the abiotic simple model.
- Parameters:
data – The data object to be used in the model.
core_components – The core components used across models.
model_configuration – Configuration object from the abiotic_simple model.
pyrealm_core_constants – Core constants for the pyrealm package.
static – Boolean flag indicating if the model should run in static mode.
Attributes:
Upper and lower bounds for abiotic variables.
The core constants used in the model.
A Data instance providing access to the shared simulation data.
The Grid details used in the model.
The LayerStructure details used in the model.
Set of constants for the abiotic simple model
The ModelTiming details used in the model.
Bounds on model update frequencies.
Core constants for the pyrealm package.
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 simple model from configuration.
spinup()Placeholder function to spin up the abiotic simple model.
update(time_index, **kwargs)Function to update the model.
- bounds: AbioticSimpleBounds#
Upper and lower bounds for abiotic variables.
- 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) AbioticSimpleModel[source]#
Factory function to initialise the abiotic simple 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: AbioticSimpleConstants#
Set of constants for the abiotic simple model
- model_timing: ModelTiming#
The ModelTiming details used in the model.
- model_update_bounds: tuple[Quantity, Quantity] = (<Quantity(1, 'day')>, <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#
Core constants for the pyrealm package.
- 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', 'vapour_pressure_ref', 'vapour_pressure_deficit_ref', 'net_radiation', 'air_temperature', 'relative_humidity', 'vapour_pressure_deficit', 'atmospheric_pressure', 'atmospheric_co2', 'wind_speed', 'canopy_temperature', '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')#
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', 'mean_annual_temperature', 'shortwave_absorption')#
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', 'relative_humidity', 'vapour_pressure_deficit', 'soil_temperature', 'atmospheric_pressure', 'atmospheric_co2', 'wind_speed', 'net_radiation', 'vapour_pressure')#
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.