issues: 228821088
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
228821088 | MDU6SXNzdWUyMjg4MjEwODg= | 1409 | Importing h5py corrupts xarray's IO | 10050469 | closed | 0 | 3 | 2017-05-15T19:37:13Z | 2017-05-21T09:31:49Z | 2017-05-21T09:31:49Z | MEMBER | Not sure if this is an xarray issue, a netCDF4 or a h5py one, but I found that importing h5py is not a good idea if you want to write to netcdf4 afterwards:
Errors with: ```RuntimeError Traceback (most recent call last) <ipython-input-7-924aff64174f> in <module>() 2 import xarray as xr 3 ds = xr.Dataset({'x': [1, 2, 3]}) ----> 4 ds.to_netcdf('test.nc4') /home/mowglie/Documents/git/xarray/xarray/core/dataset.py in to_netcdf(self, path, mode, format, group, engine, encoding, unlimited_dims) 974 return to_netcdf(self, path, mode, format=format, group=group, 975 engine=engine, encoding=encoding, --> 976 unlimited_dims=unlimited_dims) 977 978 def unicode(self): /home/mowglie/Documents/git/xarray/xarray/backends/api.py in to_netcdf(dataset, path_or_file, mode, format, group, engine, writer, encoding, unlimited_dims) 581 try: 582 dataset.dump_to_store(store, sync=sync, encoding=encoding, --> 583 unlimited_dims=unlimited_dims) 584 if path_or_file is None: 585 return target.getvalue() /home/mowglie/Documents/git/xarray/xarray/core/dataset.py in dump_to_store(self, store, encoder, sync, encoding, unlimited_dims) 913 914 store.store(variables, attrs, check_encoding, --> 915 unlimited_dims=unlimited_dims) 916 if sync: 917 store.sync() /home/mowglie/Documents/git/xarray/xarray/backends/common.py in store(self, variables, attributes, args, kwargs) 244 cf_variables, cf_attrs = cf_encoder(variables, attributes) 245 AbstractWritableDataStore.store(self, cf_variables, cf_attrs, --> 246 args, **kwargs) 247 248 /home/mowglie/Documents/git/xarray/xarray/backends/common.py in store(self, variables, attributes, check_encoding_set, unlimited_dims) 213 self.set_attributes(attributes) 214 self.set_variables(variables, check_encoding_set, --> 215 unlimited_dims=unlimited_dims) 216 217 def set_attributes(self, attributes): /home/mowglie/Documents/git/xarray/xarray/backends/netCDF4_.py in set_variables(self, args, kwargs) 286 def set_variables(self, args, kwargs): 287 with self.ensure_open(autoclose=False): --> 288 super(NetCDF4DataStore, self).set_variables(*args, kwargs) 289 290 def prepare_variable(self, name, variable, check_encoding=False, /usr/lib/python3.5/contextlib.py in exit(self, type, value, traceback) 75 value = type() 76 try: ---> 77 self.gen.throw(type, value, traceback) 78 raise RuntimeError("generator didn't stop after throw()") 79 except StopIteration as exc: /home/mowglie/Documents/git/xarray/xarray/backends/common.py in ensure_open(self, autoclose) 282 self.close() 283 else: --> 284 yield 285 286 def assert_open(self): /home/mowglie/Documents/git/xarray/xarray/backends/netCDF4_.py in set_variables(self, args, kwargs) 286 def set_variables(self, args, kwargs): 287 with self.ensure_open(autoclose=False): --> 288 super(NetCDF4DataStore, self).set_variables(*args, kwargs) 289 290 def prepare_variable(self, name, variable, check_encoding=False, /home/mowglie/Documents/git/xarray/xarray/backends/common.py in set_variables(self, variables, check_encoding_set, unlimited_dims) 226 target, source = self.prepare_variable( 227 name, v, check, unlimited_dims=unlimited_dims) --> 228 self.writer.add(source, target) 229 230 def set_necessary_dimensions(self, variable, unlimited_dims=None): /home/mowglie/Documents/git/xarray/xarray/backends/common.py in add(self, source, target) 167 else: 168 try: --> 169 target[...] = source 170 except TypeError: 171 # workaround for GH: scipy/scipy#6880 netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Variable.setitem (netCDF4/_netCDF4.c:48315)() netCDF4/_netCDF4.pyx in netCDF4._netCDF4.Variable._put (netCDF4/_netCDF4.c:49808)() RuntimeError: NetCDF: HDF error ``` Note that using For the record: - h5py: 2.7.0 - xarray: 0.9.5-5-gfd6e36e - system: linux |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1409/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |