[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-05-27 10:23:28 +00:00
parent 1c73bb0342
commit ead87afce1
4 changed files with 37 additions and 19 deletions

View File

@ -7,10 +7,14 @@ rule solve_network:
params:
solving=config["solving"],
config_parts={
"foresight":config["foresight"],
"planning_horizons":config["scenario"]["planning_horizons"],
"co2_sequestration_potential":config["sector"].get("co2_sequestration_potential", 200),
"H2_retrofit_capacity_per_CH4":config["sector"]["H2_retrofit_capacity_per_CH4"]
"foresight": config["foresight"],
"planning_horizons": config["scenario"]["planning_horizons"],
"co2_sequestration_potential": config["sector"].get(
"co2_sequestration_potential", 200
),
"H2_retrofit_capacity_per_CH4": config["sector"][
"H2_retrofit_capacity_per_CH4"
],
},
input:
network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",

View File

@ -85,10 +85,14 @@ rule solve_sector_network_myopic:
params:
solving=config["solving"],
config_parts={
"foresight":config["foresight"],
"planning_horizons":config["scenario"]["planning_horizons"],
"co2_sequestration_potential":config["sector"].get("co2_sequestration_potential", 200),
"H2_retrofit_capacity_per_CH4":config["sector"]["H2_retrofit_capacity_per_CH4"]
"foresight": config["foresight"],
"planning_horizons": config["scenario"]["planning_horizons"],
"co2_sequestration_potential": config["sector"].get(
"co2_sequestration_potential", 200
),
"H2_retrofit_capacity_per_CH4": config["sector"][
"H2_retrofit_capacity_per_CH4"
],
},
input:
overrides="data/override_component_attrs",

View File

@ -7,10 +7,14 @@ rule solve_sector_network:
params:
solving=config["solving"],
config_parts={
"foresight":config["foresight"],
"planning_horizons":config["scenario"]["planning_horizons"],
"co2_sequestration_potential":config["sector"].get("co2_sequestration_potential", 200),
"H2_retrofit_capacity_per_CH4":config["sector"]["H2_retrofit_capacity_per_CH4"]
"foresight": config["foresight"],
"planning_horizons": config["scenario"]["planning_horizons"],
"co2_sequestration_potential": config["sector"].get(
"co2_sequestration_potential", 200
),
"H2_retrofit_capacity_per_CH4": config["sector"][
"H2_retrofit_capacity_per_CH4"
],
},
input:
overrides="data/override_component_attrs",

View File

@ -222,7 +222,7 @@ def add_CCL_constraints(n, config):
agg_p_nom_limits: data/agg_p_nom_minmax.csv
"""
agg_p_nom_minmax = pd.read_csv(
config['electricity']["agg_p_nom_limits"], index_col=[0, 1]
config["electricity"]["agg_p_nom_limits"], index_col=[0, 1]
)
logger.info("Adding generation capacity constraints per carrier and country")
p_nom = n.model["Generator-p_nom"]
@ -370,7 +370,7 @@ def add_SAFE_constraints(n, config):
Which sets a reserve margin of 10% above the peak demand.
"""
peakdemand = n.loads_t.p_set.sum(axis=1).max()
margin = 1.0 + config['electricity']["SAFE_reservemargin"]
margin = 1.0 + config["electricity"]["SAFE_reservemargin"]
reserve_margin = peakdemand * margin
# TODO: do not take this from the plotting config!
conv_techs = config["plotting"]["conv_techs"]
@ -675,10 +675,16 @@ if __name__ == "__main__":
else:
n = pypsa.Network(snakemake.input.network)
n = prepare_network(n, solve_opts, config=snakemake.config, param=snakemake.params["config_parts"])
n = prepare_network(
n, solve_opts, config=snakemake.config, param=snakemake.params["config_parts"]
)
n = solve_network(
n, config=snakemake.config, solving_param=snakemake.params["solving"], opts=opts, log_fn=snakemake.log.solver
n,
config=snakemake.config,
solving_param=snakemake.params["solving"],
opts=opts,
log_fn=snakemake.log.solver,
)
n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards)))