diff --git a/rules/build_electricity.smk b/rules/build_electricity.smk index f3819230..a94c29f5 100644 --- a/rules/build_electricity.smk +++ b/rules/build_electricity.smk @@ -205,24 +205,31 @@ rule build_ship_raster: rule determine_availability_matrix_MD_UA: input: - copernicus=RESOURCES + "Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif", - gebco=lambda w: ("data/bundle/GEBCO_2014_2D.nc" - if "max_depth" in config["renewable"][w.technology].keys() - else []), - country_shapes=RESOURCES + 'country_shapes.geojson', - offshore_shapes=RESOURCES + 'offshore_shapes.geojson', - regions=lambda w: (RESOURCES + "regions_onshore.geojson" - if w.technology in ('onwind', 'solar') - else RESOURCES + "regions_offshore.geojson"), - cutout=lambda w: "cutouts/" + CDIR + config["renewable"][w.technology]['cutout'] + ".nc" + copernicus=RESOURCES + + "Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif", + gebco=lambda w: ( + "data/bundle/GEBCO_2014_2D.nc" + if "max_depth" in config["renewable"][w.technology].keys() + else [] + ), + country_shapes=RESOURCES + "country_shapes.geojson", + offshore_shapes=RESOURCES + "offshore_shapes.geojson", + regions=lambda w: ( + RESOURCES + "regions_onshore.geojson" + if w.technology in ("onwind", "solar") + else RESOURCES + "regions_offshore.geojson" + ), + cutout=lambda w: "cutouts/" + + CDIR + + config["renewable"][w.technology]["cutout"] + + ".nc", output: availability_matrix=RESOURCES + "availability_matrix_MD-UA_{technology}.nc", log: LOGS + "determine_availability_matrix_MD_UA_{technology}.log", - threads: - ATLITE_NPROCESSES + threads: ATLITE_NPROCESSES resources: - mem_mb=ATLITE_NPROCESSES * 5000 + mem_mb=ATLITE_NPROCESSES * 5000, conda: "../envs/environment.yaml" script: @@ -232,7 +239,8 @@ rule determine_availability_matrix_MD_UA: # Optional input when having Ukraine (UA) or Moldova (MD) in the countries list if {"UA", "MD"}.intersection(set(config["countries"])): opt = { - "availability_matrix_MD_UA": RESOURCES + "availability_matrix_MD-UA_{technology}.nc" + "availability_matrix_MD_UA": RESOURCES + + "availability_matrix_MD-UA_{technology}.nc" } else: opt = {} @@ -242,6 +250,7 @@ rule build_renewable_profiles: params: renewable=config["renewable"], input: + **opt, base_network=RESOURCES + "networks/base.nc", corine=ancient("data/bundle/corine/g250_clc06_V18_5.tif"), natura=lambda w: ( @@ -272,7 +281,6 @@ rule build_renewable_profiles: + CDIR + config["renewable"][w.technology]["cutout"] + ".nc", - **opt output: profile=RESOURCES + "profile_{technology}.nc", log: @@ -365,7 +373,7 @@ rule add_electricity: geth_hydro_capacities="data/geth2015_hydro_capacities.csv", load=RESOURCES + "load.csv", nuts3_shapes=RESOURCES + "nuts3_shapes.geojson", - ua_md_gdp='data/GDP_PPP_30arcsec_v3_mapped_default.csv', + ua_md_gdp="data/GDP_PPP_30arcsec_v3_mapped_default.csv", output: RESOURCES + "networks/elec.nc", log: diff --git a/rules/retrieve.smk b/rules/retrieve.smk index 31a84edb..9e572a14 100644 --- a/rules/retrieve.smk +++ b/rules/retrieve.smk @@ -205,4 +205,3 @@ if config["enable"]["retrieve"]: output: RESOURCES + "Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif", run: move(input[0], output[0]) - diff --git a/scripts/determine_availability_matrix_MD_UA.py b/scripts/determine_availability_matrix_MD_UA.py index 037ee196..1e45a176 100644 --- a/scripts/determine_availability_matrix_MD_UA.py +++ b/scripts/determine_availability_matrix_MD_UA.py @@ -3,13 +3,13 @@ # # SPDX-License-Identifier: MIT -import geopandas as gpd -import numpy as np import functools -import atlite import logging import time +import atlite +import geopandas as gpd +import numpy as np from _helpers import configure_logging logger = logging.getLogger(__name__)