From e9837f8346204fd47c102338e6d521f20dd246d5 Mon Sep 17 00:00:00 2001 From: daniel-rdt Date: Thu, 2 Jul 2026 17:25:19 +0200 Subject: [PATCH 1/2] fix: define inflow_t before branch so it is always assigned --- scripts/add_electricity.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 63f586501e..544fc66fdc 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -820,6 +820,7 @@ def attach_hydro( country = ppl["bus"].map(n.buses.country).rename("country") inflow_idx = ror.index.union(hydro.index) + inflow_t = pd.DataFrame() if not inflow_idx.empty: dist_key = ppl.loc[inflow_idx, "p_nom"].groupby(country).transform(normed) @@ -853,7 +854,7 @@ def attach_hydro( capital_cost=costs.at["ror", "capital_cost"], weight=ror["p_nom"], p_max_pu=( - inflow_t[ror.index] # pylint: disable=E0606 + inflow_t[ror.index] .divide(ror["p_nom"], axis=1) .where(lambda df: df <= 1.0, other=1.0) ), From 1587451ecd72aa0275f3735cb9cb97767ec55688 Mon Sep 17 00:00:00 2001 From: daniel-rdt Date: Thu, 2 Jul 2026 17:51:41 +0200 Subject: [PATCH 2/2] doc: add release note --- doc/release_notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 05c2ce4933..9178b9dbee 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -35,6 +35,8 @@ Upcoming Open-TYNDP Release **Bugfixes and Compatibility** +* Ensure ``inflow_t`` is always defined in ``attach_hydro``, resolving a pylint use-before-assignment issue (https://github.com/open-energy-transition/open-tyndp/pull/777). + **Documentation** * Update benchmarking documentation tables and figures for v0.7.1 (https://github.com/open-energy-transition/open-tyndp/pull/711).