Merge branch 'wildcard-opts-config' of github.com:PyPSA/pypsa-eur into wildcard-opts-config
This commit is contained in:
commit
502b3a61ba
@ -21,9 +21,9 @@ if config["enable"].get("prepare_links_p_nom", False):
|
|||||||
rule build_electricity_demand:
|
rule build_electricity_demand:
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
countries=config["countries"],
|
countries=config["countries"],
|
||||||
load=config["load"],
|
load=config["load"],
|
||||||
@ -66,9 +66,9 @@ rule base_network:
|
|||||||
params:
|
params:
|
||||||
countries=config["countries"],
|
countries=config["countries"],
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
lines=config["lines"],
|
lines=config["lines"],
|
||||||
links=config["links"],
|
links=config["links"],
|
||||||
@ -153,9 +153,9 @@ if config["enable"].get("build_cutout", False):
|
|||||||
rule build_cutout:
|
rule build_cutout:
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
cutouts=config["atlite"]["cutouts"],
|
cutouts=config["atlite"]["cutouts"],
|
||||||
input:
|
input:
|
||||||
@ -483,8 +483,8 @@ rule add_extra_components:
|
|||||||
rule prepare_network:
|
rule prepare_network:
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"resolution":config["snapshots"].get("resolution", False),
|
"resolution": config["snapshots"].get("resolution", False),
|
||||||
"segmentation":config["snapshots"].get("segmentation", False),
|
"segmentation": config["snapshots"].get("segmentation", False),
|
||||||
},
|
},
|
||||||
links=config["links"],
|
links=config["links"],
|
||||||
lines=config["lines"],
|
lines=config["lines"],
|
||||||
|
@ -142,9 +142,9 @@ if not (config["sector"]["gas_network"] or config["sector"]["H2_retrofit"]):
|
|||||||
rule build_heat_demands:
|
rule build_heat_demands:
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
input:
|
input:
|
||||||
pop_layout=RESOURCES + "pop_layout_{scope}.nc",
|
pop_layout=RESOURCES + "pop_layout_{scope}.nc",
|
||||||
@ -168,9 +168,9 @@ rule build_heat_demands:
|
|||||||
rule build_temperature_profiles:
|
rule build_temperature_profiles:
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
input:
|
input:
|
||||||
pop_layout=RESOURCES + "pop_layout_{scope}.nc",
|
pop_layout=RESOURCES + "pop_layout_{scope}.nc",
|
||||||
@ -224,9 +224,9 @@ rule build_cop_profiles:
|
|||||||
rule build_solar_thermal_profiles:
|
rule build_solar_thermal_profiles:
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
solar_thermal=config["solar_thermal"],
|
solar_thermal=config["solar_thermal"],
|
||||||
input:
|
input:
|
||||||
@ -690,9 +690,9 @@ rule build_shipping_demand:
|
|||||||
rule build_transport_demand:
|
rule build_transport_demand:
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
sector=config["sector"],
|
sector=config["sector"],
|
||||||
input:
|
input:
|
||||||
|
@ -56,9 +56,9 @@ rule make_summary:
|
|||||||
foresight=config["foresight"],
|
foresight=config["foresight"],
|
||||||
costs=config["costs"],
|
costs=config["costs"],
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
scenario=config["scenario"],
|
scenario=config["scenario"],
|
||||||
RDIR=RDIR,
|
RDIR=RDIR,
|
||||||
|
@ -18,9 +18,9 @@ rule build_electricity_production:
|
|||||||
"""
|
"""
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
countries=config["countries"],
|
countries=config["countries"],
|
||||||
output:
|
output:
|
||||||
@ -40,9 +40,9 @@ rule build_cross_border_flows:
|
|||||||
"""
|
"""
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
countries=config["countries"],
|
countries=config["countries"],
|
||||||
input:
|
input:
|
||||||
@ -64,9 +64,9 @@ rule build_electricity_prices:
|
|||||||
"""
|
"""
|
||||||
params:
|
params:
|
||||||
snapshots={
|
snapshots={
|
||||||
"start":config["snapshots"]["start"],
|
"start": config["snapshots"]["start"],
|
||||||
"end":config["snapshots"]["end"],
|
"end": config["snapshots"]["end"],
|
||||||
"inclusive":config["snapshots"]["inclusive"],
|
"inclusive": config["snapshots"]["inclusive"],
|
||||||
},
|
},
|
||||||
countries=config["countries"],
|
countries=config["countries"],
|
||||||
output:
|
output:
|
||||||
|
@ -312,14 +312,14 @@ if __name__ == "__main__":
|
|||||||
set_line_s_max_pu(n, snakemake.params.lines["s_max_pu"])
|
set_line_s_max_pu(n, snakemake.params.lines["s_max_pu"])
|
||||||
|
|
||||||
# temporal averaging
|
# temporal averaging
|
||||||
nhours_config = snakemake.params.snapshots.get("resolution",False)
|
nhours_config = snakemake.params.snapshots.get("resolution", False)
|
||||||
nhours_wildcard = get_opt(opts, r"^\d+h$")
|
nhours_wildcard = get_opt(opts, r"^\d+h$")
|
||||||
if nhours_wildcard is not None or isinstance(nhours_config, str):
|
if nhours_wildcard is not None or isinstance(nhours_config, str):
|
||||||
nhours = nhours_wildcard or nhours_config
|
nhours = nhours_wildcard or nhours_config
|
||||||
n = average_every_nhours(n, nhours)
|
n = average_every_nhours(n, nhours)
|
||||||
|
|
||||||
# segments with package tsam
|
# segments with package tsam
|
||||||
time_seg_config = snakemake.params.snapshots.get("segmentation",False)
|
time_seg_config = snakemake.params.snapshots.get("segmentation", False)
|
||||||
time_seg_wildcard = get_opt(opts, r"^\d+seg$")
|
time_seg_wildcard = get_opt(opts, r"^\d+seg$")
|
||||||
if time_seg_wildcard is not None or isinstance(time_seg_config, str):
|
if time_seg_wildcard is not None or isinstance(time_seg_config, str):
|
||||||
time_seg = time_seg_wildcard or time_seg_config
|
time_seg = time_seg_wildcard or time_seg_config
|
||||||
@ -375,7 +375,9 @@ if __name__ == "__main__":
|
|||||||
sel = c.df.carrier.str.contains(carrier)
|
sel = c.df.carrier.str.contains(carrier)
|
||||||
c.df.loc[sel, attr] *= factor
|
c.df.loc[sel, attr] *= factor
|
||||||
|
|
||||||
Ept_config = snakemake.params.costs["emission_prices"].get("co2_monthly_prices", False)
|
Ept_config = snakemake.params.costs["emission_prices"].get(
|
||||||
|
"co2_monthly_prices", False
|
||||||
|
)
|
||||||
for o in opts:
|
for o in opts:
|
||||||
if "Ept" in o or Ept_config:
|
if "Ept" in o or Ept_config:
|
||||||
logger.info(
|
logger.info(
|
||||||
@ -392,7 +394,9 @@ if __name__ == "__main__":
|
|||||||
add_emission_prices(n, dict(co2=co2_wildcard))
|
add_emission_prices(n, dict(co2=co2_wildcard))
|
||||||
else:
|
else:
|
||||||
logger.info("Setting CO2 prices according to config value.")
|
logger.info("Setting CO2 prices according to config value.")
|
||||||
add_emission_prices(n, dict(co2=snakemake.params.costs["emission_prices"]["co2"]))
|
add_emission_prices(
|
||||||
|
n, dict(co2=snakemake.params.costs["emission_prices"]["co2"])
|
||||||
|
)
|
||||||
|
|
||||||
ll_type, factor = snakemake.wildcards.ll[0], snakemake.wildcards.ll[1:]
|
ll_type, factor = snakemake.wildcards.ll[0], snakemake.wildcards.ll[1:]
|
||||||
set_transmission_limit(n, ll_type, factor, costs, Nyears)
|
set_transmission_limit(n, ll_type, factor, costs, Nyears)
|
||||||
|
Loading…
Reference in New Issue
Block a user