From b7aa122fdaeeee6c969d1f5429fdca12892caf07 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Mon, 12 Jun 2023 20:40:51 +0200 Subject: [PATCH] Fixed issue (most likely) introduced when merging PyPSA-Eur with PyPSA-Eur-Sec --- scripts/solve_network.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index e671ffd34..4a40d06aa 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -274,13 +274,13 @@ def add_EQ_constraints(n, o, scaling=1e-1): float_regex = "[0-9]*\.?[0-9]+" level = float(re.findall(float_regex, o)[0]) if o[-1] == "c": - ggrouper = n.generators.bus.map(n.buses.country).to_xarray() - lgrouper = n.loads.bus.map(n.buses.country).to_xarray() - sgrouper = n.storage_units.bus.map(n.buses.country).to_xarray() + ggrouper = n.generators.bus.map(n.buses.country) + lgrouper = n.loads.bus.map(n.buses.country) + sgrouper = n.storage_units.bus.map(n.buses.country) else: - ggrouper = n.generators.bus.to_xarray() - lgrouper = n.loads.bus.to_xarray() - sgrouper = n.storage_units.bus.to_xarray() + ggrouper = n.generators.bus + lgrouper = n.loads.bus + sgrouper = n.storage_units.bus load = ( n.snapshot_weightings.generators @ n.loads_t.p_set.groupby(lgrouper, axis=1).sum() @@ -294,7 +294,7 @@ def add_EQ_constraints(n, o, scaling=1e-1): p = n.model["Generator-p"] lhs_gen = ( (p * (n.snapshot_weightings.generators * scaling)) - .groupby(ggrouper) + .groupby(ggrouper.to_xarray()) .sum() .sum("snapshot") ) @@ -303,7 +303,7 @@ def add_EQ_constraints(n, o, scaling=1e-1): spillage = n.model["StorageUnit-spill"] lhs_spill = ( (spillage * (-n.snapshot_weightings.stores * scaling)) - .groupby(sgrouper) + .groupby(sgrouper.to_xarray()) .sum() .sum("snapshot") )