This repository contains the code necessary to reproduce the results of the paper "Using power system modelling outputs to identify weather-induced extreme events in highly renewable systems". Additional data accompanying the paper can be found at DOI:10.5281/zenodo.8328689.
This repository contains a simple Snakemake-based workflow to organise the computations. The "snakefile" specifying the workflow is found at workflow/Snakefile
. Broadly speaking, the workflow follows just a few steps:
compute_optimum
rule.difficult_periods
rule.solve_operations
rule) in order to obtain load shedding data to compare with shadow prices.Clone this git repository with the --recurse-submodules
option in order to also pull in PyPSA-Eur:
git clone --recurse-submodules git@github.com:koen-vg/stressful-weather.git
Obtain the ERA5 historical weather data needed to build the model instances. Download the data for the desired weather years at DOI: 10.11582/2022.00034, and place each file (of the form europe-era5_yyyy
where yyyy
is the year) in workflow/modules/pypsa-eur/cutouts
.
Install Snakemake 7.0.1 or higher. The recommended way is using mamba to install snakemake into its own conda environment as follows:
mamba create -c conda-forge -c bioconda -n snakemake 'snakemake>=7.0.1'
Now activate the environment with conda activate snakemake
and run snakemake --version
to check that you have the correct version installed.
See https://snakemake.readthedocs.io/en/stable/getting_started/installation.html for more detailed instructions.
Run the whole workflow with the following command:
snakemake --configfile config/config-stressful-weather.yaml --use-conda -j all -- all_difficult_periods
Adjust the -j
flag to change how many CPU cores to use. For the first time, consider using the testing configuration instead (config/config-testing.yaml
), which runs the workflow with a much smaller model and fewer years (but which does require the same ERA5 cutouts as the main config).
Use the operate_all_networks
rule to run the operations of each network over every weather year.
Readily build unsolved and solved networks as well as the difficult periods computed from them can be found at DOI:10.5281/zenodo.8328689. They are presented in the same format that would be generated by running the present workflow.
The workflow presented here uses fixed software environments (workflow/envs/stressful-weather.fixed.yaml
and workflow/modules/pypsa-eur/envs/environment.fixed.yaml
) as well as a fixed (modified) version of PyPSA-Eur (the commit at which PyPSA-Eur is included as a git submodule in the present repository) meaning that the results should be reproducible.
However, we see no immediate barriers to using newer software versions.
While upstream PyPSA-Eur at the time of writing doesn't support multiple weather years, we expect that once this is supported, the present workflow could be made to work with an unmodified, upstream verion of PyPSA-Eur without much effort.
This project was developed jointly by Koen van Greevenbroek, Aleksander Grochowicz and Hannah Bloomfield.
PyPSA-Eur, included here as a git submodule, is distributed under the MIT licences; see the PyPSA-Eur homepage for more information.
All other code included in this repository is licensed under the GPL-3.0.