From 9dae86cd561995c20f27684034691f126e962ef1 Mon Sep 17 00:00:00 2001 From: Thomas Gilon Date: Mon, 25 Mar 2024 20:11:02 +0100 Subject: [PATCH] Fix index for existing capacities in add_existing_baseyear --- doc/release_notes.rst | 2 ++ scripts/add_existing_baseyear.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index b868e5e9..634af9a6 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -164,6 +164,8 @@ Upcoming Release * Fix duplicated years in `add_land_use_constraint_m`. +* Fix index of existing capacities in `add_power_capacities_installed_before_baseyear` with `m` option. + PyPSA-Eur 0.10.0 (19th February 2024) ===================================== diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index 2c313927..8380edd0 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -257,13 +257,14 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas # for offshore the splitting only includes coastal regions inv_ind = [ - i for i in inv_ind if (i + name_suffix) in n.generators.index + i for i in inv_ind if (i + name_suffix) in n.generators.index.str + .replace(str(baseyear), str(grouping_year)) ] p_max_pu = n.generators_t.p_max_pu[ [i + name_suffix for i in inv_ind] ] - p_max_pu.columns = [i + name_suffix for i in inv_ind] + p_max_pu.columns = [i + name_suffix.replace(str(grouping_year), str(baseyear)) for i in inv_ind] n.madd( "Generator",