-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Description
This code:
from netCDF4 import Dataset
filename = '/home/takluyver/Code/xray/test/data/example_1.nc'
d = Dataset(filename, mode='r', clobber=True, diskless=False, persist=False, format='NETCDF4')
v = d.variables['rh']
del d
print(v.shape)
Fails with:
Traceback (most recent call last):
File "idbug2.py", line 13, in <module>
print(v.shape)
File "netCDF4.pyx", line 2556, in netCDF4.Variable.shape.__get__ (netCDF4.c:31870)
msg = 'filling on, default _FillValue of %s used\n' % fillval
File "netCDF4.pyx", line 2527, in netCDF4.Variable._getdims (netCDF4.c:31498)
else:
RuntimeError: NetCDF: Not a valid ID
I believe I've traced this to PR #219. Variables no longer hold a reference to their group, so if the group and the dataset are garbage collected, the variable becomes unusable.
CC @shoyer - this is the underlying cause of the error in xray we discussed with netCDF 1.0.9.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels