further adjustments to latest master branch commits

This commit is contained in:
Fabian Neumann 2024-02-17 17:38:46 +01:00
parent 35b2228891
commit 89d0fa24b6
5 changed files with 61 additions and 54 deletions

View File

@ -250,14 +250,15 @@ 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"
)
}
else:
opt = {}
def input_ua_md_availability_matrix(w):
countries = set(config_provider("countries")(w))
if {"UA", "MD"}.intersection(countries):
return {
"availability_matrix_MD_UA": resources(
"availability_matrix_MD-UA_{technology}.nc"
)
}
return {}
rule build_renewable_profiles:
@ -265,7 +266,7 @@ rule build_renewable_profiles:
snapshots=config_provider("snapshots"),
renewable=config_provider("renewable"),
input:
**opt,
unpack(input_ua_md_availability_matrix),
base_network=resources("networks/base.nc"),
corine=ancient("data/bundle/corine/g250_clc06_V18_5.tif"),
natura=lambda w: (
@ -359,30 +360,28 @@ rule build_hydro_profile:
"../scripts/build_hydro_profile.py"
if config["lines"]["dynamic_line_rating"]["activate"]:
rule build_line_rating:
params:
snapshots=config_provider("snapshots"),
input:
base_network=resources("networks/base.nc"),
cutout="cutouts/"
+ CDIR
+ config_provider("lines", "dynamic_line_rating", "cutout")
+ ".nc",
output:
output=resources("networks/line_rating.nc"),
log:
logs("build_line_rating.log"),
benchmark:
benchmarks("build_line_rating")
threads: config["atlite"].get("nprocesses", 4)
resources:
mem_mb=config["atlite"].get("nprocesses", 4) * 1000,
conda:
"../envs/environment.yaml"
script:
"../scripts/build_line_rating.py"
rule build_line_rating:
params:
snapshots=config_provider("snapshots"),
input:
base_network=resources("networks/base.nc"),
cutout="cutouts/"
+ CDIR
+ config_provider("lines", "dynamic_line_rating", "cutout")
+ ".nc",
output:
output=resources("networks/line_rating.nc"),
log:
logs("build_line_rating.log"),
benchmark:
benchmarks("build_line_rating")
threads: config["atlite"].get("nprocesses", 4)
resources:
mem_mb=config["atlite"].get("nprocesses", 4) * 1000,
conda:
"../envs/environment.yaml"
script:
"../scripts/build_line_rating.py"
def input_profile_tech(w):
@ -420,7 +419,7 @@ rule add_electricity:
if config_provider("lines", "dynamic_line_rating", "activate")(w)
else resources("networks/base.nc")
),
tech_costs=resources(f"costs_{config['costs']['year']}.csv"),
tech_costs=resources(f"costs_{config_provider('costs', 'year')(w)}.csv"),
regions=resources("regions_onshore.geojson"),
powerplants=resources("powerplants.csv"),
hydro_capacities=ancient("data/bundle/hydro_capacities.csv"),
@ -463,7 +462,7 @@ rule simplify_network:
costs=config_provider("costs"),
input:
network=resources("networks/elec.nc"),
tech_costs=resources(f"costs_{config['costs']['year']}.csv"),
tech_costs=resources(f"costs_{config_provider('costs', 'year')(w)}.csv"),
regions_onshore=resources("regions_onshore.geojson"),
regions_offshore=resources("regions_offshore.geojson"),
output:
@ -510,7 +509,7 @@ rule cluster_network:
if config_provider("enable", "custom_busmap", default=False)(w)
else []
),
tech_costs=resources(f"costs_{config['costs']['year']}.csv"),
tech_costs=resources(f"costs_{config_provider('costs', 'year')(w)}.csv"),
output:
network=resources("networks/elec_s{simpl}_{clusters}.nc"),
regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
@ -537,7 +536,7 @@ rule add_extra_components:
costs=config_provider("costs"),
input:
network=resources("networks/elec_s{simpl}_{clusters}.nc"),
tech_costs=resources(f"costs_{config['costs']['year']}.csv"),
tech_costs=resources(f"costs_{config_provider('costs', 'year')(w)}.csv"),
output:
resources("networks/elec_s{simpl}_{clusters}_ec.nc"),
log:
@ -569,7 +568,7 @@ rule prepare_network:
autarky=config_provider("electricity", "autarky", default={}),
input:
resources("networks/elec_s{simpl}_{clusters}_ec.nc"),
tech_costs=resources(f"costs_{config['costs']['year']}.csv"),
tech_costs=resources(f"costs_{config_provider('costs', 'year')(w)}.csv"),
co2_price=lambda w: resources("co2_price.csv") if "Ept" in w.opts else [],
output:
resources("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"),

View File

@ -435,23 +435,26 @@ rule build_industry_sector_ratios:
rule build_industry_sector_ratios_intermediate:
params:
industry=config["industry"],
industry=config_provider("industry"),
input:
industry_sector_ratios=RESOURCES + "industry_sector_ratios.csv",
industrial_energy_demand_per_country_today=RESOURCES
+ "industrial_energy_demand_per_country_today.csv",
industrial_production_per_country=RESOURCES
+ "industrial_production_per_country.csv",
industry_sector_ratios=resources("industry_sector_ratios.csv"),
industrial_energy_demand_per_country_today=resources(
"industrial_energy_demand_per_country_today.csv"
),
industrial_production_per_country=resources(
"industrial_production_per_country.csv"
),
output:
industry_sector_ratios=RESOURCES
+ "industry_sector_ratios_{planning_horizons}.csv",
industry_sector_ratios=resources(
"industry_sector_ratios_{planning_horizons}.csv"
),
threads: 1
resources:
mem_mb=1000,
log:
LOGS + "build_industry_sector_ratios_{planning_horizons}.log",
logs("build_industry_sector_ratios_{planning_horizons}.log"),
benchmark:
BENCHMARKS + "build_industry_sector_ratios_{planning_horizons}"
benchmarks("build_industry_sector_ratios_{planning_horizons}")
conda:
"../envs/environment.yaml"
script:
@ -571,7 +574,9 @@ rule build_industrial_production_per_node:
rule build_industrial_energy_demand_per_node:
input:
industry_sector_ratios=resources("industry_sector_ratios_{planning_horizons}.csv"),
industry_sector_ratios=resources(
"industry_sector_ratios_{planning_horizons}.csv"
),
industrial_production_per_node=resources(
"industrial_production_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
),

View File

@ -172,9 +172,11 @@ rule make_summary:
costs=lambda w: (
resources("costs_{}.csv".format(config_provider("costs", "year")(w)))
if config_provider("foresight")(w) == "overnight"
else resources("costs_{}.csv".format(
config_provider("scenario", "planning_horizons", 0)
))
else resources(
"costs_{}.csv".format(
config_provider("scenario", "planning_horizons", 0)(w)
)
)
),
ac_plot=expand(
resources("maps/power-network-s{simpl}-{clusters}.pdf"),

View File

@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: MIT
rule solve_network:
params:
solving=config_provider("solving"),

View File

@ -58,14 +58,14 @@ def input_network_year(w):
rule prepare_perfect_foresight:
params:
costs=config["costs"],
costs=config_provider("costs"),
input:
unpack(input_network_year),
brownfield_network=lambda w: (
RESULTS
+ "prenetworks-brownfield/"
+ "elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_"
+ "{}.nc".format(str(config_provider("scenario", "planning_horizons", 0)))
+ "{}.nc".format(str(config_provider("scenario", "planning_horizons", 0)(w)))
),
output:
RESULTS