mnp.evaluation.subselection_output

Module Contents

Classes

SubselectionOutput

Abstact base class for all classes that have to generate output for a subselection of species.

Table

Basic properties of all output tables.

DetailedTable

Output table for a species subselection, where rows are species and columns carry information regarding the performance of the species in the model run.

SummaryTable

Output table for a species subselection. Table contains viability classes as rownames, species group names as columns and values are counts for each viability-class/species-group combination.

SubselectionMap

KeyPopulationsCountMap

Species GeoMap with the number of keypopulations exisiting at each pixel location

AssignedSpeciesMap

Species GeoMap with the number of species assigned to the combined land types in each pixel location Ook wel bekend als de TOEKENNINGSKAART.

HotSpotsMap

Fraction key populations map.

LandTypeMap

QGIS qlr file pointing to the land-types map in <cover>inputland_typesland_types.tif QLR file is populated with land types only that are coupled to one or more species in the species subselection.

QGisLayers

Functions

identify_land_types_per_species

Identify how many species are coupled to each land type, considering only the species in this particular subselection and only the land types available in this MNP run.

add_output_to_subselection

API

class mnp.evaluation.subselection_output.SubselectionOutput(output_path: str)

Bases: abc.ABC

Abstact base class for all classes that have to generate output for a subselection of species.

Initialization

abstractmethod create()
abstractmethod to_file()
class mnp.evaluation.subselection_output.Table(output_path)

Bases: mnp.evaluation.subselection_output.SubselectionOutput

Basic properties of all output tables.

Initialization

abstractmethod create()
to_file()

Write the table to CSV file.

class mnp.evaluation.subselection_output.DetailedTable(subselection_evaluation: mnp.evaluation.subselection_evaluation.SubselectionEvaluation, species_models: weakref.ReferenceType, output_path: str)

Bases: mnp.evaluation.subselection_output.Table

Output table for a species subselection, where rows are species and columns carry information regarding the performance of the species in the model run.

subselection_species_codes: list[str]

list of species codes for which this table will be construed

Initialization

add_to_table_data(master_dict: dict, species_obj: mnp.species_models.species_model.SpeciesModel)

Add data from a species model object to the table

master_dict: dict

dictionary with species model properties

species_obj: SpeciesModel

A speciesModel instance

create()

Create the detailed table.

species_models: list[SpeciesModel]

list of SpeciesModel objects, from which information on the species performance in the model run is extracted.

class mnp.evaluation.subselection_output.SummaryTable(detailed_table: mnp.evaluation.subselection_output.DetailedTable, output_path: str)

Bases: mnp.evaluation.subselection_output.Table

Output table for a species subselection. Table contains viability classes as rownames, species group names as columns and values are counts for each viability-class/species-group combination.

Initialization

name = 'summary_table.csv'
create()

Create the summary table.

detailed_table: pd.DataFrame

table from the DetailedTable class

class mnp.evaluation.subselection_output.SubselectionMap(geospatial_profile: rasterio.profiles.DefaultGTiffProfile, output_path: str = '')

Bases: mnp.evaluation.subselection_output.SubselectionOutput

abstractmethod create()
to_file()
class mnp.evaluation.subselection_output.KeyPopulationsCountMap(geospatial_profile: rasterio.profiles.DefaultGTiffProfile, subselection_evaluation: mnp.evaluation.subselection_evaluation.SubselectionEvaluation, species_models: weakref.ReferenceType, output_path: str = '')

Bases: mnp.evaluation.subselection_output.SubselectionMap

Species GeoMap with the number of keypopulations exisiting at each pixel location

geospatial_profile: DefaultGTiffProfile

profile of geospatial output

output_path: str

output path

Initialization

content = 'key population count'
create()
class mnp.evaluation.subselection_output.AssignedSpeciesMap(subselection_evaluation: mnp.evaluation.subselection_evaluation.SubselectionEvaluation, parameters: mnp.config.MNPParameters, land_types: dict, output_path: str = '')

Bases: mnp.evaluation.subselection_output.SubselectionMap

Species GeoMap with the number of species assigned to the combined land types in each pixel location Ook wel bekend als de TOEKENNINGSKAART.

species_codes: list[str]

list with species codes

geospatial_profile: DefaultGTiffProfile

profile of geospatial output

output_path: str

output path

land_typesdict

output from read_aggregated_map()

Initialization

content = 'assigned species based on land type'
write_explanatory_table()

Write CSV file with species count per land type

parameters: MNPParameters

output from make_parameters

land_types: dict

dictionary with land type NPZ files read from file as values, output from read_aggregated_map()

create()

Calculate an array where each cell value identifies the number of distinct species from this subselection assigned to all land_types occuring in that cell.

suitability_indexes: pd.DataFrame

DataFrame with land type suitability indexes

land_types: dict

dictionary with land type NPZ files read from file as values, output from read_aggregated_map()

to_file()
class mnp.evaluation.subselection_output.HotSpotsMap(geospatial_profile: rasterio.profiles.DefaultGTiffProfile, assigned_species_map: mnp.evaluation.subselection_output.AssignedSpeciesMap, key_population_count_map: mnp.evaluation.subselection_output.KeyPopulationsCountMap, output_path: str = '')

Bases: mnp.evaluation.subselection_output.SubselectionMap

Fraction key populations map.

geospatial_profile: DefaultGTiffProfile

profile of geospatial output

output_path: str

output path

Initialization

content = 'fraction of assigned species with a population reaching at least a key population in size'
create()

Calculate Hotspots map, also known as fraction key populations map

assigned_species_map: AssignedSpeciesMap

Map with assigned species count per pixel

key_population_count_map: KeyPopulationsCountMap

Map with key population count per pixel

save_qml()

Add QGIS QML template file to output for file formatting

to_file()
class mnp.evaluation.subselection_output.LandTypeMap(subselection_evaluation: mnp.evaluation.subselection_evaluation.SubselectionEvaluation, land_types: dict, parameters: mnp.config.MNPParameters, output_path: str = '')

Bases: mnp.evaluation.subselection_output.SubselectionOutput

QGIS qlr file pointing to the land-types map in <cover>inputland_typesland_types.tif QLR file is populated with land types only that are coupled to one or more species in the species subselection.

Initialization

create()
save_qlr()
to_file()
class mnp.evaluation.subselection_output.QGisLayers(subselection_evaluation: mnp.evaluation.subselection_evaluation.SubselectionEvaluation, layer_type: str, species_models: weakref.ReferenceType, output_path: str)

Bases: mnp.evaluation.subselection_output.SubselectionOutput

create()

Create QGIS QLR layer files for the tif files of the species in the subselection.

Concerns:
outputhsi<species_code>.tif –>

outputspecies_subselections<selection_name>hsi_maps<species_code>.qlr

outputenvironmental_factor<species_code>.tif –>

outputspecies_subselections<selection_name>environmental_factor_maps<species_code>.qlr

outputclustering<species_code>.tif –>

outputspecies_subselections<selection_name>population_maps<species_code>.qlr

layer_type: str

currently supported are [hsi, environmental_factor, habitats]

species_models: list[SpeciesModel]

list of SpeciesModel objects

*.qlr on disk

to_file()
mnp.evaluation.subselection_output.identify_land_types_per_species(suitability_indexes: pandas.DataFrame, species_codes: set[str], land_types: dict)

Identify how many species are coupled to each land type, considering only the species in this particular subselection and only the land types available in this MNP run.

species_codes: set[str]

set of species code strings

land_types: dict

dictionary with land type NPZ files read from file as values, output from read_aggregated_map()

suitability_indexes: pd.DataFrame

DataFrame with land type suitability indexes

Dictionary with species_codes as keys and list of land_types as values

mnp.evaluation.subselection_output.add_output_to_subselection(evaluation: mnp.evaluation.subselection_evaluation.SubselectionEvaluation, output_pathway: mnp.preparation.io_pathways.OutputPathway, parameters: mnp.config.MNPParameters, species_models: list[mnp.species_models.species_model.SpeciesModel], land_types: dict[str:sparray])