Merge pull request #937 from PyPSA/h2-myopic-plot
Fix plotting of retrofitted hydrogen pipelines with pathway optimisat…
This commit is contained in:
commit
a3c0ffac44
@ -19,6 +19,8 @@ Upcoming Release
|
|||||||
today to tomorrow's energy consumption is set with the ``industry:
|
today to tomorrow's energy consumption is set with the ``industry:
|
||||||
sector_ratios_fraction_future:`` parameter.
|
sector_ratios_fraction_future:`` parameter.
|
||||||
|
|
||||||
|
* Fix plotting of retrofitted hydrogen pipelines with pathway optimisation.
|
||||||
|
|
||||||
* Bugfix: Correct units of subtracted chlorine and methanol demand in
|
* Bugfix: Correct units of subtracted chlorine and methanol demand in
|
||||||
:mod:`build_industry_sector_ratios`.
|
:mod:`build_industry_sector_ratios`.
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ def group_pipes(df, drop_direction=False):
|
|||||||
"""
|
"""
|
||||||
Group pipes which connect same buses and return overall capacity.
|
Group pipes which connect same buses and return overall capacity.
|
||||||
"""
|
"""
|
||||||
|
df = df.copy()
|
||||||
if drop_direction:
|
if drop_direction:
|
||||||
positive_order = df.bus0 < df.bus1
|
positive_order = df.bus0 < df.bus1
|
||||||
df_p = df[positive_order]
|
df_p = df[positive_order]
|
||||||
@ -32,12 +33,13 @@ def group_pipes(df, drop_direction=False):
|
|||||||
df = pd.concat([df_p, df_n])
|
df = pd.concat([df_p, df_n])
|
||||||
|
|
||||||
# there are pipes for each investment period rename to AC buses name for plotting
|
# there are pipes for each investment period rename to AC buses name for plotting
|
||||||
|
df["index_orig"] = df.index
|
||||||
df.index = df.apply(
|
df.index = df.apply(
|
||||||
lambda x: f"H2 pipeline {x.bus0.replace(' H2', '')} -> {x.bus1.replace(' H2', '')}",
|
lambda x: f"H2 pipeline {x.bus0.replace(' H2', '')} -> {x.bus1.replace(' H2', '')}",
|
||||||
axis=1,
|
axis=1,
|
||||||
)
|
)
|
||||||
return df.groupby(level=0).agg(
|
return df.groupby(level=0).agg(
|
||||||
{"p_nom_opt": "sum", "bus0": "first", "bus1": "first"}
|
{"p_nom_opt": "sum", "bus0": "first", "bus1": "first", "index_orig": "first"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -95,6 +97,7 @@ def plot_h2_map(n, regions):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not h2_retro.empty:
|
if not h2_retro.empty:
|
||||||
|
if snakemake.params.foresight != "myopic":
|
||||||
positive_order = h2_retro.bus0 < h2_retro.bus1
|
positive_order = h2_retro.bus0 < h2_retro.bus1
|
||||||
h2_retro_p = h2_retro[positive_order]
|
h2_retro_p = h2_retro[positive_order]
|
||||||
swap_buses = {"bus0": "bus1", "bus1": "bus0"}
|
swap_buses = {"bus0": "bus1", "bus1": "bus0"}
|
||||||
|
Loading…
Reference in New Issue
Block a user