From 7ad930ee2ebe79a545088f1586a6ad1e51e8eb19 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sat, 25 May 2024 21:13:47 +0200 Subject: [PATCH] bug: add_electricity only add carriers in powerplant dataset for country subset --- scripts/add_electricity.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 3be23f75b..49d0bdf75 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -448,8 +448,6 @@ def attach_conventional_generators( fuel_price=None, ): carriers = list(set(conventional_carriers) | set(extendable_carriers["Generator"])) - add_missing_carriers(n, carriers) - add_co2_emissions(n, costs, carriers) # Replace carrier "natural gas" with the respective technology (OCGT or # CCGT) to align with PyPSA names of "carriers" and avoid filtering "natural @@ -465,6 +463,11 @@ def attach_conventional_generators( ) ppl["efficiency"] = ppl.efficiency.fillna(ppl.efficiency_r) + # reduce carriers to those in power plant dataset + carriers = list(set(carriers) & set(ppl.carrier.unique())) + add_missing_carriers(n, carriers) + add_co2_emissions(n, costs, carriers) + if unit_commitment is not None: committable_attrs = ppl.carrier.isin(unit_commitment).to_frame("committable") for attr in unit_commitment.index: