issues: 446016536
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
446016536 | MDU6SXNzdWU0NDYwMTY1MzY= | 2974 | Problems reading grouped netCDF file generated with h5netcdf engine | 1991007 | closed | 0 | 3 | 2019-05-20T09:35:54Z | 2019-05-21T07:13:01Z | 2019-05-21T03:08:11Z | NONE | Code Sample, a copy-pastable example if possible```python import xarray as xr data1 = [[1, 2], [3, 4]] y1 = [1, 2] x1 = [1, 2] data2 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] y2 = [1, 2, 3] x2 = [1, 2, 3] dataset1 = xr.Dataset({'data1': xr.DataArray(data1, dims=('y', 'x'), coords={'y': y1, 'x': x1})}) dataset2 = xr.Dataset({'data2': xr.DataArray(data2, dims=('y', 'x'), coords={'y': y2, 'x': x2})}) dataset1.to_netcdf('test.nc', mode='w', group='grp1', engine='h5netcdf') dataset2.to_netcdf('test.nc', mode='a', group='grp2', engine='h5netcdf') xr.open_dataset('test.nc', group='grp1', engine='h5netcdf') # works xr.open_dataset('test.nc', group='grp1', engine='netcdf4') # fails ``` Traceback:
```
Traceback (most recent call last):
File "test_xr.py", line 21, in <module>
print(xr.open_dataset('test.nc', group='grp1', engine='netcdf4'))
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/backends/api.py", line 394, in open_dataset
ds = maybe_decode_store(store)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/backends/api.py", line 324, in maybe_decode_store
drop_variables=drop_variables, use_cftime=use_cftime)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/conventions.py", line 480, in decode_cf
ds = Dataset(vars, attrs=attrs)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/dataset.py", line 383, in __init__
self._set_init_vars_and_dims(data_vars, coords, compat)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/dataset.py", line 405, in _set_init_vars_and_dims
data_vars, coords, compat=compat)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/merge.py", line 377, in merge_data_and_coords
indexes=indexes)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/merge.py", line 446, in merge_core
expanded = expand_variable_dicts(aligned)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/merge.py", line 222, in expand_variable_dicts
var = as_variable(var, name=name)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/variable.py", line 117, in as_variable
obj = obj.to_index_variable()
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/variable.py", line 408, in to_index_variable
encoding=self._encoding, fastpath=True)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/variable.py", line 1825, in __init__
self._data = PandasIndexAdapter(self._data)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/indexing.py", line 1219, in __init__
self.array = utils.safe_cast_to_index(array)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/utils.py", line 78, in safe_cast_to_index
index = pd.Index(np.asarray(array), **kwargs)
File "/cmsaf/nfshome/routcm/Modules_CentOS/python/3.7.2/lib/python3.7/site-packages/numpy/core/numeric.py", line 501, in asarray
return array(a, dtype, copy=False, order=order)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/indexing.py", line 510, in __array__
return np.asarray(array[self.key], dtype=None)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/backends/netCDF4_.py", line 64, in __getitem__
self._getitem)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/core/indexing.py", line 778, in explicit_indexing_adapter
result = raw_indexing_method(raw_key.tuple)
File "/cmsaf/cmsaf-ops3/sfinkens/virtualenvs/h5netcdf/lib/python3.7/site-packages/xarray/backends/netCDF4_.py", line 75, in _getitem
array = getitem(original_array, key)
File "netCDF4/_netCDF4.pyx", line 4317, in netCDF4._netCDF4.Variable.__getitem__
File "netCDF4/_netCDF4.pyx", line 5249, in netCDF4._netCDF4.Variable._get
File "netCDF4/_netCDF4.pyx", line 1842, in netCDF4._netCDF4._ensure_nc_success
RuntimeError: NetCDF: Start+count exceeds dimension bound
```
Output of group: grp1 { dimensions: y = 3 ; x = 3 ; variables: int64 data1(y, x) ; int64 x(x) ; int64 y(y) ; data: data1 = NetCDF: Start+count exceeds dimension bound Location: file vardata.c; line 478 ``` Problem descriptionIf datasets with different coordinates have been written to different netCDF groups using the If the file is generated using the Expected OutputSince the file is readable by the Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/2974/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |