API for the animal_model module#

The animal_model module creates a AnimalModel class as a child of the BaseModel class.

At present a lot of the abstract methods of the parent class (e.g. spinup()) are overwritten using placeholder functions that don’t do anything. This will change as the Virtual Ecosystem model develops.

The factory method from_config() exists in a more complete state, and unpacks a small number of parameters from our currently pretty minimal configuration dictionary. These parameters are then used to generate a class instance. If errors emerge when converting the information from the config dictionary to the required types (e.g. timedelta64) they are caught and then logged, and at the end of the unpacking an error is thrown. This error should be caught and handled by downstream functions so that all model configuration failures can be reported as one.

Classes:

AnimalModel(data, core_components, ...[, ...])

A class describing the animal model.

class virtual_ecosystem.models.animal.animal_model.AnimalModel(data: Data, core_components: CoreComponents, animal_cohort_exporter: AnimalCohortDataExporter, resource_pool_exporter: ResourcePoolDataExporter, functional_groups: list[FunctionalGroup], microbial_c_n_p_ratios: dict[str, dict[str, float]], model_constants: AnimalConstants = AnimalConstants(), static: bool = False)[source]#

A class describing the animal model.

Describes the specific functions and attributes that the animal module should possess.

Parameters:
  • data – The data object to be used in the model.

  • core_components – The core components used across models.

  • animal_cohort_exporter – The export system for animal cohort data.

  • resource_pool_exporter – The export system for resource pools.

  • density_scaling_method – Which density scaling equation to use in initialization.

  • functional_groups – The list of animal functional groups present in the simulation.

  • microbial_c_n_p_ratios – Biomass stoichiometry of each microbial functional group.

  • model_constants – An AnimalConstants instance, providing constants for the model and setting the density scaling method to be used in simulation.

  • static – If True, runs in static mode.

Methods:

abandon_communities(cohort)

Removes the cohort from the occupancy of every community.

assign_prey_groups(cohort)

Assign the available prey groups to a given animal cohort.

birth(parent_cohort)

Produce offspring for a parent cohort using helper methods.

birth_community()

This handles birth for all cohorts in a community.

calculate_birth_mass_cnp(birth_mass, parent)

Convert total birth mass into carbon, nitrogen, and phosphorus components.

calculate_density_for_cohort(cohort)

Calculate the population density for a cohort within a specific community.

calculate_litter_additions_from_herbivory()

Calculate additions to litter due to herbivory mechanical inefficiencies.

calculate_offspring_count(parent, ...)

Calculate the maximum number of total offspring based on available mass.

calculate_semelparous_mass_loss(parent)

Calculate the mass lost by a semelparous parent after reproduction.

calculate_soil_additions()

Calculate how much animal matter should be transferred to the soil.

calculate_total_litter_consumption(litter_pools)

Compute carbon removed from every litter pool, by cell.

calculate_total_reproductive_mass(parent)

Calculate total reproductive mass available for offspring.

calculate_total_soil_consumption(soil_pools)

Compute carbon and nutrients removed from every soil pool, by cell.

check_init_data()

Check the init data contains the required variables.

cleanup()

Placeholder function for animal model cleanup.

create_new_cohort(functional_group, mass, ...)

Create a new AnimalCohort and register it in the model.

create_offspring(parent, number_offspring)

Create a new offspring cohort using the parent's offspring group definition.

forage_community(dt)

Loop through each active cohort and trigger resource consumption.

from_config(data, configuration, core_components)

Factory function to initialise the animal model from configuration.

handle_ontogeny()

Update largest body mass achieved for immature cohorts.

handle_post_birth_parent_updates(parent, ...)

Update parent's reproductive mass and handle semelparous death if needed.

handle_semelparous_parent_death(parent)

Apply mass loss and remove parent cohort for semelparous species.

increase_age_community(dt)

This handles age for all cohorts in a community.

inflict_non_predation_mortality_community(dt)

This handles natural mortality for all cohorts in a community.

metabolize_community(dt)

This handles metabolize for all cohorts in a community.

metamorphose(larval_cohort)

This transforms a larval status cohort into an adult status cohort.

metamorphose_community()

Handle metamorphosis for all applicable cohorts in the community.

migrate(migrant, destination_centroid)

Function to move an AnimalCohort between grid cells.

migrate_community()

This handles migrating all cohorts with a centroid in the community.

migrate_external(cohort)

Handles the initiation of external migration events.

migrate_external_community()

Cycles through all active cohorts and checks for external migration.

populate_fungal_fruiting_bodies()

Populate the fungal fruiting body pools for animal consumption.

populate_soil_pools()

Populate the soil pools that animals can consume from.

reintegrate_cohort(cohort, source)

Handles integration of cohorts from migrated/aquatic to active status.

reintegrate_community()

Cycles through all migrated and aquatic cohorts, checking for reintegration.

remove_dead_cohort(cohort)

Removes an AnimalCohort from the model's cohorts and relevant communities.

remove_dead_cohort_community()

This handles remove_dead_cohort for all cohorts in a community.

reset_trophic_records()

Reset trophic interaction records for all active cohorts.

spinup()

Placeholder function to spin up the animal model.

to_per_day(change)

Method to convert a change caused by the animal model into a per day rate.

update(time_index, **kwargs)

Function to update the model.

update_activity_windows_community()

Update the activity window fraction for all cohorts in all communities.

update_cohort_bookkeeping(dt)

Perform lifecycle-related updates for each cohort.

update_community_bookkeeping(dt)

Perform status updates and cleanup at the community level.

update_community_occupancy(cohort, centroid_key)

This updates the community lists for animal cohort occupancy.

update_fungal_fruiting_bodies()

Update fungal fruiting bodies pools due to fungal production and decay.

update_fungal_fruiting_bodies_in_data()

Method to update the fungal fruiting bodies in the data object.

update_migrated_and_aquatic(dt)

Handles updating timing on frozen migrated and aquatic cohorts.

update_population_densities()

Updates the densities for each functional group in each community.

Attributes:

active_cohorts

A dictionary of all active animal cohorts and their unique ids.

animal_cohort_exporter

Exporter for animal cohort data.

aquatic_cohorts

A dictionary of all aquatic animal cohorts and their unique ids.

array_resource_pools

A list of the individual resource pools made available through array resources.

array_resources

A list of array resources providing pools for foraging.

carcass_pools

The carcass pools in the model with associated grid cell ids.

communities

Animal communities with grid cell IDs and lists of AnimalCohorts.

core_constants

The core constants used in the model.

data

A Data instance providing access to the shared simulation data.

excrement_pools

The excrement pools in the model with associated grid cell ids.

functional_groups

List of functional groups in the model.

fungal_fruiting_bodies

The pools of fungal fruiting bodies with associated grid cell ids.

grid

The Grid details used in the model.

layer_structure

The LayerStructure details used in the model.

leaf_waste_pools

A pool for leaves removed by herbivory but not actually consumed.

microbial_c_n_p_ratios

The CNP ratios of the different microbial functional groups.

migrated_cohorts

A dictionary of all migrated animal cohorts and their unique ids.

minimum_cohort_size

The minimum number of individuals to initialize a cohort at init.

model_constants

Animal constants.

model_timing

The ModelTiming details used in the model.

model_update_bounds

Bounds on model update frequencies.

resource_pool_exporter

Exporter for resource pools.

soil_pools

The animal consumable soil pools with associated grid cell ids.

target_cohorts_per_fg

The target number of cohorts per functional group in each grid cell.

update_interval_timedelta

Convert pint update_interval to timedelta64 once during initialization.

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.

abandon_communities(cohort: AnimalCohort) None[source]#

Removes the cohort from the occupancy of every community.

This method is for use in death or re-initializing territories.

Parameters:

cohort – The cohort to be removed from the occupancy lists.

active_cohorts: dict[UUID, AnimalCohort]#

A dictionary of all active animal cohorts and their unique ids.

animal_cohort_exporter: AnimalCohortDataExporter#

Exporter for animal cohort data.

aquatic_cohorts: dict[UUID, AnimalCohort]#

A dictionary of all aquatic animal cohorts and their unique ids.

array_resource_pools: list[ResourcePool]#

A list of the individual resource pools made available through array resources.

array_resources: list[ArrayResource]#

A list of array resources providing pools for foraging.

assign_prey_groups(cohort: AnimalCohort) None[source]#

Assign the available prey groups to a given animal cohort.

This method filters the functional groups present in the model based on the diet of the cohort and stores the resulting prey/resource groups on the cohort. It should be called whenever a cohort is created or changes functional group.

Parameters:

cohort – The AnimalCohort instance for which to assign prey groups.

birth(parent_cohort: AnimalCohort) None[source]#

Produce offspring for a parent cohort using helper methods.

This orchestrates the reproduction process, including: - Calculating total available reproductive mass. - Determining number of offspring. - Creating offspring and adding them to the population. - Updating parent mass after reproduction. - Removing semelparous parents if applicable.

Parameters:

parent_cohort – The parent cohort giving birth.

birth_community() None[source]#

This handles birth for all cohorts in a community.

calculate_birth_mass_cnp(birth_mass: float, parent: AnimalCohort) tuple[float, float, float][source]#

Convert total birth mass into carbon, nitrogen, and phosphorus components.

Parameters:
  • birth_mass – Total birth mass per offspring.

  • parent – Parent cohort providing stoichiometry.

Returns:

Tuple of (birth_carbon, birth_nitrogen, birth_phosphorus).

calculate_density_for_cohort(cohort: AnimalCohort) float[source]#

Calculate the population density for a cohort within a specific community.

TODO: This will need to be modified for multi-grid occupancy.

Parameters:
  • cohort – The AnimalCohort object for which to calculate the density.

  • community_id – The identifier for the community where the cohort resides.

Returns:

The population density of the cohort within the community (individuals/m2).

calculate_litter_additions_from_herbivory() dict[str, DataArray][source]#

Calculate additions to litter due to herbivory mechanical inefficiencies.

TODO - At present the only type of herbivory this works for is leaf herbivory, that should be changed once herbivory as a whole is fleshed out.

Returns:

A dictionary containing details of the leaf litter addition due to herbivory this comprises of the masses of carbon, nitrogen and phosphorus added [kg], and the proportion of input carbon that is lignin [unitless].

calculate_offspring_count(parent: AnimalCohort, reproductive_mass: dict[str, float]) int[source]#

Calculate the maximum number of total offspring based on available mass.

Each offspring has a defined birth mass, which must be split into C, N, and P. The limiting nutrient determines how many offspring can be made.

Parameters:
  • parent – The parent cohort.

  • reproductive_mass – Available reproductive mass (C, N, P).

Returns:

Number of offspring.

calculate_semelparous_mass_loss(parent: AnimalCohort) dict[str, float][source]#

Calculate the mass lost by a semelparous parent after reproduction.

If the species is not semelparous, returns zero loss.

Parameters:

parent – The parent cohort.

Returns:

Dictionary of mass loss (C, N, P).

calculate_soil_additions() dict[str, DataArray][source]#

Calculate how much animal matter should be transferred to the soil.

calculate_total_litter_consumption(litter_pools: dict[int, dict[str, Resource]]) dict[str, DataArray][source]#

Compute carbon removed from every litter pool, by cell.

Parameters:

litter_pools – Mapping created at model setup.

Returns:

Dictionary whose keys are "litter_consumption_<pool_name>" and whose values are 1-D xarray.DataArray objects (dimension cell_id) containing the amount of carbon consumed from each litter pool during the current update, expressed in kg C m⁻².

calculate_total_reproductive_mass(parent: AnimalCohort) dict[str, float][source]#

Calculate total reproductive mass available for offspring.

For semelparous species, part of the parent’s non-reproductive mass is also transferred to reproduction as they die after reproducing.

Parameters:

parent – The parent cohort.

Returns:

Reproductive mass for C, N, P (kg).

calculate_total_soil_consumption(soil_pools: dict[int, dict[str, SoilPool]]) dict[str, DataArray][source]#

Compute carbon and nutrients removed from every soil pool, by cell.

The soil model treats microbial stoichiometry as fixed so only removal of particulate organic nitrogen and phosphorus is calculated explicitly. The soil model also subdivides fungi, so this function also calculates how much of the fungal removal should come from each group.

Parameters:

soil_pools – Set of soil pools available for animal consumption [kg]

Returns:

The rate at which biomass is removed from the relevant soil model pools [kg m^-3 day^-1]

carcass_pools: dict[int, list[CarcassPool]]#

The carcass pools in the model with associated grid cell ids.

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 animal model cleanup.

communities: dict[int, list[AnimalCohort]]#

Animal communities with grid cell IDs and lists of AnimalCohorts.

core_constants: CoreConstants#

The core constants used in the model.

create_new_cohort(functional_group: FunctionalGroup, mass: float, age: float, individuals: int, centroid_key: int, is_birth: bool = False) AnimalCohort[source]#

Create a new AnimalCohort and register it in the model.

Parameters:
  • functional_group – Functional group defining cohort traits.

  • mass – Body mass (kg) at creation.

  • age – Age (days) at creation.

  • individuals – Number of individuals in the cohort.

  • centroid_key – Grid cell for territorial location.

  • is_birth – Whether the cohort is a new offspring (affects aquatic routing).

Returns:

A registered AnimalCohort.

create_offspring(parent: AnimalCohort, number_offspring: int) AnimalCohort[source]#

Create a new offspring cohort using the parent’s offspring group definition.

Parameters:
  • parent – The parent cohort.

  • number_offspring – Number of offspring to create.

Returns:

The newly created AnimalCohort.

data: Data#

A Data instance providing access to the shared simulation data.

excrement_pools: dict[int, list[ExcrementPool]]#

The excrement pools in the model with associated grid cell ids.

forage_community(dt: timedelta64) None[source]#

Loop through each active cohort and trigger resource consumption.

Diet flags on a cohort determine which resource lists are assembled and forwarded to cohort.forage_cohort:

  • FOLIAGE / FRUIT / SEEDS → live plant resources

  • VERTEBRATES / INVERTEBRATES → live prey cohorts

  • DETRITUS → plant-litter pools (detritivory)

  • CARCASSES → carcass pools (scavenging)

  • WASTE → excrement pools (coprophagy)

  • MUSHROOMS → fungal fruiting bodies

  • FUNGI → soil fungi

  • POM → soil POM

  • BACTERIA → soil bacteria

Parameters:

dt – Time step duration.

classmethod from_config(data: Data, configuration: CompiledConfiguration, core_components: CoreComponents) AnimalModel[source]#

Factory function to initialise the animal 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 None is returned.

Parameters:
  • data – A Data instance.

  • configuration – A validated Virtual Ecosystem model configuration object.

  • core_components – The core components used across models.

functional_groups: list[FunctionalGroup]#

List of functional groups in the model.

fungal_fruiting_bodies: dict[int, FungalFruitPool]#

The pools of fungal fruiting bodies with associated grid cell ids.

grid: Grid#

The Grid details used in the model.

handle_ontogeny() None[source]#

Update largest body mass achieved for immature cohorts.

This is used to support ontogeny-aware starvation calculations.

handle_post_birth_parent_updates(parent: AnimalCohort, offspring_count: int) None[source]#

Update parent’s reproductive mass and handle semelparous death if needed.

Reduces the parent’s reproductive mass based on offspring produced. Removes semelparous parents after reproduction.

Parameters:
  • parent – The parent cohort.

  • offspring_count – Number of offspring produced.

handle_semelparous_parent_death(parent: AnimalCohort) None[source]#

Apply mass loss and remove parent cohort for semelparous species.

Semelparous parents die after reproducing, so we: - Apply a mass loss to the parent. - Set parent to is_alive = False. - Remove the parent from the population.

Parameters:

parent – The parent cohort.

increase_age_community(dt: timedelta64) None[source]#

This handles age for all cohorts in a community.

Parameters:

dt – Number of days over which the metabolic costs should be calculated.

inflict_non_predation_mortality_community(dt: timedelta64) None[source]#

This handles natural mortality for all cohorts in a community.

This includes background mortality, starvation, and, for mature cohorts, senescence.

Parameters:

dt – Number of days over which the metabolic costs should be calculated.

layer_structure: LayerStructure#

The LayerStructure details used in the model.

leaf_waste_pools: dict[int, HerbivoryWaste]#

A pool for leaves removed by herbivory but not actually consumed.

metabolize_community(dt: timedelta64) None[source]#

This handles metabolize for all cohorts in a community.

Each cohort metabolizes at the territory-mean temperature stored in current_temperature, which was set by the preceding call to update_activity_windows_community(). This ensures the temperature entering the metabolic rate equation is consistent with the temperature used to derive sigma_f_t, i.e. both reflect the cohort’s stratum- and territory-averaged environment rather than the centroid surface layer.

This method generates a total amount of metabolic waste per cohort and passes that waste to handler methods for distinguishing between nitrogenous and carbonaceous wastes as they need depositing in different pools.

Respiration wastes are totalled because they are CO2 and not tracked spatially. Excretion wastes are handled cohort by cohort because they will need to be spatially explicit with multi-grid occupancy.

Parameters:

dt – Number of days over which the metabolic costs should be calculated.

metamorphose(larval_cohort: AnimalCohort) None[source]#

This transforms a larval status cohort into an adult status cohort.

This method takes an indirect developing cohort in its larval form, inflicts a mortality rate, and creates an adult cohort of the correct type.

TODO: Build in a relationship between larval_cohort mass and adult cohort mass. TODO: Is adult_mass the correct mass threshold? TODO: If the time step drops below a month, this needs an intermediary stage.

Parameters:

larval_cohort – The cohort in its larval stage to be transformed.

metamorphose_community() None[source]#

Handle metamorphosis for all applicable cohorts in the community.

microbial_c_n_p_ratios: dict[str, dict[str, float]]#

The CNP ratios of the different microbial functional groups.

migrate(migrant: AnimalCohort, destination_centroid: int) None[source]#

Function to move an AnimalCohort between grid cells.

This function takes a cohort and a destination grid cell, changes the centroid of the cohort’s territory to be the new cell, and then reinitializes the territory around the new centroid.

TODO: travel distance should be a function of body-size or locomotion once

multi-grid occupancy is integrated.

Parameters:
  • migrant – The AnimalCohort moving between AnimalCommunities.

  • destination_centroid – The grid cell the cohort is moving to.

migrate_community() None[source]#

This handles migrating all cohorts with a centroid in the community.

This migration method initiates migration for two reasons: 1) The cohort is starving and needs to move for a chance at resource access 2) An initial migration event immediately after birth.

TODO: MGO - migrate distance mod for larger territories?

migrate_external(cohort: AnimalCohort) None[source]#

Handles the initiation of external migration events.

Parameters:

cohort – The migrating cohort.

migrate_external_community() None[source]#

Cycles through all active cohorts and checks for external migration.

Only calls trigger_external_migration for cohorts that are seasonal migrators.

migrated_cohorts: dict[UUID, AnimalCohort]#

A dictionary of all migrated animal cohorts and their unique ids.

minimum_cohort_size: int#

The minimum number of individuals to initialize a cohort at init.

model_constants: AnimalConstants#

Animal constants.

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.

populate_fungal_fruiting_bodies() dict[int, FungalFruitPool][source]#

Populate the fungal fruiting body pools for animal consumption.

Returns:

A dictionary with a fungal fruiting body pool for each cell ID.

populate_soil_pools() dict[int, dict[str, SoilPool]][source]#

Populate the soil pools that animals can consume from.

Returns:

A dictionary where keys represent the pool types and values are the corresponding SoilPool objects. The following pools are included:

  • ”pom”: Particulate organic matter

  • ”bacteria”: Bacteria

  • ”fungi”: Fungi (i.e. all fungal functional groups)

reintegrate_cohort(cohort: AnimalCohort, source: str) None[source]#

Handles integration of cohorts from migrated/aquatic to active status.

Parameters:
  • cohort – The animal cohort changing to active status.

  • source – Whether the cohort was migrated or aquatic.

reintegrate_community() None[source]#

Cycles through all migrated and aquatic cohorts, checking for reintegration.

Only calls reintegrate_cohort when remaining_time_away is 0 or less.

remove_dead_cohort(cohort: AnimalCohort) None[source]#

Removes an AnimalCohort from the model’s cohorts and relevant communities.

This method removes the cohort from every community listed in its territory’s grid cell keys, and then removes it from the model’s main cohort dictionary.

Parameters:

cohort – The AnimalCohort to be removed.

Raises:

KeyError – If the cohort ID does not exist in the model’s cohorts.

remove_dead_cohort_community() None[source]#

This handles remove_dead_cohort for all cohorts in a community.

reset_trophic_records() None[source]#

Reset trophic interaction records for all active cohorts.

resource_pool_exporter: ResourcePoolDataExporter#

Exporter for resource pools.

soil_pools: dict[int, dict[str, SoilPool]]#

The animal consumable soil pools with associated grid cell ids.

spinup() None[source]#

Placeholder function to spin up the animal model.

target_cohorts_per_fg: int#

The target number of cohorts per functional group in each grid cell.

to_per_day(change: ndarray[tuple[Any, ...], dtype[float32]]) ndarray[tuple[Any, ...], dtype[float32]][source]#

Method to convert a change caused by the animal model into a per day rate.

Parameters:

change – Change in pool caused by the animal model [kg m^-2] or [kg m^-3].

Returns:

Change converted to a per day rate (which are the units the soil model needs it in) units [kg m^-2 day^-1] or [kg m^-3 day^-1].

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.

update_activity_windows_community() None[source]#

Update the activity window fraction for all cohorts in all communities.

Per-stratum temperatures and diurnal ranges are pre-computed once per timestep as per-cell means, then get_mean_territory_climate() derives the climate experienced by each cohort based on its vertical occupancy. Both variables are averaged across all territory cells.

Where a cell has no filled canopy layers, canopy temperature and diurnal range fall back to the corresponding ground values to avoid NaN propagation.

Note

Annual mean temperature and annual temperature SD are currently placeholder constants from AnimalConstants and should be replaced once the abiotic model exposes those fields.

update_cohort_bookkeeping(dt: timedelta64) None[source]#

Perform lifecycle-related updates for each cohort.

This includes: - Increasing age - Updating largest mass achieved

Parameters:

dt – Time step duration [days].

update_community_bookkeeping(dt: timedelta64) None[source]#

Perform status updates and cleanup at the community level.

This includes: - Updating timers for migrated or aquatic cohorts - Reintegration of previously inactive cohorts - Removal of dead cohorts

Parameters:

dt – Time step duration [days].

update_community_occupancy(cohort: AnimalCohort, centroid_key: int) None[source]#

This updates the community lists for animal cohort occupancy.

Parameters:
  • cohort – The animal cohort being updates.

  • centroid_key – The grid cell key of the anchoring grid cell.

update_fungal_fruiting_bodies() dict[str, DataArray][source]#

Update fungal fruiting bodies pools due to fungal production and decay.

This method first updates the fungal fruiting body pools with the new biomass supplied from the soil model. The total decay of the fungal fruiting bodies is then calculated and subtracted from the pools. This ordering means that we are prioritising decay over before animal consumption, which is consistent with the assumptions we made for excrement and carcass decay.

Returns:

The rate at which fungal fruiting bodies decay back into the soil [kg m^-2 day^-1].

update_fungal_fruiting_bodies_in_data() None[source]#

Method to update the fungal fruiting bodies in the data object.

This update is based on the current state of the animal model FungalFruitPools. This method is run after the additions due to new fungal fruiting body production and removals due to decay and animal consumption have been made.

update_interval_timedelta: timedelta64#

Convert pint update_interval to timedelta64 once during initialization.

update_migrated_and_aquatic(dt: timedelta64) None[source]#

Handles updating timing on frozen migrated and aquatic cohorts.

Parameters:

dt – The amount of time passed in the update (days).

update_population_densities() None[source]#

Updates the densities for each functional group in each community.

vars_populated_by_first_update: tuple[str, ...] = ('decomposed_excrement_cnp', 'decomposed_carcasses_cnp', 'herbivory_waste_leaf_cnp', 'herbivory_waste_leaf_lignin', 'animal_pom_consumption_cnp', 'animal_bacteria_consumption', 'animal_saprotrophic_fungi_consumption', 'animal_ectomycorrhiza_consumption', 'animal_arbuscular_mycorrhiza_consumption', 'decay_of_fungal_fruiting_bodies')#

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, ...] = ('total_animal_respiration', 'population_densities', 'litter_consumed_above_metabolic_cnp', 'litter_consumed_above_structural_cnp', 'litter_consumed_woody_cnp', 'litter_consumed_below_metabolic_cnp', 'litter_consumed_below_structural_cnp')#

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, ...] = ('fungal_fruiting_bodies', 'subcanopy_vegetation_cnp', 'subcanopy_seedbank_cnp', 'canopy_foliage_cnp', 'canopy_seed_cnp', 'canopy_fruit_cnp', 'foliage_turnover_cnp', 'seed_turnover_cnp', 'fruit_turnover_cnp', 'litter_pool_above_metabolic_cnp', 'litter_pool_above_structural_cnp', 'litter_pool_woody_cnp', 'litter_pool_below_metabolic_cnp', 'litter_pool_below_structural_cnp', 'subcanopy_vegetation_cnp_consumed', 'subcanopy_seedbank_cnp_consumed', 'canopy_foliage_cnp_consumed', 'canopy_seed_cnp_consumed', 'canopy_fruit_cnp_consumed', 'foliage_turnover_cnp_consumed', 'seed_turnover_cnp_consumed', 'fruit_turnover_cnp_consumed')#

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, ...] = ('canopy_temperature', 'air_temperature', 'soil_temperature', 'diurnal_temperature_range', 'litter_pool_above_metabolic_cnp', 'litter_pool_above_structural_cnp', 'litter_pool_woody_cnp', 'litter_pool_below_metabolic_cnp', 'litter_pool_below_structural_cnp', 'production_of_fungal_fruiting_bodies', 'soil_cnp_pool_pom', 'soil_c_pool_bacteria', 'soil_c_pool_saprotrophic_fungi', 'soil_c_pool_arbuscular_mycorrhiza', 'soil_c_pool_ectomycorrhiza')#

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, ...] = ('decomposed_excrement_cnp', 'decomposed_carcasses_cnp', 'herbivory_waste_leaf_cnp', 'herbivory_waste_leaf_lignin', 'total_animal_respiration', 'litter_consumed_above_metabolic_cnp', 'litter_consumed_above_structural_cnp', 'litter_consumed_woody_cnp', 'litter_consumed_below_metabolic_cnp', 'litter_consumed_below_structural_cnp', 'animal_pom_consumption_cnp', 'animal_bacteria_consumption', 'animal_saprotrophic_fungi_consumption', 'animal_ectomycorrhiza_consumption', 'animal_arbuscular_mycorrhiza_consumption', 'fungal_fruiting_bodies', 'decay_of_fungal_fruiting_bodies', 'subcanopy_vegetation_cnp_consumed', 'subcanopy_seedbank_cnp_consumed', 'canopy_foliage_cnp_consumed', 'canopy_seed_cnp_consumed', 'canopy_fruit_cnp_consumed', 'foliage_turnover_cnp_consumed', 'seed_turnover_cnp_consumed', 'fruit_turnover_cnp_consumed')#

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.