Unidata / netcdf4-python

netcdf4-python: python/numpy interface to the netCDF C library
http://unidata.github.io/netcdf4-python
MIT License
758 stars 265 forks source link

Unable to read OpenDAP with 1.6.4, manual creation of ~/.esg required #1278

Open BSchilperoort opened 1 year ago

BSchilperoort commented 1 year ago

System info:


When trying to read an OpenDAP url with netCDF4==1.6.4, I get the following error:

Cookie file cannot be read and written: /home/username/.esg/.dods_cookies
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "src/netCDF4/_netCDF4.pyx", line 2464, in netCDF4._netCDF4.Dataset.__init__
  File "src/netCDF4/_netCDF4.pyx", line 2027, in netCDF4._netCDF4._ensure_nc_success
OSError: [Errno -37] NetCDF: Write to read only: 'http://iridl.ldeo.columbia.edu/SOURCES/.OSU/.PRISM/.monthly/dods'

It works fine in 1.6.2.

However, when creating the folder ~/.esg, the OpenDAP dataset loaded in fine. in 1.6.4.

Used code:

import netCDF4
dataset = netCDF4.Dataset("http://iridl.ldeo.columbia.edu/SOURCES/.OSU/.PRISM/.monthly/dods")
jswhit commented 1 year ago

did you install both 1.6.2 and 1.6.4 via pip (using binary wheels)?

BSchilperoort commented 1 year ago

Yes, they were both installed using pip, which grabbed the binary wheels.

jswhit commented 1 year ago

it's an issue with netcdf-c 4.9.2, which is used in the 1.6.4 wheel.