mnp.preparation.aggregate_land_type_map

Module Contents

Classes

LandTypeMap

Class for holding a land type map.

Functions

aggregate_row

Function that aggregates a row. Is shared between regular and multiprocess. Because of the quirks of multiprocessing casn only take constants from self, input variables that change have to be passed as arguments and output variables have to be returned.

aggregate_land_type_map

Task for aggregating land type map from 2.5 to 25 meter cell size

read_aggregated_map

Read aggregated land types map

Data

LAND_TYPE_WILDCARD

API

mnp.preparation.aggregate_land_type_map.LAND_TYPE_WILDCARD = '*.npz'
mnp.preparation.aggregate_land_type_map.aggregate_row(row_array: numpy.array, row_offset: int, land_types: dict, unrecognized_land_type_ids: set, aggregation_factor: int, nodata_array: numpy.array)

Function that aggregates a row. Is shared between regular and multiprocess. Because of the quirks of multiprocessing casn only take constants from self, input variables that change have to be passed as arguments and output variables have to be returned.

row_array: np.array

Array containing one aggregated row, which using default settings means 10 unaggregated rows, read from unaggregated raster

window: Window

Rasterio read windows that has been used to read unaggregated rows

land_types: dict

Dictionary of land type sparse arrays

unrecognized_land_type_ids:set

Set containing ids for land type values that are in array but not in table.

land_types: dict

The updated land types dictionary

unrecognized_land_type_ids :set

the updated unrecognized land type ids set

class mnp.preparation.aggregate_land_type_map.LandTypeMap(land_type_map_path: str, land_type_map_table_path: str, environmentals_folder: str)

Class for holding a land type map.

land_type_map_path: path to the geospatial tiff with the land types land_type_map_table_path: path to CSV file with legend of land type map

Initialization

make_geospatial_profile(environmentals_folder: str)

Determine the geospatial profile of all subsequent geospatial output.

json written to the cover

save_geospatial_profile(output_folder)

Pickle geospatial profile.

output_folderstr

Folder to dump pickle

aggregate_multiprocess()

Use multiple process to aggregate lt map in parallel and speed up processing.

aggregate()

Aggregate 2.5m management map to 25m, as a dictionary of ManagementType objects that contain the areas of said type in each 25m cell.

More generic: aggregate with aggregation_factor 10.

management_map_aggregateddict

Aggregated management map as a dictionary of ManagementTypes.

save(output_folder: str)

Save this land type map to output folder

output_folder

mnp.preparation.aggregate_land_type_map.aggregate_land_type_map(folders: dict)

Task for aggregating land type map from 2.5 to 25 meter cell size

folders

land_type_map.land_types:dict

dictionary of aggregated land types in sparse array format

mnp.preparation.aggregate_land_type_map.read_aggregated_map(folders: dict) dict[str, scipy.sparse.csr_array]

Read aggregated land types map