Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion INTERFACE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ pathvars:
WDPA protected areas database from https://www.protectedplanet.net/ in GeoDB format (choose 'File Geodatabase' when downloading).
results:
area_potential:
default: "<results>/{shape}/area_potential_{tech}.tif"
default: "<results>/{shape}/{scenario}/area_potential_{tech}.tif"
description: "Area potential GeoTIFF raster for the specified technology across all subunits."
wildcards:
shape: "Name of the shape to be processed, e.g., 'world', 'europe', 'MEX'."
tech: "Name of the technology, e.g., 'pv_rooftop' or 'wind_offshore'. Available technologies are defined in the module configuration."
scenario: "Scenario name from the module configuration."
170 changes: 87 additions & 83 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,91 @@ split_by: country_id # likely country_id or shape_id

# Optional - specify land_cover_types here to override the internal defaults.

techs:
pv_rooftop:
initial_area: settlement_area
continuous_layers:
settlement_share:
min: 0.01
max: 1
share: 0.8
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
# Include all land cover types; selection is done by settlement_share
landcover_FARM: 1
landcover_FOREST: 1
landcover_URBAN: 1
landcover_OTHER: 1
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
pv_open_field:
initial_area: pixel_area
continuous_layers:
slope:
min: 0
max: 3
settlement_share:
min: 0
max: 0.01
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
landcover_FARM: 0.1
landcover_FOREST: 0
landcover_URBAN: 0
landcover_OTHER: 0.2
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
wind_onshore:
initial_area: pixel_area
continuous_layers:
slope:
min: 0
max: 20
settlement_share:
min: 0
max: 0.01
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
landcover_FARM: 0.2
landcover_FOREST: 0.05
landcover_URBAN: 0
landcover_OTHER: 0.3
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
wind_offshore:
initial_area: pixel_area
continuous_layers:
bathymetry:
min: -50
max: 0
share: 0.8
binary_layers:
regions_land: 0
regions_maritime: 1
protected: 0
shapes_buffer:
land: 10000 # meters
scenarios:
# Define at least one scenario. Multiple scenarios can be used to study
# the effect of different assumptions on the results.
base:
techs:
pv_rooftop:
initial_area: settlement_area
continuous_layers:
settlement_share:
min: 0.01
max: 1
share: 0.8
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
# Include all land cover types; selection is done by settlement_share
landcover_FARM: 1
landcover_FOREST: 1
landcover_URBAN: 1
landcover_OTHER: 1
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
pv_open_field:
initial_area: pixel_area
continuous_layers:
slope:
min: 0
max: 3
settlement_share:
min: 0
max: 0.01
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
landcover_FARM: 0.1
landcover_FOREST: 0
landcover_URBAN: 0
landcover_OTHER: 0.2
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
wind_onshore:
initial_area: pixel_area
continuous_layers:
slope:
min: 0
max: 20
settlement_share:
min: 0
max: 0.01
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
landcover_FARM: 0.2
landcover_FOREST: 0.05
landcover_URBAN: 0
landcover_OTHER: 0.3
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
wind_offshore:
initial_area: pixel_area
continuous_layers:
bathymetry:
min: -50
max: 0
share: 0.8
binary_layers:
regions_land: 0
regions_maritime: 1
protected: 0
shapes_buffer:
land: 10000 # meters

# Optional: override settings for specific subunits (countries, regions, etc.)
# This allows you to set specific parameters that differ from the defaults,
# or apply settings that are not defined in the defaults (defaults = `techs` section).
# The subunit keys should match the subunit IDs used in column selected in `split_by`.
overrides:
PRT: # Inside a subunit, any setting from `techs` can be overridden
wind_offshore:
shapes_buffer:
land: 2000 # meters
NLD:
wind_offshore:
shapes_buffer:
land: 22000 # 22 km = 12 nautical miles
# Optional: override settings for specific subunits (countries, regions, etc.)
# This allows you to set specific parameters that differ from the defaults,
# or apply settings that are not defined in the defaults (defaults = `techs` section).
# The subunit keys should match the subunit IDs used in column selected in `split_by`.
overrides:
PRT: # Inside a subunit, any setting from `techs` can be overridden
wind_offshore:
shapes_buffer:
land: 2000 # meters
NLD:
wind_offshore:
shapes_buffer:
land: 22000 # 22 km = 12 nautical miles
4 changes: 2 additions & 2 deletions tests/integration/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module module_area_potentials:
shapes="resources/inputs/shapes/{shape}.parquet",
wdpa="resources/inputs/wdpa.gdb",
# Redirect specific module results (outputs)
area_potential="results/outputs/{shape}/area_potential_{tech}.tif",
area_potential="results/outputs/{shape}/{scenario}/area_potential_{tech}.tif",
# Redirect module intermediate files
logs="resources/module/logs",
resources="resources/module/resources",
Expand All @@ -80,6 +80,6 @@ rule all:
default_target: True
input:
# The report file requires all area potential output files
"resources/module/results/NLD/area_potential_report.html",
"resources/module/results/NLD/base/area_potential_report.html",
message:
"Run the module for the Netherlands shapes."
142 changes: 72 additions & 70 deletions tests/integration/test_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,75 @@ module_area_potentials:
tiny_files: True
buffer_crs: "epsg:8857"
split_by: country_id
techs:
pv_rooftop:
initial_area: settlement_area
continuous_layers:
settlement_share:
min: 0.01
max: 1
share: 0.8
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
# Include all land cover types; selection is done by settlement_share
landcover_FARM: 1
landcover_FOREST: 1
landcover_URBAN: 1
landcover_OTHER: 1
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
pv_open_field:
initial_area: pixel_area
continuous_layers:
slope:
min: 0
max: 3
settlement_share:
min: 0
max: 0.01
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
landcover_FARM: 0.1
landcover_FOREST: 0
landcover_URBAN: 0
landcover_OTHER: 0.2
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
wind_onshore:
initial_area: pixel_area
continuous_layers:
slope:
min: 0
max: 20
settlement_share:
min: 0
max: 0.01
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
landcover_FARM: 0.2
landcover_FOREST: 0.05
landcover_URBAN: 0
landcover_OTHER: 0.3
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
wind_offshore:
initial_area: pixel_area
continuous_layers:
bathymetry:
min: -50
max: 0
share: 0.8
binary_layers:
regions_land: 0
regions_maritime: 1
protected: 0
shapes_buffer:
land: 10000 # meters
scenarios:
base:
techs:
pv_rooftop:
initial_area: settlement_area
continuous_layers:
settlement_share:
min: 0.01
max: 1
share: 0.8
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
# Include all land cover types; selection is done by settlement_share
landcover_FARM: 1
landcover_FOREST: 1
landcover_URBAN: 1
landcover_OTHER: 1
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
pv_open_field:
initial_area: pixel_area
continuous_layers:
slope:
min: 0
max: 3
settlement_share:
min: 0
max: 0.01
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
landcover_FARM: 0.1
landcover_FOREST: 0
landcover_URBAN: 0
landcover_OTHER: 0.2
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
wind_onshore:
initial_area: pixel_area
continuous_layers:
slope:
min: 0
max: 20
settlement_share:
min: 0
max: 0.01
binary_layers:
regions_maritime: 0
regions_land: 1
protected: 0
landcover_FARM: 0.2
landcover_FOREST: 0.05
landcover_URBAN: 0
landcover_OTHER: 0.3
landcover_NOT_SUITABLE: 0
landcover_WATER: 0
wind_offshore:
initial_area: pixel_area
continuous_layers:
bathymetry:
min: -50
max: 0
share: 0.8
binary_layers:
regions_land: 0
regions_maritime: 1
protected: 0
shapes_buffer:
land: 10000 # meters
11 changes: 9 additions & 2 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pathvars:
shapes="<resources>/user/shapes/{shape}.parquet",
wdpa="<resources>/user/wdpa.gdb",
# Module results
area_potential="<results>/{shape}/area_potential_{tech}.tif",
area_potential="<results>/{shape}/{scenario}/area_potential_{tech}.tif",


# Load the example configuration. This will be overridden by users.
Expand All @@ -36,7 +36,14 @@ workflow.source_path("scripts/_script_utils.py")
wildcard_constraints:
shape="[a-zA-Z0-9_-]+",
subunit="[a-zA-Z0-9_]+",
tech="|".join(config["techs"].keys()),
scenario="|".join(config["scenarios"].keys()),
tech="|".join(
[
tech
for scenario in config["scenarios"]
for tech in config["scenarios"][scenario]["techs"]
]
),


# Add all your includes here.
Expand Down
14 changes: 11 additions & 3 deletions workflow/internal/config.schema.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
$schema: "https://json-schema.org/draft/2020-12/schema"
description: "Schema for user-provided configuration files."
type: object
additionalProperties: false
properties:

$defs:
tiny_files:
type: boolean
description: "If True, use smaller, clipped files for processing. If False, use full global datasets."
Expand Down Expand Up @@ -52,3 +51,12 @@ properties:
type: object
additionalProperties:
type: object

scenarios:
type: object
required:
- techs
additionalProperties: false
properties:
techs:
$ref: "#/$defs/techs"
Loading
Loading