NCAR / pynio

PyNIO is a multi-format data I/O package with a NetCDF-style interface
http://www.pyngl.ucar.edu/Nio.shtml
Apache License 2.0
112 stars 37 forks source link

failing to read grib2 files from ftp.bsh.de #55

Open dougstarfish opened 1 year ago

dougstarfish commented 1 year ago

example: ftp://ftp.bsh.des/Nordsee/Current_ofi_2023042400_01.grb2

import Nio import xarray as xr xr.show_versions()

INSTALLED VERSIONS

commit: None python: 3.11.2 (main, Feb 28 2023, 08:03:35) [GCC 8.3.1 20190311 (Red Hat 8.3.1-3)] python-bits: 64 OS: Linux OS-release: 3.10.0-1062.1.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.2 libnetcdf: 4.9.0

xarray: 2023.1.0 pandas: 2.0.0 numpy: 1.24.2 scipy: 1.10.1 netCDF4: 1.6.2 pydap: None h5netcdf: None h5py: None Nio: 1.5.5 ...

ds = xr.open_dataset("samples/Current_ofi_2023042400_01.grb2", engine="pynio") warning:["libsrc/NclFile.c":1603]:FileSetFileOption: FileStructure is not a recognized file option for format grb2 warning:The file format requested does not appear to be supported, could not open (/home/doug/git/SF-wrappers/meta-x/samples/Current_ofi_2023042400_01.grb2) Traceback (most recent call last): File "/opt/starfish/examples/venv/lib/python3.11/site-packages/xarray/backends/file_manager.py", line 209, in _acquire_with_cache_info file = self._cache[self._key]


File "/opt/starfish/examples/venv/lib/python3.11/site-packages/xarray/backends/lru_cache.py", line 55, in __getitem__
value = self._cache[key]
~~~~~~~~~~~^^^^^
KeyError: [<function open_file at 0x7f7f5cd391c0>, ('/home/doug/git/SF-wrappers/meta-x/samples/Current_ofi_2023042400_01.grb2',), 'r', (), '636be73f-7f08-489c-9ade-8442952368b1']

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/opt/starfish/examples/venv/lib/python3.11/site-packages/xarray/backends/api.py", line 541, in open_dataset backend_ds = backend.opendataset( ^^^^^^^^^^^^^^^^^^^^^ File "/opt/starfish/examples/venv/lib/python3.11/site-packages/xarray/backends/pynio.py", line 136, in opendataset store = NioDataStore( ^^^^^^^^^^^^^ File "/opt/starfish/examples/venv/lib/python3.11/site-packages/xarray/backends/pynio.py", line 80, in init self.ds.setoption("MaskedArrayMode", "MaskedNever") ^^^^^^^ File "/opt/starfish/examples/venv/lib/python3.11/site-packages/xarray/backends/pynio.py", line 84, in ds return self._manager.acquire() ^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/starfish/examples/venv/lib/python3.11/site-packages/xarray/backends/filemanager.py", line 191, in acquire file, = self._acquire_with_cache_info(needs_lock) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/starfish/examples/venv/lib/python3.11/site-packages/xarray/backends/file_manager.py", line 215, in _acquire_with_cache_info file = self._opener(*self._args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/starfish/examples/venv/lib/python3.11/site-packages/PyNIO/Nio.py", line 751, in open_file file = _nio.open_file(filename,mode,options,history,format) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Nio.NIOError: Unable to open file

Any idea what is going wrong here? I am just interested in the metadata tags in the grib2 file, not data processing or analytics, but open is failing.