Another side effect of #906 it seems
import netCDF4 import numpy as np with netCDF4.Dataset('test.nc','w') as f: f.createDimension('d1',3) f.createDimension('d2',None) f.createVariable('v1',np.float,('d1','d1',)) f['v1'][0:1] = np.arange(3)
Running this on 1.5.1.1
gives
1.5.1.1
(0, 3)
Traceback (most recent call last):
File "01-160948.py", line 23, in <module>
f['v1'][0:1] = np.arange(3)
File "netCDF4/_netCDF4.pyx", line 4796, in netCDF4._netCDF4.Variable.__setitem__
File "/home/cpa/.pyenv/versions/miniconda2-4.3.30/envs/pytesmo/lib/python3.7/site-packages/netCDF4/utils.py", line 374, in _StartCountStride
datashapenew = datashapenew + (datashape[i],)
IndexError: tuple index out of range
on 1.5.0.1 it works and gives
The following is also broken so it is not only for the first element:
import netCDF4 import numpy as np with netCDF4.Dataset('test.nc','w') as f: f.createDimension('d1',3) f.createDimension('d2',None) f.createVariable('v1',np.float,('d2','d1')) print(f['v1'].shape) f['v1'][0] = np.arange(3) print(f['v1'].shape) f['v1'][1:2] = np.arange(3) print(f['v1'].shape)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4