diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 9b1381ce5..c111e9bc1 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -39,6 +39,7 @@ Upcoming Release **Bugs and Compatibility** * A bug preventing custom powerplants specified in ``data/custom_powerplants.csv`` was fixed. (https://github.com/PyPSA/pypsa-eur/pull/732) +* Fix nodal fraction in ``add_existing_year`` when using distributed generators PyPSA-Eur 0.8.1 (27th July 2023) diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index 1474b0042..1842166b8 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -88,7 +88,9 @@ def add_existing_renewables(df_agg): ] cfs = n.generators_t.p_max_pu[gens].mean() cfs_key = cfs / cfs.sum() - nodal_fraction.loc[n.generators.loc[gens, "bus"]] = cfs_key.values + nodal_fraction.loc[n.generators.loc[gens, "bus"]] = cfs_key.groupby( + n.generators.loc[gens, "bus"] + ).sum() nodal_df = df.loc[n.buses.loc[elec_buses, "country"]] nodal_df.index = elec_buses