From 1f9d64c5d5d28e94b9842008893e21b9dbc9df3c Mon Sep 17 00:00:00 2001 From: thomgeo Date: Thu, 2 Feb 2023 14:59:50 +0100 Subject: [PATCH 1/2] fixed bug that set max_hours for many plants to 6 --- scripts/add_electricity.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 85391a64..d2a61fb5 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -498,7 +498,7 @@ def attach_hydro(n, costs, ppl, profile_hydro, hydro_capacities, carriers, **con e_target = hydro_stats["E_store[TWh]"].clip(lower=0.2) * 1e6 e_installed = hydro.eval("p_nom * max_hours").groupby(hydro.country).sum() e_missing = e_target - e_installed - missing_mh_i = hydro.query("max_hours == 0").index + missing_mh_i = hydro.query("max_hours.isnull()").index if hydro_max_hours == "energy_capacity_totals_by_country": # watch out some p_nom values like IE's are totally underrepresented @@ -511,6 +511,8 @@ def attach_hydro(n, costs, ppl, profile_hydro, hydro_capacities, carriers, **con hydro_stats["E_store[TWh]"] * 1e3 / hydro_stats["p_nom_discharge[GW]"] ) + max_hours_country.clip(0, inplace = True) + missing_countries = pd.Index(hydro["country"].unique()).difference( max_hours_country.dropna().index ) From cb94e5974eddb705f5391cee0fea489e5f573fbb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 12:20:06 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/add_electricity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 1842c4a0..7407dafa 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -509,8 +509,8 @@ def attach_hydro(n, costs, ppl, profile_hydro, hydro_capacities, carriers, **con hydro_stats["E_store[TWh]"] * 1e3 / hydro_stats["p_nom_discharge[GW]"] ) - max_hours_country.clip(0, inplace = True) - + max_hours_country.clip(0, inplace=True) + missing_countries = pd.Index(hydro["country"].unique()).difference( max_hours_country.dropna().index )