Surface.zip is not readable. Could you fix this?
#1
by
ablecloud
- opened
Surface.zip is not readable. Could you fix this?
Firstly unzip the folder, then the netcdf file can be read using xarray.open_dataset()
The unzip operation gives me the following error (tried twice):
Archive: surface.zip
warning [surface.zip]: 1223475096 extra bytes at beginning or within zipfile
(attempting to process anyway)
error [surface.zip]: start of central directory not found;
zipfile corrupt.
(please check that you have transferred or created the zipfile in the
appropriate BINARY mode and that you have compiled UnZip properly)
Could you double-check the zip file? upper.zip works.
The following codes works for me
import zipfile_deflate64 as zipfile
# import zipfile
import fnmatch, os
rootPath = r"your_root_path"
pattern = '*.zip'
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
print(os.path.join(root, filename))
zipfile.ZipFile(os.path.join(root, filename)).extractall(os.path.join(root, os.path.splitext(filename)[0]))
use import zipfile_deflate64 as zipfile
.