Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netCDF4 interoperability #39

Open
christine-e-smit opened this issue Feb 7, 2024 · 3 comments
Open

netCDF4 interoperability #39

christine-e-smit opened this issue Feb 7, 2024 · 3 comments

Comments

@christine-e-smit
Copy link

Using python NetCDF4 library version 1.6.2, I was able to load a zarr store.

Data used: #36

The "netCDF-like" zarr store could be opened. The "geotiff-like" zarr store could not be opened.

To reproduce:

  1. Download and unzip the netCDF-like zarr store.
  2. Open in python using the nczarr syntax:
import netCDF4
nc = netCDF4.Dataset('file:///YOUR/PATH/TO/GLDAS_NOAH025_3H.zarr#mode=nczarr,zarr')
@christine-e-smit
Copy link
Author

@ethanrd - any idea why the "geotiff-like" zarr store caused python to crash for me? I looked at the metadata, I can't immediately see what the issue is. It does load just fine with xarray.

>>> import netCDF4
>>> netCDF4.Dataset('file:///PATH/planet-fusion.zarr#mode=nczarr,zarr')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "src/netCDF4/_netCDF4.pyx", line 2469, in netCDF4._netCDF4.Dataset.__init__
  File "src/netCDF4/_netCDF4.pyx", line 2028, in netCDF4._netCDF4._ensure_nc_success
OSError: [Errno -137] NetCDF: NCZarr error: 'file:///PATH/planet-fusion.zarr#mode=nczarr,zarr'

@christine-e-smit
Copy link
Author

@ethanrd - Can I create a new zarr store using the netCDF4 library? The documentation for the Dataset class (https://unidata.github.io/netcdf4-python/#netCDF4.Dataset) indicates that you need to specify the data format, but I don't see anything with 'zarr' as an option. Just because, I tried NC_ZARR and NCZARR, but neither of those worked.

@christine-e-smit
Copy link
Author

@ethanrd - One more question! It looks as though the NetCDF library is having trouble with compression.

import netCDF4
nc = netCDF4.Dataset("file:///YOUR/PATH/GLDAS_NOAH025_3H.zarr#mode=nczarr,zarr")
nc["Tair_f_inst"][0][401][238]

gives the error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[33], line 1
----> 1 nc["Tair_f_inst"][0][401][238]

File src[/netCDF4/_netCDF4.pyx:4972](http://localhost:8888/netCDF4/_netCDF4.pyx#line=4971), in netCDF4._netCDF4.Variable.__getitem__()

File src[/netCDF4/_netCDF4.pyx:5930](http://localhost:8888/netCDF4/_netCDF4.pyx#line=5929), in netCDF4._netCDF4.Variable._get()

File src[/netCDF4/_netCDF4.pyx:2034](http://localhost:8888/netCDF4/_netCDF4.pyx#line=2033), in netCDF4._netCDF4._ensure_nc_success()

RuntimeError: NetCDF: Filter error: undefined filter encountered

I'm almost certain that I talked with someone at Unidata about this more than a year ago, but I can't find where I had the conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant