- changed status to open
PermissionError when processing WaPOR3.STATICS
Issue #7
resolved
We have this error in Colab and Windows, not in Linux.
--> Collecting `rn_offset`, `rn_slope`, `t_amp`, `t_opt`, `vpd_slope`, `lw_offset`, `lw_slope` from `STATICS.WaPOR3`.
--> Collect attempt 1 of 2 for `STATICS.WaPOR3` failed, giving up now, see full traceback below for more info. (PermissionError: [Errno 13] Permission denied).
Traceback (most recent call last):
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\pywapor\collect\downloader.py", line 129, in collect_sources
x = dler(**args)
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\pywapor\collect\product\STATICS.py", line 224, in download
ds = cog.download(fn, product_name, coords, variables,
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\pywapor\collect\protocol\cog.py", line 99, in download
ds = open_ds(temp_path)
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\pywapor\general\processing_functions.py", line 329, in open_ds
ds = xr.open_dataset(fp, decode_coords = decode_coords, chunks = chunks, **kwargs)
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\xarray\backends\api.py", line 551, in open_dataset
engine = plugins.guess_engine(filename_or_obj)
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\xarray\backends\plugins.py", line 154, in guess_engine
if backend.guess_can_open(store_spec):
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\xarray\backends\netCDF4_.py", line 570, in guess_can_open
magic_number = try_read_magic_number_from_path(filename_or_obj)
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\xarray\core\utils.py", line 673, in try_read_magic_number_from_path
return read_magic_number_from_file(f, count)
File "C:\Users\ntr002\Miniconda3\envs\phd\lib\site-packages\xarray\core\utils.py", line 661, in read_magic_number_from_file
magic_number = filename_or_obj.read(count)
PermissionError: [Errno 13] Permission denied
The issue seems to be in this line: https://bitbucket.org/cioapps/pywapor/src/be893045f47467917dbd0774cb661bd0377b8803/pywapor/collect/protocol/cog.py#lines-90
The temp_path is not completely closed before it is opened again in Line 99
Fix: adding this to close the file completely.
# Run gdal.Translate.
ds_ = gdal.Translate(temp_path, url, options = options)
ds_ = None
Comments (2)
-
-
- changed status to resolved
- Log in to comment