calliope-project / euro-calliope

A workflow to build models of the European electricity system for Calliope.
https://euro-calliope.readthedocs.io
MIT License
31 stars 18 forks source link

Workflow doesn't run for arbitrary country choices #235

Open brynpickering opened 2 years ago

brynpickering commented 2 years ago

What happened?

The minimal workflow covers the UK and Ireland. This is convenient, since it doesn't break in any rule. However, if you choose countries without any hydropower, it breaks on an assertion.

We should probably expand the pre-release tests to run a selection of different minimal workflows for different groups of countries.

Version

1.2.0.dev

Relevant log output

[Fri May 13 11:33:05 2022]
Job 69: Determine energy inflow time series for all hydro electricity between the years 2015 and 2016.

Activating conda environment: ~/euro-calliope/.snakemake/conda/d8e6bc93
Activating conda environment: ~/euro-calliope/.snakemake/conda/d8e6bc93
Traceback (most recent call last):
  File "~/euro-calliope/.snakemake/scripts/tmpjr73fzhf.inflow_mwh.py", line 120, in <module>
    determine_energy_inflow(
  File "~/euro-calliope/.snakemake/scripts/tmpjr73fzhf.inflow_mwh.py", line 14, in determine_energy_inflow
    inflow_MWh = xr.merge([
  File "~/euro-calliope/.snakemake/scripts/tmpjr73fzhf.inflow_mwh.py", line 15, in <listcomp>
    energy_inflow(
  File "~/euro-calliope/.snakemake/scripts/tmpjr73fzhf.inflow_mwh.py", line 73, in energy_inflow
    inflow_MWh.loc[{"id": plant_id}] = water_to_capped_energy_inflow(
  File "~/euro-calliope/.snakemake/scripts/tmpjr73fzhf.inflow_mwh.py", line 82, in water_to_capped_energy_inflow
    assert annual_generation <= cap * 8760
AssertionError
[Fri May 13 11:33:07 2022]
Error in rule inflow_mwh:
    jobid: 69
    output: build/data/hydro-electricity-with-energy-inflow-2015-2016.nc
    conda-env: ~/euro-calliope/.snakemake/conda/d8e6bc93

RuleException:
CalledProcessError in line 136 of ~/euro-calliope/rules/hydro.smk:
Command 'source ~/miniconda3/bin/activate '~/euro-calliope/.snakemake/conda/d8e6bc93'; set -euo pipefail;  python ~/euro-calliope/.snakemake/scripts/tmpjr73fzhf.inflow_mwh.py' returned non-zero exit status 1.
  File "~/miniconda3/envs/euro-calliope/lib/python3.8/site-packages/snakemake/executors/__init__.py", line 2326, in run_wrapper
  File "~/euro-calliope/rules/hydro.smk", line 136, in __rule_inflow_mwh
  File "~/miniconda3/envs/euro-calliope/lib/python3.8/site-packages/snakemake/executors/__init__.py", line 568, in _callback
  File "~/miniconda3/envs/euro-calliope/lib/python3.8/concurrent/futures/thread.py", line 57, in run
  File "~/miniconda3/envs/euro-calliope/lib/python3.8/site-packages/snakemake/executors/__init__.py", line 554, in cached_or_run
  File "~/miniconda3/envs/euro-calliope/lib/python3.8/site-packages/snakemake/executors/__init__.py", line 2357, in run_wrapper
[Fri May 13 11:33:09 2022]
Finished job 62.
112 of 124 steps (90%) done
[Fri May 13 11:33:10 2022]
Finished job 106.
113 of 124 steps (91%) done
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
timtroendle commented 2 years ago

Running different configurations could be challenging. A simpler approach to fixing this specific issue could be to include one of the country for which the workflow fails right now — potentially removing either Ireland or the UK.

brynpickering commented 2 years ago

Ideally we can test the case where there is at least one country with relevant data/land type (hydro, offshore wind, linking neighbours, etc.), which is what the current minimal example does, and a case where there can be none of those things. This would mean a single country with no offshore wind potential and no hydro and (now) no nuclear.