diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 3849cafd..8326f615 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -172,6 +172,8 @@ Upcoming Release * Fix error with `symbol` of `buses` in `simplify_network`. +* 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 9c35819f..f445efe3 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -259,13 +259,21 @@ 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",