Fix index for existing capacities in add_existing_baseyear

This commit is contained in:
Thomas Gilon 2024-03-25 20:11:02 +01:00
parent 91c9dd2b82
commit 9dae86cd56
2 changed files with 5 additions and 2 deletions

View File

@ -164,6 +164,8 @@ Upcoming Release
* Fix duplicated years in `add_land_use_constraint_m`. * 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) PyPSA-Eur 0.10.0 (19th February 2024)
===================================== =====================================

View File

@ -257,13 +257,14 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
# for offshore the splitting only includes coastal regions # for offshore the splitting only includes coastal regions
inv_ind = [ 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[ p_max_pu = n.generators_t.p_max_pu[
[i + name_suffix for i in inv_ind] [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( n.madd(
"Generator", "Generator",