HDF5 2.0 native complex as a first-class type on read; Python libver=
- Datatype::parse returns Datatype::Complex for class 11 (also inside
compounds, arrays and VL types) instead of the {r, i} compound view.
- Facade: DType::Complex(Box<DType>); read_complex_f32/f64 accept it.
- h5rs dump/ls/diff print native complex as h5dump/h5ls/h5diff 2.2.0 do
(checked against a fixture written by h5py 3.16 / libhdf5 2.0.0);
dump --json keeps the {r, i} compound (hdf5-json has no complex class).
- clawhdf5-wasm reads native complex datasets as [re, im] pairs.
- Python: clawhdf5.File(path, 'w', libver=...) with h5py's values,
mapped to FileBuilder::libver_bounds; 'v108' output opens in HDF5 1.8.23.
- Docs: known-issues entry moved to Fixed (history), CHANGELOG, READMEs.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
+36
-11
@@ -315,15 +315,12 @@ wrong data.
|
||||
decoded, and external references are an error (object references
|
||||
decode). A multi-dimensional numeric attribute is returned as a flat
|
||||
array (its shape is not reported; `AttrValue::Raw` carries the shape).
|
||||
HDF5 2.0's native complex type (class 11) is read as the equivalent
|
||||
`{r, i}` compound: values are right (`Dataset::read_complex_f64`, and
|
||||
numpy complex in Python), but `raw_datatype()`, `dtype()`, `h5rs
|
||||
ls`/`dump` and the browser reader show a compound where h5dump 2.x
|
||||
prints `H5T_COMPLEX_IEEE_F64LE`, so `h5rs dump` of such a file does not
|
||||
match h5dump 2.x (h5dump 1.14 cannot read it at all). Writing class 11
|
||||
(added 2026-09-28) is opt-in (`with_native_complex_f64_data`,
|
||||
`make_native_complex_f64_type`); the Python bindings write complex
|
||||
arrays as h5py's compound only.
|
||||
HDF5 2.0's native complex type (class 11) is read as its own type since
|
||||
2026-09-29 ([fixed](#hdf5-20-native-complex-numbers-read-as-a-r-i-compound));
|
||||
writing it is opt-in (`with_native_complex_f64_data`,
|
||||
`make_native_complex_f64_type`), and the Python bindings write complex
|
||||
arrays as h5py's compound only. `h5rs dump --json` writes it as the
|
||||
`{r, i}` compound: hdf5-json (h5json 2.0.0) has no complex class.
|
||||
- **Metadata cache images** (read since 2026-09-26) differ from libhdf5 in
|
||||
that: libhdf5 fails only the first metadata read of an image it cannot
|
||||
load and then reads the file's own (possibly stale) metadata, where we
|
||||
@@ -533,8 +530,10 @@ browser (`clawhdf5-wasm`'s `openUrl`) open URLs since 2026-09-27.
|
||||
again retries it; what was fetched stays cached).
|
||||
- Tested under Node 22 and headless Chromium (Playwright's build) against
|
||||
a local server, cross-origin included; not in Firefox or Safari.
|
||||
- Compound, reference, opaque, bitfield, time and VL-sequence datasets are
|
||||
refused with an error naming the type; attributes of those types come back
|
||||
- Compound (h5py's complex numbers, a compound `{r, i}`, included),
|
||||
reference, opaque, bitfield, time and VL-sequence datasets are
|
||||
refused with an error naming the type (HDF5 2.0 native complex datasets
|
||||
read, as `[re, im]` pairs); attributes of those types come back
|
||||
as `value: null` with their `dtype`. (VL strings read, with h5py's
|
||||
values, through the same `VlResolver` as `File` and `h5rs`.)
|
||||
- No Zstd or SZIP (both link C): such datasets fail with
|
||||
@@ -669,6 +668,32 @@ netCDF4-python-written files with netCDF-C itself, and
|
||||
`corpus_vs_netcdf_c` the corpus (420 of 429 match; the rest are in
|
||||
[NetCDF-4: differences from netCDF-C](#netcdf-4-differences-from-netcdf-c)).
|
||||
|
||||
## HDF5 2.0 native complex numbers read as a `{r, i}` compound
|
||||
|
||||
**Status:** fixed 2026-09-29 (branch `feat/complex-first-class`; PR not
|
||||
yet opened). Affected v2.2.0 to v2.7.0 (class 11 has parsed since v2.2.0)
|
||||
and `main` until then. Listed until now under
|
||||
[HDF5 features still unsupported](#hdf5-features-still-unsupported).
|
||||
|
||||
A class-11 datatype (`H5T_COMPLEX_IEEE_F64LE`, ...) parsed into the
|
||||
equivalent compound `{r, i}`. Values were right (`read_complex_f64`,
|
||||
numpy complex in Python), but `raw_datatype()`, `dtype()`, `h5rs ls`/`dump`
|
||||
and the browser reader showed a compound, so `h5rs dump` did not match
|
||||
h5dump 2.x, the browser refused the dataset, and a parsed type written
|
||||
back out became a compound. `Datatype::parse` now returns
|
||||
`Datatype::Complex` (in compounds, arrays and VL types too),
|
||||
`Dataset::dtype()` is `DType::Complex(..)`, `h5rs` prints what h5dump,
|
||||
h5ls and h5diff 2.2.0 print (checked on tank, 2026-09-29, against a file
|
||||
written by h5py 3.16 / libhdf5 2.0.0:
|
||||
`cargo test -p clawhdf5-tools --test native_complex_dump`), and the
|
||||
browser reads `[re, im]` pairs.
|
||||
|
||||
**What users must do:** code that matched a native complex type as a
|
||||
`Datatype::Compound` (or a `DType::Compound` of `r`/`i`) must match
|
||||
`Datatype::Complex` / `DType::Complex`, or take the compound view with
|
||||
`Datatype::complex_as_compound`; exhaustive `match`es over `DType` need a
|
||||
`Complex` arm. Files are unchanged; nothing needs rewriting.
|
||||
|
||||
## NetCDF-4: variables' dimensions are guessed from sizes
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user