From e8761c9e24fc34583e9a53bb0b7f9b8484d70121 Mon Sep 17 00:00:00 2001 From: toniseibold Date: Mon, 25 Mar 2024 15:03:23 +0100 Subject: [PATCH] overwriting agriculture and transport totals --- scripts/build_energy_totals.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index b56d3294..fcba5b4d 100644 --- a/scripts/build_energy_totals.py +++ b/scripts/build_energy_totals.py @@ -842,7 +842,7 @@ def rescale_idees_from_eurostat( "total": [ "total agriculture heat", "total agriculture machinery", - "total agriculture", + "total agriculture", # = sum of all other agriculture categories ], "elec": [ "total agriculture electricity", @@ -850,7 +850,7 @@ def rescale_idees_from_eurostat( }, "Road": { "total": [ - "total road", + "total road", # = sum of all other road categories "total passenger cars", "total other road passenger", "total light duty road freight", @@ -891,6 +891,7 @@ def rescale_idees_from_eurostat( navigation = [ "total domestic navigation", ] + # international navigation is already read in from the eurostat data directly for country in idees_countries: filling_years = [(2015, slice(2016, 2021)), (2000, slice(1990, 1999))] @@ -940,6 +941,17 @@ def rescale_idees_from_eurostat( energy.loc[slicer_source, navigation].squeeze(axis=0), ).values + # set the total of agriculture/road to the sum of all agriculture/road categories (corresponding to the IDEES data) + energy.loc[country, "total agriculture"] = energy.loc[country, ["total agriculture electricity", "total agriculture heat", "total agriculture machinery"]].sum(axis=1) + + energy.loc[country, :]["total road"] = energy[["total passenger cars", + "total other road passenger", + "total light duty road freight", + "electricity road", + "electricity passenger cars", + "electricity other road passenger", + "electricity light duty road freight"]].loc[country, :].sum(axis=1) + return energy