Merge branch 'ukraine_hackathon' of github.com:PyPSA/pypsa-eur into ukraine_hackathon

This commit is contained in:
Fabian Neumann 2023-08-01 09:10:43 +02:00
commit 4bc60e42e4
3 changed files with 27 additions and 20 deletions

View File

@ -205,24 +205,31 @@ rule build_ship_raster:
rule determine_availability_matrix_MD_UA: rule determine_availability_matrix_MD_UA:
input: input:
copernicus=RESOURCES + "Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif", copernicus=RESOURCES
gebco=lambda w: ("data/bundle/GEBCO_2014_2D.nc" + "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() if "max_depth" in config["renewable"][w.technology].keys()
else []), else []
country_shapes=RESOURCES + 'country_shapes.geojson', ),
offshore_shapes=RESOURCES + 'offshore_shapes.geojson', country_shapes=RESOURCES + "country_shapes.geojson",
regions=lambda w: (RESOURCES + "regions_onshore.geojson" offshore_shapes=RESOURCES + "offshore_shapes.geojson",
if w.technology in ('onwind', 'solar') regions=lambda w: (
else RESOURCES + "regions_offshore.geojson"), RESOURCES + "regions_onshore.geojson"
cutout=lambda w: "cutouts/" + CDIR + config["renewable"][w.technology]['cutout'] + ".nc" if w.technology in ("onwind", "solar")
else RESOURCES + "regions_offshore.geojson"
),
cutout=lambda w: "cutouts/"
+ CDIR
+ config["renewable"][w.technology]["cutout"]
+ ".nc",
output: output:
availability_matrix=RESOURCES + "availability_matrix_MD-UA_{technology}.nc", availability_matrix=RESOURCES + "availability_matrix_MD-UA_{technology}.nc",
log: log:
LOGS + "determine_availability_matrix_MD_UA_{technology}.log", LOGS + "determine_availability_matrix_MD_UA_{technology}.log",
threads: threads: ATLITE_NPROCESSES
ATLITE_NPROCESSES
resources: resources:
mem_mb=ATLITE_NPROCESSES * 5000 mem_mb=ATLITE_NPROCESSES * 5000,
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -232,7 +239,8 @@ rule determine_availability_matrix_MD_UA:
# Optional input when having Ukraine (UA) or Moldova (MD) in the countries list # Optional input when having Ukraine (UA) or Moldova (MD) in the countries list
if {"UA", "MD"}.intersection(set(config["countries"])): if {"UA", "MD"}.intersection(set(config["countries"])):
opt = { opt = {
"availability_matrix_MD_UA": RESOURCES + "availability_matrix_MD-UA_{technology}.nc" "availability_matrix_MD_UA": RESOURCES
+ "availability_matrix_MD-UA_{technology}.nc"
} }
else: else:
opt = {} opt = {}
@ -242,6 +250,7 @@ rule build_renewable_profiles:
params: params:
renewable=config["renewable"], renewable=config["renewable"],
input: input:
**opt,
base_network=RESOURCES + "networks/base.nc", base_network=RESOURCES + "networks/base.nc",
corine=ancient("data/bundle/corine/g250_clc06_V18_5.tif"), corine=ancient("data/bundle/corine/g250_clc06_V18_5.tif"),
natura=lambda w: ( natura=lambda w: (
@ -272,7 +281,6 @@ rule build_renewable_profiles:
+ CDIR + CDIR
+ config["renewable"][w.technology]["cutout"] + config["renewable"][w.technology]["cutout"]
+ ".nc", + ".nc",
**opt
output: output:
profile=RESOURCES + "profile_{technology}.nc", profile=RESOURCES + "profile_{technology}.nc",
log: log:
@ -365,7 +373,7 @@ rule add_electricity:
geth_hydro_capacities="data/geth2015_hydro_capacities.csv", geth_hydro_capacities="data/geth2015_hydro_capacities.csv",
load=RESOURCES + "load.csv", load=RESOURCES + "load.csv",
nuts3_shapes=RESOURCES + "nuts3_shapes.geojson", 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: output:
RESOURCES + "networks/elec.nc", RESOURCES + "networks/elec.nc",
log: log:

View File

@ -205,4 +205,3 @@ if config["enable"]["retrieve"]:
output: output:
RESOURCES + "Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif", RESOURCES + "Copernicus_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif",
run: move(input[0], output[0]) run: move(input[0], output[0])

View File

@ -3,13 +3,13 @@
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
import geopandas as gpd
import numpy as np
import functools import functools
import atlite
import logging import logging
import time import time
import atlite
import geopandas as gpd
import numpy as np
from _helpers import configure_logging from _helpers import configure_logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)