Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 7, 2024
1 parent 82bc3ff commit f81f4ad
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 131 deletions.
8 changes: 6 additions & 2 deletions workflow/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,12 @@ rule modify_prenetwork:
"mobility_demand_aladin_{simpl}_{clusters}_{planning_horizons}.csv"
),
transport_data=resources("transport_data_s{simpl}_{clusters}.csv"),
biomass_potentials=resources("biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv"),
industrial_demand=resources("industrial_energy_demand_elec_s{simpl}_{clusters}_{planning_horizons}.csv"),
biomass_potentials=resources(
"biomass_potentials_s{simpl}_{clusters}_{planning_horizons}.csv"
),
industrial_demand=resources(
"industrial_energy_demand_elec_s{simpl}_{clusters}_{planning_horizons}.csv"
),
output:
network=RESULTS
+ "prenetworks-final/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
Expand Down
49 changes: 35 additions & 14 deletions workflow/scripts/additional_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,25 +378,34 @@ def add_co2limit_country(n, limit_countries, snakemake, debug=False):
)

lhs.append(
(n.model["Link-p"].loc[:, outgoing_methanol]
/ snakemake.config["sector"]["MWh_MeOH_per_tCO2"]
* n.snapshot_weightings.generators).sum())

(
n.model["Link-p"].loc[:, outgoing_methanol]
/ snakemake.config["sector"]["MWh_MeOH_per_tCO2"]
* n.snapshot_weightings.generators
).sum()
)

# Methane
incoming_CH4 = n.links.index[n.links.index == "EU renewable gas -> DE gas"]
outgoing_CH4 = n.links.index[n.links.index == "DE renewable gas -> EU gas"]

lhs.append(
(-1 * n.model["Link-p"].loc[:, incoming_CH4]
* 0.198
* n.snapshot_weightings.generators).sum())

(
-1
* n.model["Link-p"].loc[:, incoming_CH4]
* 0.198
* n.snapshot_weightings.generators
).sum()
)

lhs.append(
(n.model["Link-p"].loc[:, outgoing_CH4]
* 0.198
* n.snapshot_weightings.generators).sum())
(
n.model["Link-p"].loc[:, outgoing_CH4]
* 0.198
* n.snapshot_weightings.generators
).sum()
)


lhs = sum(lhs)

cname = f"co2_limit-{ct}"
Expand Down Expand Up @@ -516,8 +525,20 @@ def add_h2_derivate_limit(n, investment_year, limits_volume_max):

logger.info(f"limiting H2 derivate imports in {ct} to {limit/1e6} TWh/a")

incoming = n.links.loc[["EU renewable oil -> DE oil", "EU methanol -> DE methanol", "EU renewable gas -> DE gas"]].index
outgoing = n.links.loc[["DE renewable oil -> EU oil", "DE methanol -> EU methanol", "DE renewable gas -> EU gas"]].index
incoming = n.links.loc[
[
"EU renewable oil -> DE oil",
"EU methanol -> DE methanol",
"EU renewable gas -> DE gas",
]
].index
outgoing = n.links.loc[
[
"DE renewable oil -> EU oil",
"DE methanol -> EU methanol",
"DE renewable gas -> EU gas",
]
].index

incoming_p = (
n.model["Link-p"].loc[:, incoming] * n.snapshot_weightings.generators
Expand Down
Loading

0 comments on commit f81f4ad

Please sign in to comment.