Large parts of this code were originally developed by Lieke van der Most (University of Groningen) in the EU renewable energy modelling framework. The original version of the code can be found here and is referenced below as [1]. [1] has been validated against historical electricity demand data reported on the ENTSO-E transparancy platform. If you use this code, please refer to her work as well.
We have made the following adjustments to the original version:
- generate hourly instead of daily electricity consumption profiles
- use
snakemake
for workflow management - trim repository to demand-related code and data
- adjust code to accept cutouts from
atlite
for weather data
Variations in weather conditions affect electricity demand patterns. This
workflow generates country-level electricity consumption time series based on
weather data using analysis by Lieke van der Most
correlating historical electricity demand to temperature. This workflow first
calculates a daily electricity demand based on the regression model developed in
[1]. Subsequently, cumulative daily electricity demands are disaggregated using
a hourly profile sampled from a random historical day (that is the same weekday)
from the Open Power System
Database. The resulting
output/demand_hourly.csv
file is compatible with the open-source electricity
system model PyPSA-Eur.
Holidays are treated like weekend days. Data on national holidays across Europe
are obtained using another repository by Aleksander
Grochowicz and others that similarly computes
artificial electricity demand time series:
github.com/aleks-g/multidecade-data.
The holidays are stored at input_files/noworkday.csv
.
Electricity consumption time-series for the years 1951-2021 and all European countries are available on Zenodo.
Download the demand_calculator
repository using git
.
/some/other/path % cd /some/path/without/spaces
/some/path/without/spaces % git clone https://github.com/martacki/demand_calculator.git
Use conda
or
mamba
to install the required packages
listed in
environment.yaml.
The environment can be installed and activated using
.../demand_calculator % conda env create -f environment.yaml
.../demand_calculator % conda activate demand
The only required additional input files are ERA5 cutouts which can be recycled
from the PyPSA-Eur weather data deposit on
Zenodo. Place the file
europe-2013-era5.nc
in the following location (and rename!):
./input_files/cutouts/europe-era5-2013.nc
Cutouts for other weather years than 2013 can be built using the build_cutout
rule from the PyPSA-Eur repository.
This repository uses snakemake
for workflow management. To run the complete
workflow, execute:
.../demand_calculator % snakemake -jall all
After successfully running the workflow, the output files will be located in
output/energy_demand
named demand_hourly_{yr}.csv
.
The years to compute can be modified directly in the Snakefile
.
An exemplary plot of the result for Germany (DE) of an exemplary week of January, 2013 comparing the results of this workflow with the Open Power System Data in hourly resolution.
An exemplary plot of the result for Spain (ES) of an exemplary week of January, 2013 comparing the results of this workflow with the Open Power System Data in hourly resolution.