mnp.species_models.species_model
Module Contents
Classes
Highest level class for controlling each species model. Contains the three overarching steps species models do: making an HSI map, clustering metapopulations and evaluating metapopulations. It does not do any work itself. For each major step in MNP it holds an instance of a subclass which implements the actual work. |
Functions
Run this species model. |
|
Run and evaluate species models and evaluate species subselections. |
API
- class mnp.species_models.species_model.SpeciesModel(species_code: str, parameters: mnp.config.MNPParameters)
Highest level class for controlling each species model. Contains the three overarching steps species models do: making an HSI map, clustering metapopulations and evaluating metapopulations. It does not do any work itself. For each major step in MNP it holds an instance of a subclass which implements the actual work.
It gets everything it needs to know to run and evaluate each model from the parameter database dictionary.
- species_code: str
Code for this SpeciesModel (S0XXXXXXX)
- parameters: MNPParameters
MNPParameters containing all parameters for this MNP run.
Initialization
- name_info() dict[str, str]
Return name info
dictionary containing name information for the species model such as species code local name scientific name code of group that species belongs to name of group that species belongs to
- trait_info() dict[str, float]
Gives trait info on species model.
dictionary containing ‘key_population_area_ha’, ‘possibly_viable_threshold’ and ‘viable_threshold’
- run_hsi(land_types: dict or None, environmentals: dict or None) None
Calculate land type suitability map for this species model
environmentals: one or more environmentals land_types: land types object
- get_populations_array(*args, **kwargs) csr_array or int
- array_type: {‘binary’,’nkeys’}
Specify which value should be in the cells of each population
array of this species’ populations
- run_clustering() None
Run each clustering procedure for this species model. Read it from disk if a raster file already exists.
- run_evaluation() None
Evaluate this species model. Save summary table of evaluation to .dbf.
- evaluation_results() dict
Return dictionary with all evaluation results for this species model.
- log_messages()
- mnp.species_models.species_model.run_species(species_model: mnp.species_models.species_model.SpeciesModel, land_types: dict or None, environmentals: dict or None)
Run this species model.
species_model land_types environmentals
- mnp.species_models.species_model.run_species_models(species_models: list[mnp.species_models.species_model.SpeciesModel], land_types: dict or None, environmentals: dict or None)
Run and evaluate species models and evaluate species subselections.
Running a model is: 1. make HSI map 2. do clustering (make populations) 3. evaluate clusters
Prefect should not cache results as this keeps references to the species model list which prevents memory being released during garbage collection.
- land_types:dict
The land type map as a dictionary with land type codes as key and arrays as values
- environmentals
Dictionary with the name of the environmental factor as keys and their corresponding arrays as values
parameters
- species_models: list[SpeciesModel]
list with a model object for each species in this run