pypsa-meets-earth / pypsa-earth

PyPSA-Earth: A flexible Python-based open optimisation model to study energy system futures around the world.
https://pypsa-earth.readthedocs.io/en/latest/
207 stars 167 forks source link

bundle_config.yaml has incorrect, extra link in bundle_cutouts_northamerica #1005

Open mfripp opened 2 months ago

mfripp commented 2 months ago

Checklist

Describe the Bug

The databundles > bundle_cutouts_northamerica > urls node in configs/bundle_config.yaml specifies both a zenodo URL and a gdrive URL. This bundle should download cutout-2013-era5.nc. The gdrive URL points to that file and could be used to download it successfully. However, the zenodo URL points to an unneeded copy of the worldwide natura.tiff.

The zenodo URL ends up masking the gdrive URL, so that for North American locations, retrieve_databundle_light() creates an unneeded cutouts/natura.tiff and does not create cutouts/cutout-2013-era5.nc. As a result, Snakemake reports that cutouts/cutout-2013-era5.nc is missing after the retrieve_databundle_light rule, and terminates with the error below.

This error can be reproduced by setting countries in config.yaml to include a North American location, e.g., countries: ["DO"], then setting enable: retrieve_databundle: true and running snakemake --cores 1 solve_all_networks.

This error can be fixed by removing the databundles > bundle_cutouts_northamerica > urls > zenodo node from configs/bundle_config.yaml.

Error Message

Bundle successfully loaded and unzipped:
        bundle_landcover_earth
        bundle_cutouts_northamerica
        bundle_natura_earth
        bundle_data_earth
        bundle_hydrobasins
INFO:__main__:Bundle successfully loaded and unzipped:
        bundle_landcover_earth
        bundle_cutouts_northamerica
        bundle_natura_earth
        bundle_data_earth
        bundle_hydrobasins
Waiting at most 5 seconds for missing files.
WARNING:snakemake.logging:Waiting at most 5 seconds for missing files.
MissingOutputException in rule retrieve_databundle_light in file /Users/matthias/Library/CloudStorage/OneDrive-EnvironmentalDefenseFund-edf.org/Research/MCET/pypsa/pypsa-earth/Snakefile, line 149:
Job 9  completed successfully, but some output files are missing. Missing files after 5 seconds. This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait:
cutouts/cutout-2013-era5.nc
ERROR:snakemake.logging:MissingOutputException in rule retrieve_databundle_light in file /Users/matthias/Library/CloudStorage/OneDrive-EnvironmentalDefenseFund-edf.org/Research/MCET/pypsa/pypsa-earth/Snakefile, line 149:
Job 9  completed successfully, but some output files are missing. Missing files after 5 seconds. This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait:
cutouts/cutout-2013-era5.nc
Removing output files of failed job retrieve_databundle_light since they might be corrupted:
data/ssp2-2.6/2030/era5_2013/SouthAmerica.nc, data/copernicus/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif, data/natura/natura.tiff, data/gebco/GEBCO_2021_TID.nc, data/ssp2-2.6/2030/era5_2013/Oceania.nc, data/ssp2-2.6/2030/era5_2013/Africa.nc, data/ssp2-2.6/2030/era5_2013/NorthAmerica.nc, data/ssp2-2.6/2030/era5_2013/Asia.nc, data/ssp2-2.6/2030/era5_2013/Europe.nc, data/eez/eez_v11.gpkg, data/hydrobasins/hybas_world.shp, data/landcover
WARNING:snakemake.logging:Removing output files of failed job retrieve_databundle_light since they might be corrupted:
data/ssp2-2.6/2030/era5_2013/SouthAmerica.nc, data/copernicus/PROBAV_LC100_global_v3.0.1_2019-nrt_Discrete-Classification-map_EPSG-4326.tif, data/natura/natura.tiff, data/gebco/GEBCO_2021_TID.nc, data/ssp2-2.6/2030/era5_2013/Oceania.nc, data/ssp2-2.6/2030/era5_2013/Africa.nc, data/ssp2-2.6/2030/era5_2013/NorthAmerica.nc, data/ssp2-2.6/2030/era5_2013/Asia.nc, data/ssp2-2.6/2030/era5_2013/Europe.nc, data/eez/eez_v11.gpkg, data/hydrobasins/hybas_world.shp, data/landcover
Shutting down, this might take some time.
WARNING:snakemake.logging:Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
ERROR:snakemake.logging:Exiting because a job execution failed. Look above for error message
ekatef commented 2 months ago

Hello @mfripp! Thanks for spotting.

I confirm that zenodo is used as a priority data source, when extracting data bundle. But in case of North America, the cutout is too big to fit on zenodo drive: that is in fact an hemispherical cutout, due to the fact that it's area intersects the anti-meridian. So, the only possible way to fix the issue now is to remove the zenodo link for NorthAmerica cutout.

If you wish to open a PR to fix that, it will be gratefully accepted!