Error message zipfile.BadZipFile: File is not a zip file. Seems to me that GADM has some failing features. Or did it work for you for the whole continent @davide-f ?
This is the repository path: /home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts
Had to go 0 folder(s) up.
Create country shapes
/home/max/anaconda3/envs/toast/lib/python3.9/site-packages/geopandas/geodataframe.py:577: RuntimeWarning: Sequential read of iterator was interrupted. Resetting iterator. This can negatively impact the performance.
for feature in features_lst:
Traceback (most recent call last):
File "/home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts/build_shapes.py", line 565, in
country_shapes = countries(update, out_logging)
File "/home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts/build_shapes.py", line 172, in countries
df_countries = get_GADM_layer(countries, 0, update)
File "/home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts/build_shapes.py", line 112, in get_GADM_layer
file_gpkg, name_file = download_GADM(country_code, False)
File "/home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts/build_shapes.py", line 86, in download_GADM
with zipfile.ZipFile(GADM_inputfile_zip, "r") as zip_ref:
File "/home/max/anaconda3/envs/toast/lib/python3.9/zipfile.py", line 1257, in init
self._RealGetContents()
File "/home/max/anaconda3/envs/toast/lib/python3.9/zipfile.py", line 1324, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
Found the bug by looking at the resources.
Unsurprisingly it's our edge case of SN-GM. :100:
We should as discussed remove SN-GM from the country list to avoid issues like that.
Error message
zipfile.BadZipFile: File is not a zip file
. Seems to me that GADM has some failing features. Or did it work for you for the whole continent @davide-f ?This is the repository path: /home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts Had to go 0 folder(s) up. Create country shapes /home/max/anaconda3/envs/toast/lib/python3.9/site-packages/geopandas/geodataframe.py:577: RuntimeWarning: Sequential read of iterator was interrupted. Resetting iterator. This can negatively impact the performance. for feature in features_lst: Traceback (most recent call last): File "/home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts/build_shapes.py", line 565, in
country_shapes = countries(update, out_logging)
File "/home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts/build_shapes.py", line 172, in countries
df_countries = get_GADM_layer(countries, 0, update)
File "/home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts/build_shapes.py", line 112, in get_GADM_layer
file_gpkg, name_file = download_GADM(country_code, False)
File "/home/max/OneDrive/PHD-Flexibility/07_pypsa-africa/0github/pypsa-africa/pypsa-africa/scripts/build_shapes.py", line 86, in download_GADM
with zipfile.ZipFile(GADM_inputfile_zip, "r") as zip_ref:
File "/home/max/anaconda3/envs/toast/lib/python3.9/zipfile.py", line 1257, in init
self._RealGetContents()
File "/home/max/anaconda3/envs/toast/lib/python3.9/zipfile.py", line 1324, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file