PyPSA-Earth. A Flexible Python-based Open Optimisation Model to Study Energy System Futures around the World.
PyPSA-Earth is the first open-source global energy system model with data in high spatial and temporal resolution. It enables large-scale collaboration by providing a tool that can model the world energy system or any subset of it. This work is derived from the European PyPSA-Eur model using new data and functions. It is suitable for operational as well as combined generation, storage and transmission expansion studies. The model provides two main features: (1) customizable data extraction and preparation scripts with global coverage and (2) a PyPSA energy modelling framework integration. The data includes electricity demand, generation and medium to high-voltage networks from open sources, yet additional data can be further integrated. A broad range of clustering and grid meshing strategies help adapt the model to computational and practical needs.
The model is described in the Applied Energy article "PyPSA-Earth. A new global open energy system optimization model demonstrated in Africa", 2023, https://doi.org/10.1016/j.apenergy.2023.121096 (BibTeX). The documentation provides additional information.
PyPSA meets Earth is a free and open source software initiative aiming to develop a powerful energy system model for Earth. We work on open data, open source modelling, open source solver support and open communities. Stay tuned and join our mission - We look for users, co-developers and leaders! Check out our website for results and our projects. Happy coding!
There are multiple ways to get involved and learn more about our work. That's how we organise ourselves:
- Discord NEW! (Open)
- General initiative meeting (Open)
- every forth Thursday each month Thursday 16-17:00 (UK time)
download .ics
- join for project news and high-level code updates
- meeting hosted on Discord
- open agenda. See what we will discuss. Invited members have edit rights.
- every forth Thursday each month Thursday 16-17:00 (UK time)
- Buddy talk (Open)
- book a 30min meeting with Max to discuss anything you like
- booking link: calendly.com/pypsa-meets-earth
- Specific code meeting (Open)
- meeting hosted on Discord
- join updates, demos, Q&A's, discussions and the coordination of each work package
- Demand creation and prediction meeting, on demand
- AI asset detection meeting, on demand
- Sector coupling meeting, every Thursday 09:00 (UK time),
download .ics
- PyPSA-Earth meeting, every Thursday 16:00 (UK time),
download .ics
- Outreach meeting (Open)
- every second week, Tuesday 17:00 (UK time)
- planning, discussing events, workshops, communication, community activities
- Google Drive
- access to minutes, presentations, lists, documents (access to minutes)
-
Open your terminal at a location where you want to install pypsa-earth. Type the following in your terminal to download the package from GitHub:
.../some/path/without/spaces % git clone https://github.com/pypsa-meets-earth/pypsa-earth.git
-
The python package requirements are curated in the
envs/environment.yaml
file. The environment can be installed using:
.../pypsa-earth % conda env create -f envs/environment.yaml
If the above takes longer than 30min, you might want to try mamba for faster installation:
(base) conda install -c conda-forge mamba
.../pypsa-earth % mamba env create -f envs/environment.yaml
-
For running the optimization one has to install the solver. We can recommend the open source HiGHs solver which installation manual is given here.
-
To use jupyter lab (new jupyter notebooks) continue with the ipython kernel installation and test if your jupyter lab works:
.../pypsa-earth % ipython kernel install --user --name=pypsa-earth .../pypsa-earth % jupyter lab
-
Verify or install a java redistribution from the official website or equivalent. To verify the successful installation the following code can be tested from bash:
.../pypsa-earth % java -version
The expected output should resemble the following:
java version "1.8.0_341" Java(TM) SE Runtime Environment (build 1.8.0_341-b10) Java HotSpot(TM) 64-Bit Server VM (build 25.341-b10, mixed mode)
-
In the folder open a terminal/command window to be located at this path
~/pypsa-earth/
-
Activate the environment
conda activate pypsa-earth
-
Rename config.tutorial.yaml to config.yaml. For instance in Linux:
mv config.tutorial.yaml config.yaml
-
Run a dryrun of the Snakemake workflow by typing simply in the terminal:
snakemake -j 1 solve_all_networks -n
Remove the -n to do a real run. Follow the tutorial of PyPSA-Eur 1 and 2 on YouTube to continue with an analysis.
- We recently updated some hackathon material for PyPSA-Earth. The hackathon contains jupyter notebooks with exercises. After going through the 1 day theoretical and practical material you should have a suitable coding setup and feel confident about contributing.
- The get a general feeling about the PyPSA functionality, we further recommend going through the PyPSA and Atlite examples.
- We are happy to answer questions and help with issues if they are public. Through being public the wider community can benefit from the raised points. Some tips. Bugs and feature requests should be raised in the GitHub Issues. General workflow or user questions as well as discussion points should be posted at the GitHub Discussions tab. Happy coding.
The documentation is available here: documentation.