PyPSA-Spain

An extension of PyPSA-Eur to model the Spanish Energy System.
https://github.com/cristobal-gc/pypsa-spain

Category: Energy Systems
Sub Category: Global and Regional Energy System Models

Keywords from Contributors

energy-system-model energy-system power-systems capacity-expansion-planning energy-model pypsa capacity-expansion-model energy-data energy-system-analysis europe

Last synced: about 14 hours ago
JSON representation

Repository metadata

PyPSA-Spain is an open-source model of the Spanish energy system based on the European model PyPSA-Eur

https://github.com/cristobal-GC/pypsa-spain/blob/master/

          

![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/pypsa/pypsa-eur?include_prereleases)
[![Test workflows](https://github.com/pypsa/pypsa-eur/actions/workflows/test.yaml/badge.svg)](https://github.com/pypsa/pypsa-eur/actions/workflows/test.yaml)
[![Documentation](https://readthedocs.org/projects/pypsa-eur/badge/?version=latest)](https://pypsa-eur.readthedocs.io/en/latest/?badge=latest)
![Size](https://img.shields.io/github/repo-size/pypsa/pypsa-eur)
[![Zenodo PyPSA-Eur](https://zenodo.org/badge/DOI/10.5281/zenodo.3520874.svg)](https://doi.org/10.5281/zenodo.3520874)
[![Zenodo PyPSA-Eur-Sec](https://zenodo.org/badge/DOI/10.5281/zenodo.3938042.svg)](https://doi.org/10.5281/zenodo.3938042)
[![Snakemake](https://img.shields.io/badge/snakemake-≥9-brightgreen.svg?style=flat)](https://snakemake.readthedocs.io)
[![Discord](https://img.shields.io/discord/911692131440148490?logo=discord)](https://discord.gg/AnuJBk23FU)
[![REUSE status](https://api.reuse.software/badge/github.com/pypsa/pypsa-eur)](https://api.reuse.software/info/github.com/pypsa/pypsa-eur)



# PyPSA-Spain: An extension of PyPSA-Eur to model the Spanish Energy System

The primary motivation behind the development of PyPSA-Spain was to leverage the
benefits of a national energy model over a regional one, like the availability of specific
datasets from national organisations. Additionally, a single-country model enables higher
spatial and temporal resolution with the same computational resources due to the smaller
geographical domain. Finally, it does not require assumptions about coordinated action
between countries, making it a more suitable tool for analysing national energy policies.
To accommodate cross-border interactions, a nested model approach with PyPSA-Eur was
used, wherein electricity prices from neighbouring countries are precomputed through the
optimisation of the European energy system.

PyPSA-Spain is an up-to-date fork of PyPSA-Eur, ensuring that advancements
and bug fixes made to PyPSA-Eur are integrated. In addition, PyPSA-Spain includes a number of novel functionalities that enhance the representation
of the Spanish energy system, as compared with PyPSA-Eur. 

Find more details in [https://pypsa-spain.readthedocs.io/en/latest/](https://pypsa-spain.readthedocs.io/en/latest/)

A description of the new functionalities implemented in PyPSA-Spain is now available in this article: [https://doi.org/10.1016/j.esr.2025.101764](https://doi.org/10.1016/j.esr.2025.101764).




![PyPSA-Spain Grid Model](docs/img/base.jpg)



## Basic commands for running PyPSA-Spain

As a fork of PyPSA-Eur, PyPSA-Spain uses the same command structure.  
Note that PyPSA-Spain employs the **sector network** approach



- **Full workflow run**:

```bash
$ snakemake all --configfile config/config_ES.yaml --cores 4
```


- **Partial runs**:

```bash
##### Cluster the network
$ snakemake cluster_networks --configfile config/config_ES.yaml --cores 4
```

```bash
##### Prepare the network
$ snakemake prepare_sector_networks --configfile config/config_ES.yaml --cores 4
```

```bash
##### Solve the network
$ snakemake solve_sector_networks --configfile config/config_ES.yaml --cores 4
```

- **Run to get a specific output**, for example, `base.nc` network:

```bash
$ snakemake resources/networks/base.nc --configfile config/config_ES.yaml --cores 4
```




**Comments:**
1. Adjust the number of `--cores` according to your system.
2. Add the `-n` flag (dry-run) to check the workflow before execution 






## Licence

PyPSA-Spain is a fork of [PyPSA-Eur](https://github.com/PyPSA/pypsa-eur), which is released as free software under the
[MIT License](https://opensource.org/licenses/MIT), see [`doc/licenses.rst`](doc/licenses.rst).
However, different licenses and terms of use may apply to the various input data.

        

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 4 days ago

Total Commits: 4,532
Total Committers: 96
Avg Commits per committer: 47.208
Development Distribution Score (DDS): 0.709

Commits in past year: 355
Committers in past year: 38
Avg Commits per committer in past year: 9.342
Development Distribution Score (DDS) in past year: 0.673

Name Email Commits
Fabian Neumann f****n@o****e 1319
pre-commit-ci[bot] 6****] 452
Fabian f****f@g****e 427
lisazeyen l****n@w****e 358
Jonas Hörsch j****h@k****u 238
Tom Brown t****m@n****g 216
Cristóbal José Gallego Castillo 8****C 182
martavp m****z@g****m 119
martacki m****i@k****u 114
Philipp Glaum p****m@t****e 95
AmosSchledorn a****n@i****m 86
Koen van Greevenbroek k****k@u****o 79
virio-andreyana 1****a 77
Lukas Trippe l****p@p****e 70
Adam-Dvorak1 9****1 63
euronion 4****n 51
Parisra 1****a 37
github-actions[bot] 4****] 36
LukasFrankenQ l****n@e****k 35
Michael Lindner m****r@p****e 32
Bobby Xiong 3****g 30
Thomas Gilon t****i@c****m 26
millingermarkus m****r@c****e 26
Max Parzen m****n@e****k 26
toniseibold t****b@g****m 21
Thomas Gilon t****n@o****g 18
ekatef e****a@g****m 18
chrstphtrs c****s@t****e 17
cpschau 1****u 16
Jeroen Peters h****s@g****m 15
and 66 more...

Committer domains:


Issue and Pull Request metadata

Last synced: 10 days ago

Total issues: 1
Total pull requests: 8
Average time to close issues: N/A
Average time to close pull requests: 12 days
Total issue authors: 1
Total pull request authors: 2
Average comments per issue: 0.0
Average comments per pull request: 0.0
Merged pull request: 2
Bot issues: 0
Bot pull requests: 7

Past year issues: 1
Past year pull requests: 7
Past year average time to close issues: N/A
Past year average time to close pull requests: 15 days
Past year issue authors: 1
Past year pull request authors: 1
Past year average comments per issue: 0.0
Past year average comments per pull request: 0.0
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 7

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/cristobal-gc/pypsa-spain

Top Issue Authors

  • yasirroni (1)

Top Pull Request Authors

  • github-actions[bot] (7)
  • cristobal-GC (1)

Top Issue Labels

Top Pull Request Labels

Score: 7.397561535524052