pypsa-eur icon indicating copy to clipboard operation
pypsa-eur copied to clipboard

Support runs without EU27 countries (e.g. GB)

Open blakeldridge opened this issue 5 months ago • 2 comments

Version Checks (indicate both or one)

  • [x] I have confirmed this bug exists on the lastest release of PyPSA-Eur.

  • [x] I have confirmed this bug exists on the current master branch of PyPSA-Eur.

Issue Description

Currently running the config.default.yaml in PyPSA-Eur with just 1 or 2 changes such that it only covers GB as a country. So I have adjusted the countries and cutout options.

I am running it as a sector coupled network : snakemake -call all

However, when reaching the rule : build_energy_totals, GB is not recognised as a country.

I printed out the country codes in that section of the code (eu27) :

['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE']

and GB is not in the eu27. This means that I get an empty index in idees_countries, which causes an error to be thrown.

Is this a genuinine issue with the code? or is there a way I can alter the code or config to bypass this?

let me know if more information is needed.

Reproducible Example

using config.default.yaml, countries set to just ["GB"], and a cutout that covers just GB too.

Expected Behavior

Traceback (most recent call last): File "C:\Shared_Data\pypsa-eur.snakemake\scripts\tmp591x4zza.build_energy_totals.py", line 1610, in idees = build_idees(idees_countries) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Shared_Data\pypsa-eur.snakemake\scripts\tmp591x4zza.build_energy_totals.py", line 585, in build_idees totals = pd.concat( ^^^^^^^^^^ File "C:\Users\be4.conda\envs\pypsa-eur\Lib\site-packages\pandas\core\reshape\concat.py", line 382, in concat op = _Concatenator( ^^^^^^^^^^^^^^ File "C:\Users\be4.conda\envs\pypsa-eur\Lib\site-packages\pandas\core\reshape\concat.py", line 445, in init objs, keys = self._clean_keys_and_objs(objs, keys) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\be4.conda\envs\pypsa-eur\Lib\site-packages\pandas\core\reshape\concat.py", line 507, in _clean_keys_and_objs raise ValueError("No objects to concatenate") ValueError: No objects to concatenate

Installed Versions

Replace this line.

blakeldridge avatar Jul 09 '25 12:07 blakeldridge

There is also no GB in the jrc-idees-2021 which I assume is why it was disregarded in eu27. Do I have to skip the build_energy_totals rule entirely?

blakeldridge avatar Jul 09 '25 12:07 blakeldridge

Yes, reproduced this problem just now.

Potential workaround, include IE and drop later -- until we fix it. Shouldn't be too difficult.

fneum avatar Jul 10 '25 11:07 fneum