Skip to content

Rule build_natura_raster

Workflow Diagram

See the complete workflow in the repository.

digraph snakemake_dag { graph [bgcolor=white, margin=0, size="8,5" ]; node [fontname=sans, fontsize=10, penwidth=2, shape=box, style=rounded ]; edge [color=grey, penwidth=2 ]; 9 [color="0.22 0.6 0.85", label=build_renewable_profiles]; 12 [color="0.31 0.6 0.85", fillcolor=gray, label=build_natura_raster, style=filled]; 12 -> 9; }

Script Documentation

Converts vectordata or known as shapefiles (i.e. used for geopandas/shapely) to our cutout rasters. The Protected Planet Data <https://www.protectedplanet.net/en/thematic-areas/wdpa?tab=WDPA>_ on protected areas is aggregated to all cutout regions.

Relevant Settings

.. code:: yaml

renewable:
    {technology}:
        cutout:

.. seealso:: Documentation of the configuration file config.yaml at :ref:renewable_cf

Inputs

  • data/landcover/world_protected_areas/*.shp: shapefiles representing the world protected areas, such as the World Database of Protected Areas (WDPA) <https://www.protectedplanet.net/en/thematic-areas/wdpa?tab=WDPA>_.

    .. image:: /img/natura.png :width: 33 %

Outputs

  • resources/natura/natura.tiff: Rasterized version of the world protected areas, such as WDPA <https://www.protectedplanet.net/en/thematic-areas/wdpa?tab=WDPA>_ natural protection areas to reduce computation times.

    .. image:: /img/natura.png :width: 33 %

Description

To operate the script you need all input files.

This script collects all shapefiles available in the folder data/landcover/* describing regions of protected areas, merges them to one shapefile, and create a rasterized version of the region, that covers the region described by the cutout. The output is a raster file with the name natura.tiff in the folder resources/natura/.

get_relevant_regions(country_shapes, offshore_shapes, natura_crs, buffer)

Merge the country_shapes and the offshore_shapes into one GeoDataFrame. Additionally add a buffer to ensure all relevant regions are included.

Returns

regions : GeoDataFrame with a unified "multipolygon"

get_fileshapes(list_paths, accepted_formats=('.shp',))

Function to parse the list of paths to include shapes included in folders, if any

determine_region_xXyY(cutout_name, regions, natura_size, out_logging)

Determine the bounds of the analyzed regions depending on the natura_size parameter. "global" includes the entire world, "cutout" the extend of the cutout, and "countries" only includes the bounds of the requested countries and their offshore regions.

Returns

cutout_xXyY : List including the bounds

decide_bigtiff_flag(out_shape, dtype='uint8', safety_factor=1.1)

Decide whether BIGTIFF should be "YES" or "NO" based on raster shape. BIGTIFF is required for filesizes larger than 4 GB.

Returns

str: "YES" if the estimated size is larger than 4 GB, else "NO".