From 0e3d21f5a4f8470bfaa8a0d0765acb9544b859d2 Mon Sep 17 00:00:00 2001 From: lisazeyen <35347358+lisazeyen@users.noreply.github.com> Date: Tue, 25 May 2021 09:03:02 +0200 Subject: [PATCH] add EU oil bus already when adding land transport to be able to run the model without industry and avoid warning of missing bus. Add a check for scaling down total electricity demand to avoid warning of invalid value in double_scalar (#100) --- scripts/prepare_sector_network.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 485c70cc..93def4c0 100644 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -1154,6 +1154,12 @@ def add_land_transport(network): if ice_share > 0: + if "EU oil" not in network.buses.index: + network.madd("Bus", + ["EU oil"], + location="EU", + carrier="oil") + network.madd("Load", nodes, suffix=" land transport oil", @@ -1769,6 +1775,7 @@ def add_industry(network): #remove today's industrial electricity demand by scaling down total electricity demand for ct in n.buses.country.unique(): loads = n.loads.index[(n.loads.index.str[:2] == ct) & (n.loads.carrier == "electricity")] + if n.loads_t.p_set[loads].empty: continue factor = 1 - industrial_demand.loc[loads,"current electricity"].sum()/n.loads_t.p_set[loads].sum().sum() n.loads_t.p_set[loads] *= factor