From c58f18667d387b0d8991609d9b2822830790a1ac Mon Sep 17 00:00:00 2001 From: Tom Brown Date: Mon, 7 Sep 2020 19:12:47 +0200 Subject: [PATCH] Add non-EU28 energy demand per country and sector for today Use the industrial production per sector and multiply with EU28 averages for energy per sector. --- Snakefile | 3 ++- ...d_industrial_energy_demand_per_country_today.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Snakefile b/Snakefile index 07868043..2f709e07 100644 --- a/Snakefile +++ b/Snakefile @@ -187,7 +187,8 @@ rule build_industrial_production_per_country_tomorrow: rule build_industrial_energy_demand_per_country_today: input: - ammonia_production="resources/ammonia_production.csv" + ammonia_production="resources/ammonia_production.csv", + industrial_production_per_country="resources/industrial_production_per_country.csv" output: industrial_energy_demand_per_country_today="resources/industrial_energy_demand_per_country_today.csv" threads: 1 diff --git a/scripts/build_industrial_energy_demand_per_country_today.py b/scripts/build_industrial_energy_demand_per_country_today.py index 7e91636f..7593477b 100644 --- a/scripts/build_industrial_energy_demand_per_country_today.py +++ b/scripts/build_industrial_energy_demand_per_country_today.py @@ -121,6 +121,20 @@ for ct in eu28: final_summary = pd.concat(summaries,axis=1) +# add in the non-EU28 based on their output (which is derived from their energy too) +# output in MtMaterial/a +output = pd.read_csv(snakemake.input.industrial_production_per_country, + index_col=0)/1e3 + +eu28_averages = final_summary.groupby(level=1,axis=1).sum().divide(output.loc[eu28].sum(),axis=1) + +non_eu28 = output.index^eu28 + +for ct in non_eu28: + print(ct) + final_summary = pd.concat((final_summary,pd.concat({ct : eu28_averages.multiply(output.loc[ct],axis=1)},axis=1)),axis=1) + + final_summary.index.name = 'TWh/a' final_summary.to_csv(snakemake.output.industrial_energy_demand_per_country_today)