difference in check_dtype for vlen compared to h5py
Maintainers usually reply within 1 day
@davidhassell is already working on this.
Since Jun 24, 2026.
Assessment
This issue has not been assessed yet.
Description
pyfive.check_dtype(vlen=var.dtype) and h5py.check_dtype(vlen=var.dtype) return different. This fails in downstream xarray when using engine="h5netcdf" with pyfive backend.
In xarray check_dtype is used to check for vlen strings and decodes it from object to U. See below.
MCVE, pyfive/h5netcdf/xarray latest versions, h5py=13.5.1, hdf5=1.14.6
import h5py
import pyfive
import xarray as xr
import os
input_string = ["foó", "bár", "baź"]
original = xr.Dataset({"x": input_string})
kwargs = dict(encoding={"x": {"dtype": str}})
fname = "test.nc"
original.to_netcdf(fname, engine="h5netcdf", **kwargs)
print("----- PYFIVE --------------------")
with pyfive.File("test.nc") as fh:
var = fh["x"]
print(pyfive.check_dtype(vlen=var.dtype))
print(var.dtype.metadata)
print(fh["x"][...])
print("\n----- H5PY --------------------")
with h5py.File("test.nc") as fh:
var = fh["x"]
print(h5py.check_dtype(vlen=var.dtype))
print(var.dtype.metadata)
print(fh["x"][...])
backend = "h5py"
os.environ["H5NETCDF_READ_BACKEND"] = backend
print(f"\n----- xarray - h5netcdf - {backend} --------------------")
with xr.open_dataset("test.nc", engine="h5netcdf") as ds:
print(ds["x"])
backend = "pyfive"
os.environ["H5NETCDF_READ_BACKEND"] = backend
print(f"\n----- xarray - h5netcdf - {backend} --------------------")
with xr.open_dataset("test.nc", engine="h5netcdf") as ds:
print(ds["x"])
----- PYFIVE --------------------
string_info(encoding='ascii', length=None)
{'vlen': <class 'str'>}
['foó' 'bár' 'baź']
----- H5PY --------------------
<class 'str'>
{'vlen': <class 'str'>}
[b'fo\xc3\xb3' b'b\xc3\xa1r' b'ba\xc5\xba']
----- xarray - h5netcdf - h5py --------------------
<xarray.DataArray 'x' (x: 3)> Size: 36B
array(['foó', 'bár', 'baź'], dtype='<U3')
Coordinates:
* x (x) <U3 36B 'foó' 'bár' 'baź'
----- xarray - h5netcdf - pyfive --------------------
<xarray.DataArray 'x' (x: 3)> Size: 24B
array(['foó', 'bár', 'baź'], dtype=object)
Coordinates:
* x (x) object 24B 'foó' 'bár' 'baź'
- Dominant language
- Python
- Stars
- 105
- Forks
- 29
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NCAS-CMS/pyfive
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
further optimisationPossibly taken @bnlawrence claimed this 47 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 18/100
Maintainers usually reply within 1 day
-
pyfive and hdf5>=2Openinstallation
Difficulty 4/5 3-5 days Newbie friendliness 25/100
NCAS-CMS/pyfive#279 · 2 comments ·
Maintainers usually reply within 1 day
-
VDS datasets silently return NoneMay be free again @bnlawrence claimed this 48 days ago, and no pull request is open. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
NCAS-CMS/pyfive#275 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
question
Difficulty 5/5 Over a week Newbie friendliness 35/100
NCAS-CMS/pyfive#219 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
eegprep-lean: set channel types from the Zarr group's channel_typePossibly taken @claude claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
sccn/eegprep#668 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
blacklanternsecurity/bbot#3679 ·
Maintainers usually reply within 2 days
-
Link Checker ReportOpenBot Type: Bug Type: Documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
speakeasy-api/speakeasy#2159 ·
Maintainers usually reply within 1 day