mnp.preparation.io_pathways
Module Contents
Classes
Procedure to verify that a Metadata comment has been provided in the ini |
|
|
|
Procedure to verify that user provided directory for pre-aggregated land_types exists and contains at least 2 NPZ files and the geospatial profile. |
|
Procedure to verify that user provided HSI directory exists and contains at least 1 Tif file. Tif file must be formatted with species code: S01234567.tif! |
|
Procedure to verify that the user provided parameters are within permitted ranges. |
|
Procedure to verify that species local distances are commensurable with raster resolution. Assumes raster resolution = 25m |
|
Procedure to check if file is a geospatial raster and if so check its resolution. |
|
Procedure to verify that the bounds of two rasters match first environmental raster and the land_type raster match. Only the first environmental raster is checked as the environmental rasters are compared to each other. So if one matches, they all match. Parameters ———- args : strings |
|
Procedure to verify that the bounds of the first environmental factor raster match with the bounds of the Geospatial Profile, in case of pre-aggregated NPZ files. |
|
Procedure to verify that at least one species subselection is provided by the user and is not empty. |
|
Class to examine the user provided input in the configuration file and to compile a list of required verification procedures. Which procedures are required, depends on the user input. |
|
Functions
API
- class mnp.preparation.io_pathways.VerifyMetadataComment(configuration: configparser.ConfigParser)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to verify that a Metadata comment has been provided in the ini
Initialization
- class mnp.preparation.io_pathways.VerifyTable(table_path: str, table_type: str)
Bases:
mnp.preparation.io_pathways.VerificationProcedureInitialization
- class mnp.preparation.io_pathways.VerifyEnvironmentalTable(configuration: configparser.ConfigParser, environmental_section: str)
Bases:
mnp.preparation.io_pathways.VerifyTable- Procedure to verify that user provided:
environmental_factor raster is a valid geospatial file environmental_factor response table is a valid CSV file
Initialization
- class mnp.preparation.io_pathways.VerifyLandTypeDirectory(configuration: configparser.ConfigParser)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to verify that user provided directory for pre-aggregated land_types exists and contains at least 2 NPZ files and the geospatial profile.
Initialization
- class mnp.preparation.io_pathways.VerifyHSIFromDisk(configuration: configparser.ConfigParser)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to verify that user provided HSI directory exists and contains at least 1 Tif file. Tif file must be formatted with species code: S01234567.tif!
Initialization
- class mnp.preparation.io_pathways.VerifyParameters(configuration: configparser.ConfigParser)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to verify that the user provided parameters are within permitted ranges.
Initialization
- class mnp.preparation.io_pathways.VerifySpeciesTraits(configuration: configparser.ConfigParser, target_resolution: int)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to verify that species local distances are commensurable with raster resolution. Assumes raster resolution = 25m
Initialization
- class mnp.preparation.io_pathways.VerifyIsGeospatialRasterAndResolution(raster_path: str, target_resolution: int)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to check if file is a geospatial raster and if so check its resolution.
- raster_pathstr
Path to raster file
- target_resolution
Resolution that the raster should have
Initialization
- class mnp.preparation.io_pathways.VerifyRasterBounds(*args: str or list)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to verify that the bounds of two rasters match first environmental raster and the land_type raster match. Only the first environmental raster is checked as the environmental rasters are compared to each other. So if one matches, they all match. Parameters ———- args : strings
Paths for rasters to compare. Can be a list of paths or can be separate paths as function arguments.
Initialization
- class mnp.preparation.io_pathways.VerifyRasterAndGeospatialProfileBounds(geospatial_profile_path: str, raster_path: str)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to verify that the bounds of the first environmental factor raster match with the bounds of the Geospatial Profile, in case of pre-aggregated NPZ files.
Initialization
- class mnp.preparation.io_pathways.ErrorMessage(message: str)
- class mnp.preparation.io_pathways.VerifySpeciesSubselection(configuration: configparser.ConfigParser)
Bases:
mnp.preparation.io_pathways.VerificationProcedureProcedure to verify that at least one species subselection is provided by the user and is not empty.
Initialization
- class mnp.preparation.io_pathways.VerifyHasEnvironmentalFactors(has_environmentals: bool)
- class mnp.preparation.io_pathways.InputPathway
Class to examine the user provided input in the configuration file and to compile a list of required verification procedures. Which procedures are required, depends on the user input.
A specific combination of user input is called an Input Pathway. The currently supported pathways are: 1. land_types as a GeoTif, 1 or more environmental_factors 2. land_types as a GeoTif, no environmental_factors 3. directory with one or more pre-aggregated land_types, 1 or more environmental_factors 4. directory with one or more pre-aggregated land_types, no environmental_factors 5. No land type data, no environmental_factors, one or more HSI rasters in directory
Initialization
- identify(configuration: configparser.ConfigParser)
Examine the contents of the configuration file and add verification procedures as needed. Verification procedures are run on instantiation.
- verify()
Update and check status of all input verification procedures. Output all messages to log. Every time an error is detected in the user input (for example, a file does not exist, or does not have the expected header) a prefect ERROR is raised. If one or more errors where detected, this function raises a RuntimeError to stop flow execution.
- log_messages()
- class mnp.preparation.io_pathways.OutputPathway(configuration: configparser.ConfigParser)
Initialization
Defines which output to make based on the input in ini file
configuration
- mnp.preparation.io_pathways.verify_user_input(configuration: configparser.ConfigParser)
configuration