cluster_gas_network: generalise so it can be used elsewhere

This commit is contained in:
Fabian Neumann 2024-01-22 14:31:10 +01:00
parent 3750cc5350
commit a2315c289e

View File

@ -75,10 +75,10 @@ def build_clustered_gas_network(df, bus_regions, length_factor=1.25):
return df
def reindex_pipes(df):
def reindex_pipes(df, prefix="gas pipeline"):
def make_index(x):
connector = " <-> " if x.bidirectional else " -> "
return "gas pipeline " + x.bus0 + connector + x.bus1
return prefix + " " + x.bus0 + connector + x.bus1
df.index = df.apply(make_index, axis=1)