mnp.preparation.input_verification_functions

Module Contents

Functions

is_geospatial_raster

Is a file a gdal compatible geospatial raster? Parameters ———- file_pathL target file path

path_exists

raster_has_resolution

Check if a raster has target resolution Parameters ———- file_path: target file path target_resolution: expected resolution of the raster

is_directory

Is something a directory? Parameters ———- directory_path: target directory path

directory_contains

Directory contains n or more files matching a glob patter Parameters ———- directory_path: target directory path patter: string pattern to match for n: minimal nr of files

rasters_have_identical_bounds

Verify that all rasters have identical bound Parameters ———- rasters: list with one or more paths to raster files on disk

verify_parameters

Verify parameters in user generated ini file comply to expectatations

csv_is_readable

is_valid_csv

Determine if a file is a valid CSV with contents and corret header Parameters ———- file_path: path to file table_type: table type to deterime required headers

occurs_in_formula

Check if name for environmental variable occurs in at least one species environmental variable formula.

verify_local_distance

Verify that all species local distances are conmensurable with 25m raster resolution Parameters ———- species_traits: path species traits table target_resolution: raster resolution

API

mnp.preparation.input_verification_functions.is_geospatial_raster(file_path: str)

Is a file a gdal compatible geospatial raster? Parameters ———- file_pathL target file path

mnp.preparation.input_verification_functions.path_exists(path)
mnp.preparation.input_verification_functions.raster_has_resolution(file_path: str, target_resolution)

Check if a raster has target resolution Parameters ———- file_path: target file path target_resolution: expected resolution of the raster

mnp.preparation.input_verification_functions.is_directory(directory_path: str)

Is something a directory? Parameters ———- directory_path: target directory path

mnp.preparation.input_verification_functions.directory_contains(directory_path: str, pattern: str, n)

Directory contains n or more files matching a glob patter Parameters ———- directory_path: target directory path patter: string pattern to match for n: minimal nr of files

mnp.preparation.input_verification_functions.rasters_have_identical_bounds(rasters: list)

Verify that all rasters have identical bound Parameters ———- rasters: list with one or more paths to raster files on disk

mnp.preparation.input_verification_functions.verify_parameters(configuration: configparser.ConfigParser)

Verify parameters in user generated ini file comply to expectatations

configuration: output from read_ini

boolean, msg

mnp.preparation.input_verification_functions.csv_is_readable(file_path: str) bool
mnp.preparation.input_verification_functions.is_valid_csv(file_path: str, table_type: str)

Determine if a file is a valid CSV with contents and corret header Parameters ———- file_path: path to file table_type: table type to deterime required headers

mnp.preparation.input_verification_functions.occurs_in_formula(name: str, species_traits: str)

Check if name for environmental variable occurs in at least one species environmental variable formula.

name: str

name for this environmental variable

species_traits: str

path to species traits csv file

out: bool

boolean indicating status

msg: str

message specifying status

mnp.preparation.input_verification_functions.verify_local_distance(species_traits: str, target_resolution: int)

Verify that all species local distances are conmensurable with 25m raster resolution Parameters ———- species_traits: path species traits table target_resolution: raster resolution