Comments (5)
@fsvenson Thanks for raising this. Could you share the full error traceback please?
from h5netcdf.
It happened when reading via xarray
:
Traceback (most recent call last):
File "/home/efes/dev/issues/DATA-375-3d-vis/test.py", line 38, in <module>
bm = xr.open_dataset(
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/backends/api.py", line 540, in open_dataset
backend_ds = backend.open_dataset(
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/backends/h5netcdf_.py", line 419, in open_dataset
ds = store_entrypoint.open_dataset(
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/backends/store.py", line 28, in open_dataset
vars, attrs = store.load()
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/backends/common.py", line 128, in load
(_decode_variable_name(k), v) for k, v in self.get_variables().items()
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/backends/h5netcdf_.py", line 221, in get_variables
return FrozenDict(
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/core/utils.py", line 469, in FrozenDict
return Frozen(dict(*args, **kwargs))
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/backends/h5netcdf_.py", line 222, in <genexpr>
(k, self.open_store_variable(k, v)) for k, v in self.ds.variables.items()
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/backends/h5netcdf_.py", line 188, in open_store_variable
attrs = _read_attributes(var)
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/xarray/backends/h5netcdf_.py", line 65, in _read_attributes
for k, v in h5netcdf_var.attrs.items():
File "/usr/lib/python3.10/_collections_abc.py", line 906, in __iter__
yield (key, self._mapping[key])
File "/home/efes/.cache/pypoetry/virtualenvs/meta-world-v48m9Vhg-py3.10/lib/python3.10/site-packages/h5netcdf/attrs.py", line 72, in __getitem__
if not np.isscalar(output) and len(output) == 1:
TypeError: object of type 'h5py.h5r.Reference' has no len()
from h5netcdf.
Thanks @fsvenson, that's helpful. So if you just want to get back the reference we could do this as suggested. I've no idea about the implications this might have downstream. What does netcdf4 engine return in this situation?
from h5netcdf.
I looks like netcdf4-python is just ignoring attributes with type reference.
In the past h5netcdf
added these features which are unsupported in netcdf4/netcdf-c as invalid_netcdf
.
Looking at
Lines 1127 to 1148 in 18c86f4
dtype="reference"
is already checked. So we can already write references with kwarg invalid_netcdf=True
. This is most likely a regression which need to be taken care of in __getitem__
as you already suggested.
We need to check if that collides with the HIDDEN attributes somehow.
from h5netcdf.
@fsvenson Sorry, this fell through the cracks. Are you still in the works with this? Would you be able to create a MCVE producing such file (eg via h5py) or provide a small file to play with? Thanks!
from h5netcdf.
Related Issues (20)
- Can numpy objects be supported? HOT 5
- h5netcdf writes invalid netcdf to existing netcdf files HOT 6
- Corrupted headers when serialising using dask.distributed client HOT 9
- Test failures with NetCDF 4.9.0 HOT 6
- Remove h5py2 related code and CI builds HOT 3
- FAILED h5netcdf/tests/test_h5netcdf.py::test_group_names HOT 6
- AttributeError for '_phony_dim_count' when trying to convert a file made with h5py HOT 12
- Tests test_more_than_7_attr_creation_track_order and test_bool_slicing_length_one_dim fail in the test suite HOT 18
- very slow partial reading when saved with index shift HOT 10
- h5py minimum version update? HOT 5
- Improving performance for h5netcdf HOT 7
- Documentation request: Alternative way to obtain h5netcdf HOT 1
- Segmentation fault after upgrading to h5netcdf==1.1.0 HOT 14
- support for HDF5 dimension scales with null dataspace HOT 2
- Modifying attributes safely is not possible with all datasets. HOT 10
- Better Error for illegal variable names HOT 3
- md5 checksum mismatch for identical files/data HOT 7
- Question: does `h5netcdf` bring in the entire data from a netCDF file on a remote disk (like S3)? HOT 5
- Provide an example with time dimension readable by paraview HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h5netcdf.