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 # Optional input when having Ukraine (UA) or Moldova (MD) in the countries list
if {"UA", "MD"}.intersection(set(config["countries"])): def input_ua_md_availability_matrix(w):
opt = { countries = set(config_provider("countries")(w))
if {"UA", "MD"}.intersection(countries):
return {
"availability_matrix_MD_UA": resources( "availability_matrix_MD_UA": resources(
"availability_matrix_MD-UA_{technology}.nc" "availability_matrix_MD-UA_{technology}.nc"
) )
} }
else: return {}
opt = {}
rule build_renewable_profiles: rule build_renewable_profiles:
@ -265,7 +266,7 @@ rule build_renewable_profiles:
snapshots=config_provider("snapshots"), snapshots=config_provider("snapshots"),
renewable=config_provider("renewable"), renewable=config_provider("renewable"),
input: input:
**opt, unpack(input_ua_md_availability_matrix),
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: (
@ -359,8 +360,6 @@ rule build_hydro_profile:
"../scripts/build_hydro_profile.py" "../scripts/build_hydro_profile.py"
if config["lines"]["dynamic_line_rating"]["activate"]:
rule build_line_rating: rule build_line_rating:
params: params:
snapshots=config_provider("snapshots"), snapshots=config_provider("snapshots"),
@ -420,7 +419,7 @@ rule add_electricity:
if config_provider("lines", "dynamic_line_rating", "activate")(w) if config_provider("lines", "dynamic_line_rating", "activate")(w)
else resources("networks/base.nc") 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"), regions=resources("regions_onshore.geojson"),
powerplants=resources("powerplants.csv"), powerplants=resources("powerplants.csv"),
hydro_capacities=ancient("data/bundle/hydro_capacities.csv"), hydro_capacities=ancient("data/bundle/hydro_capacities.csv"),
@ -463,7 +462,7 @@ rule simplify_network:
costs=config_provider("costs"), costs=config_provider("costs"),
input: input:
network=resources("networks/elec.nc"), 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_onshore=resources("regions_onshore.geojson"),
regions_offshore=resources("regions_offshore.geojson"), regions_offshore=resources("regions_offshore.geojson"),
output: output:
@ -510,7 +509,7 @@ rule cluster_network:
if config_provider("enable", "custom_busmap", default=False)(w) if config_provider("enable", "custom_busmap", default=False)(w)
else [] else []
), ),
tech_costs=resources(f"costs_{config['costs']['year']}.csv"), tech_costs=resources(f"costs_{config_provider('costs', 'year')(w)}.csv"),
output: output:
network=resources("networks/elec_s{simpl}_{clusters}.nc"), network=resources("networks/elec_s{simpl}_{clusters}.nc"),
regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"), regions_onshore=resources("regions_onshore_elec_s{simpl}_{clusters}.geojson"),
@ -537,7 +536,7 @@ rule add_extra_components:
costs=config_provider("costs"), costs=config_provider("costs"),
input: input:
network=resources("networks/elec_s{simpl}_{clusters}.nc"), 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: output:
resources("networks/elec_s{simpl}_{clusters}_ec.nc"), resources("networks/elec_s{simpl}_{clusters}_ec.nc"),
log: log:
@ -569,7 +568,7 @@ rule prepare_network:
autarky=config_provider("electricity", "autarky", default={}), autarky=config_provider("electricity", "autarky", default={}),
input: input:
resources("networks/elec_s{simpl}_{clusters}_ec.nc"), 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 [], co2_price=lambda w: resources("co2_price.csv") if "Ept" in w.opts else [],
output: output:
resources("networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc"), 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: rule build_industry_sector_ratios_intermediate:
params: params:
industry=config["industry"], industry=config_provider("industry"),
input: input:
industry_sector_ratios=RESOURCES + "industry_sector_ratios.csv", industry_sector_ratios=resources("industry_sector_ratios.csv"),
industrial_energy_demand_per_country_today=RESOURCES industrial_energy_demand_per_country_today=resources(
+ "industrial_energy_demand_per_country_today.csv", "industrial_energy_demand_per_country_today.csv"
industrial_production_per_country=RESOURCES ),
+ "industrial_production_per_country.csv", industrial_production_per_country=resources(
"industrial_production_per_country.csv"
),
output: output:
industry_sector_ratios=RESOURCES industry_sector_ratios=resources(
+ "industry_sector_ratios_{planning_horizons}.csv", "industry_sector_ratios_{planning_horizons}.csv"
),
threads: 1 threads: 1
resources: resources:
mem_mb=1000, mem_mb=1000,
log: log:
LOGS + "build_industry_sector_ratios_{planning_horizons}.log", logs("build_industry_sector_ratios_{planning_horizons}.log"),
benchmark: benchmark:
BENCHMARKS + "build_industry_sector_ratios_{planning_horizons}" benchmarks("build_industry_sector_ratios_{planning_horizons}")
conda: conda:
"../envs/environment.yaml" "../envs/environment.yaml"
script: script:
@ -571,7 +574,9 @@ rule build_industrial_production_per_node:
rule build_industrial_energy_demand_per_node: rule build_industrial_energy_demand_per_node:
input: 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_per_node=resources(
"industrial_production_elec_s{simpl}_{clusters}_{planning_horizons}.csv" "industrial_production_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
), ),

View File

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

View File

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

View File

@ -58,14 +58,14 @@ def input_network_year(w):
rule prepare_perfect_foresight: rule prepare_perfect_foresight:
params: params:
costs=config["costs"], costs=config_provider("costs"),
input: input:
unpack(input_network_year), unpack(input_network_year),
brownfield_network=lambda w: ( brownfield_network=lambda w: (
RESULTS RESULTS
+ "prenetworks-brownfield/" + "prenetworks-brownfield/"
+ "elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_" + "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: output:
RESULTS RESULTS