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:

bounds

A set of bounds on microclimates variables, used with both the simple model of the initial state and the full energy balance calculations.

core_constants

The core constants used in the model.

data

A Data instance providing access to the shared simulation data.

grid

The Grid details used in the model.

latitude

Latitude in degrees.

layer_structure

The LayerStructure details used in the model.

model_constants

Set of constants for the abiotic model.

model_timing

The ModelTiming details used in the model.

model_update_bounds

Bounds on model update frequencies.

pyrealm_core_constants

Pyrealm core constants.

vars_populated_by_first_update

Variables that are initialised by the model during the first update.

vars_populated_by_init

Variables that are initialised by the model during the setup.

vars_required_for_init

Required variables for model initialisation.

vars_required_for_update

Variables that are required by the update method of the model.

vars_updated

Variables that are updated by the model.

Methods:

check_init_data()

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_init class attribute are present in the Data instance 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.

cleanup() None[source]#

Placeholder function for abiotic model cleanup.

core_constants: CoreConstants#

The core constants used in the model.

data: Data#

A Data instance providing access to the shared simulation data.

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 Data instance.

  • configuration – A validated Virtual Ecosystem model configuration object.

  • core_components – The core components used across models.

grid: Grid#

The Grid details used in the model.

latitude: float#

Latitude in degrees. This is required to generate the diurnal cycle.

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.

spinup() None[source]#

Placeholder function to spin up the abiotic model.

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 Data instance 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 Data object, 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.