From 7665de61d3f163005392a8f12130439274e61803 Mon Sep 17 00:00:00 2001 From: Philipp Glaum Date: Thu, 29 Aug 2024 15:34:44 +0200 Subject: [PATCH 1/2] prepare_sector_network: convert e_max_pu timeseries for msw stores to pd.DataFrame. --- scripts/prepare_sector_network.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index b6644d6d..cc4c7f3a 100644 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -2345,7 +2345,12 @@ def add_biomass(n, costs): carrier="municipal solid waste", ) - e_max_pu = pd.Series([1] * (len(n.snapshots) - 1) + [0], index=n.snapshots) + e_max_pu = np.array( + len(spatial.msw.nodes) * [[1] * (len(n.snapshots) - 1) + [0]] + ).T + e_max_pu = pd.DataFrame( + e_max_pu, index=n.snapshots, columns=spatial.msw.nodes + ).astype(float) n.madd( "Store", spatial.msw.nodes, From bca4f95a070e7a1623c6d88c6517894236804cd9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:38:39 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/build_energy_totals.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index fe4b9e70..24ba86bb 100644 --- a/scripts/build_energy_totals.py +++ b/scripts/build_energy_totals.py @@ -1066,7 +1066,9 @@ def build_eurostat_co2(eurostat: pd.DataFrame, year: int = 1990) -> pd.Series: # emissions in tCO2_equiv per MWh_th specific_emissions["Solid fossil fuels"] = 0.36 # Approximates coal - specific_emissions["Oil and petroleum products"] = 0.285 # Average of distillate and residue + specific_emissions["Oil and petroleum products"] = ( + 0.285 # Average of distillate and residue + ) specific_emissions["Natural gas"] = 0.2 # For natural gas return eurostat_year.multiply(specific_emissions).sum(axis=1) @@ -1099,7 +1101,9 @@ def build_co2_totals( co2 = eea_co2.reindex(countries) - for ct in pd.Index(countries).intersection(["BA", "RS", "AL", "ME", "MK", "UA", "MD"]): + for ct in pd.Index(countries).intersection( + ["BA", "RS", "AL", "ME", "MK", "UA", "MD"] + ): mappings = { "electricity": (ct, "+", "Electricity & heat generation", np.nan), "residential non-elec": (ct, "+", "+", "Residential"),