input_maps.py¶
-
lib.input_maps.downloadGWA(paths, param)¶ This function downloads wind speed data from Global Wind Atlas (www.globalwindatlas.info) if it does not already exist
- Parameters
paths (dict) – Dictionary including the paths.
param (dict) – Dictionary including the user preferences.
- Returns
The wind data is saved directly in the desired paths.
- Return type
None
-
lib.input_maps.generate_area(paths, param)¶ This function retreives the coordinates of the spatial scope and computes the pixel area gradient of the corresponding raster.
- Parameters
paths (dict) – Dictionary of dictionaries containing the path to the output file.
param (dict) – Dictionary of dictionaries containing spatial scope coordinates and desired resolution.
- Returns
The mat file for AREA is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_area_offshore(paths, param)¶ This function retreives the coordinates of the spatial scope and computes the pixel area gradient of the corresponding raster.
- Parameters
paths (dict) – Dictionary of dictionaries containing the path to the output file.
param (dict) – Dictionary of dictionaries containing spatial scope coordinates and desired resolution.
- Returns
The mat file for AREA is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_array_coordinates(paths, param, W50M)¶ ToDo: All of this docstring This function reads the daily NetCDF data (from MERRA-2) for SWGDN, SWTDN, T2M, U50m, and V50m, and saves them in matrices with yearly time series with low spatial resolution. Depending on the MERRA_correction parameter this function will also call clean_weather_data() to remove data outliers. This function has to be run only once.
- Parameters
paths (dict) – Dictionary including the paths to the MERRA-2 input files MERRA_IN, and to the desired output locations for T2M, W50M and CLEARNESS.
param (dict) – Dictionary including the year, the spatial scope, and the MERRA_correction parameter.
- Returns
The files T2M.mat, W50M.mat, and CLEARNESS.mat are saved directly in the defined paths, along with their metadata in JSON files.
- Return type
None
-
lib.input_maps.generate_bathymetry(paths, param)¶ This function reads the global map of bathymetry, resizes it, and creates a raster out of it for the desired scope. The values are in meter (negative in the sea).
- Parameters
paths (dict) – Dictionary including the paths to the global bathymetry raster Bathym_global and to the output path BATH.
param (dict) – Dictionary including the desired resolution, the coordinates of the bounding box of the spatial scope, and the georeference dictionary.
- Returns
The tif file for BATH is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_land(paths, param)¶ This function reads the shapefile of the subregions within the scope, and creates a raster out of it.
- Parameters
paths (dict) – Dictionary including the paths SUB, LAND, EEZ.
param (dict) – Dictionary including the geodataframe of the shapefile, the number of features, the coordinates of the bounding box of the spatial scope, and the number of rows and columns.
- Returns
The tif file for SUB is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_landuse(paths, param)¶ This function reads the global map of land use, and creates a raster out of it for the desired scope. There are 17 discrete possible values from 0 to 16, corresponding to different land use classes. See
config.pyfor more information on the land use map.- Parameters
paths (dict) – Dictionary including the paths to the global land use raster LU_global and to the output path LU.
param (dict) – Dictionary including the desired resolution, the coordinates of the bounding box of the spatial scope, and the georeference dictionary.
- Returns
The tif file for LU is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_livestock(paths, param)¶ This function reads the global maps of each livestock density, resizes it, and creates a raster out of it for the desired scope. The values are in number of animals per sq.km.
- Parameters
paths (dict) – Dictionary including the paths to the global livestock rasters LS_global and to the output path LS.
param (dict) – Dictionary including the desired resolution, the coordinates of the bounding box of the spatial scope, and the georeference dictionary.
- Returns
The tif files for LS is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_maps_for_scope(paths, param, multiprocessing)¶ This function calls the individual functions that generate the maps for the geographic scope.
- Parameters
paths (dict) – Dictionary including the paths.
param (bool) – Dictionary including the user preferences.
multiprocessing – Determines if multiprocessing is applied.
- Returns
The maps are saved directly in the desired paths.
- Return type
None
-
lib.input_maps.generate_osm_areas(paths, param)¶ This function reads the osm land use shapefile, identifies several areas, and excludes pixels around them based on a user-defined buffers buffer_pixel_amount. It creates a masking raster of boolean values (0 or 1) for the scope. Zero means the pixel is excluded, one means it is suitable. The function is useful in case there is a policy to exclude renewable energy projects next to certain type of areas.
- Parameters
paths (dict) – Dictionary including the path to the osm land-use shapefile, and to the output path BUFFER.
param (dict) – Dictionary including the user-defined buffers (buffer_pixel_amount) and the georeference dictionary.
- Returns
The tif file for BUFFER is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_protected_areas(paths, param)¶ This function reads the shapefile of the globally protected areas, adds an attribute whose values are based on the dictionary of conversion (protected_areas) to identify the protection category, then converts the shapefile into a raster for the scope. The values are integers from 0 to 10.
- Parameters
paths (dict) – Dictionary including the paths to the shapefile of the globally protected areas, to the land raster of the scope, and to the output path PA.
param (dict) – Dictionary including the dictionary of conversion of protection categories (protected_areas).
- Returns
The tif file for PA is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_protected_areas_offshore(paths, param)¶ This function reads the shapefile of the globally protected areas, adds an attribute whose values are based on the dictionary of conversion (protected_areas) to identify the protection category, then converts the shapefile into a raster for the scope. The values are integers from 0 to 10.
- Parameters
paths (dict) – Dictionary including the paths to the shapefile of the globally protected areas, to the land raster of the scope, and to the output path PA.
param (dict) – Dictionary including the dictionary of conversion of protection categories (protected_areas).
- Returns
The tif file for PA is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_sea(paths, param)¶ This function reads the shapefiles of the countries (land areas) and of the exclusive economic zones (sea areas) within the scope, and creates two rasters out of them.
- Parameters
paths (dict) – Dictionary including the paths LAND and EEZ.
param (dict) – Dictionary including the geodataframes of the shapefiles, the number of features, the coordinates of the bounding box of the spatial scope, and the number of rows and columns.
- Returns
The tif files for LAND and EEZ are saved in their respective paths, along with their metadata in JSON files.
- Return type
None
-
lib.input_maps.generate_settlements(paths, param)¶ - This function reads the global map of settlements, and creates a raster out of it for the desired scope.
See
config.pyfor more information on the settlements map.
- Parameters
paths (dict) – Dictionary including the paths to the global settlements raster WSF_global and to the output path WSF.
param (dict) – Dictionary including the desired resolution, the coordinates of the bounding box of the spatial scope, and the georeference dictionary.
- Returns
The tif file for WSF is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_slope(paths, param, A_TOPO)¶ This function reads the topography raster for the scope, and creates a raster of slope out of it. The slope is calculated in percentage, although this can be changed easily at the end of the code.
- Parameters
paths (dict) – Dictionary including the paths to the topography map of the scope TOPO and to the output path SLOPE.
param (dict) – Dictionary including the desired resolution, the coordinates of the bounding box of the spatial scope, and the georeference dictionary.
- Returns
The tif file for SLOPE is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_topography(paths, param)¶ This function reads the tiles that make the global map of topography, picks those that lie completely or partially in the scope, and creates a raster out of them for the desired scope. The values are in meter.
- Parameters
paths (dict) – Dictionary including the paths to the tiles of the global topography raster Topo_tiles and to the output path TOPO.
param (dict) – Dictionary including the desired resolution, the coordinates of the bounding box of the spatial scope, and the georeference dictionary.
- Returns
The tif file for TOPO is saved in its respective path, along with its metadata in a JSON file.
- Return type
None
-
lib.input_maps.generate_weather_files(paths, param)¶ This function reads the daily NetCDF data (from MERRA-2) for SWGDN, SWTDN, T2M, U50m, and V50m, and saves them in matrices with yearly time series with low spatial resolution. Depending on the MERRA_correction parameter this function will also call clean_weather_data() to remove data outliers. This function has to be run only once.
- Parameters
paths (dict) – Dictionary including the paths to the MERRA-2 input files MERRA_IN, and to the desired output locations for T2M, W50M and CLEARNESS.
param (dict) – Dictionary including the year, the spatial scope, and the MERRA_correction parameter.
- Returns
The files T2M.mat, W50M.mat, and CLEARNESS.mat are saved directly in the defined paths, along with their metadata in JSON files.
- Return type
None
-
lib.input_maps.generate_weather_offshore_files(paths, param)¶ This function reads the daily NetCDF data (from MERRA-2) for U50m, and V50m, and saves them in matrices with yearly time series with low spatial resolution. Depending on the MERRA_correction parameter this function will also call clean_weather_data() to remove data outliers. This function has to be run only once.
- Parameters
paths (dict) – Dictionary including the paths to the MERRA-2 input files MERRA_IN, and to the desired output locations for T2M, W50M and CLEARNESS.
param (dict) – Dictionary including the year, the spatial scope, and the MERRA_correction parameter.
- Returns
The file W50M.mat is saved directly in the defined paths, along with their metadata in JSON files.
- Return type
None