Skip to content

Commit

Permalink
fix gas clustering when interest_area
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosEpia committed Apr 1, 2024
1 parent d05e051 commit 8704ea1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions etrago/cluster/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,12 @@ def get_h2_clusters(etrago, busmap_ch4):
to its corresponding cluster ID.
"""
# Mapping of H2 buses to new CH4 cluster IDs
map_ch4_h2 = etrago.ch4_h2_mapping[
etrago.ch4_h2_mapping.index.isin(busmap_ch4.index)
]
busmap_h2 = pd.Series(
busmap_ch4.loc[etrago.ch4_h2_mapping.index].values,
index=etrago.ch4_h2_mapping.values,
busmap_ch4.loc[map_ch4_h2.index].values,
index=map_ch4_h2.values,
)

# Create unique H2 cluster IDs
Expand Down Expand Up @@ -368,13 +371,13 @@ def gas_postprocessing(
+ "_result.csv"
)

if "H2_grid" in etrago.network.buses.carrier.unique():
busmap = get_h2_clusters(etrago, busmap)

if len(busmap_area) > 0:
for bus_area in busmap_area.values:
busmap[bus_area] = bus_area

if "H2_grid" in etrago.network.buses.carrier.unique():
busmap = get_h2_clusters(etrago, busmap)

# Add all other buses to busmap
missing_idx = list(
etrago.network.buses[
Expand Down

0 comments on commit 8704ea1

Please sign in to comment.