feat: attrs() reports every attribute; unsigned arrays stay unsigned
attrs() silently omitted any attribute whose datatype had no AttrValue variant
— including every Python bool, which h5py stores as an enum — plus complex,
compound and reference attributes, and cast unsigned 64-bit arrays to
I64Array so values above i64::MAX came back negative.
- numpy/h5py-style booleans (an enum of exactly FALSE=0 / TRUE=1 over an
integer base) decode as I64 / I64Array of 0/1.
- AttrValue::U64Array keeps unsigned arrays unsigned. Behaviour change: an
unsigned array attribute no longer arrives as I64Array; the netCDF-4 CF
helpers (_FillValue, valid_range) and the Python bindings handle it.
- AttrValue::Raw { datatype, shape, data } carries any other attribute
verbatim (also used when a value fails to decode as its declared type), so
the attribute list is always complete. Decodable with data_read against the
datatype; Python receives {"dtype", "shape", "data"}.
- Both new variants are writable, so attributes round-trip between files.
h5py interop tests cover reading 13 attribute kinds and h5py reading back a
compound and a u64 attribute written by clawhdf5.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
5dd95a6cf8
commit
97ab658c11
+12
-6
@@ -100,13 +100,19 @@ name padding, whereas v2 keeps the 8-byte name padding and has no array fields.
|
||||
|
||||
## Attributes with unsupported datatypes are silently dropped
|
||||
|
||||
**Status:** open.
|
||||
**Status:** fixed 2026-09-19.
|
||||
|
||||
**Summary:** `Dataset::attrs()` / `Group::attrs()` in the `clawhdf5` facade return
|
||||
only attributes convertible to `AttrValue`. An attribute with, e.g., a compound
|
||||
datatype is omitted from the map with no error or indication that it exists.
|
||||
Planned: surface these as an explicit `AttrValue` variant (raw bytes + datatype)
|
||||
or an error, as part of the "no silent skips" robustness work.
|
||||
**Summary:** `Dataset::attrs()` / `Group::attrs()` returned only attributes
|
||||
convertible to `AttrValue` and omitted the rest without any indication — every
|
||||
Python `bool` (an HDF5 enum), complex, compound and reference attributes. Unsigned
|
||||
64-bit arrays were also cast to `I64Array`, turning values above `i64::MAX`
|
||||
negative.
|
||||
|
||||
**Fix:** booleans decode as 0/1 integers, `AttrValue::U64Array` keeps unsigned
|
||||
arrays unsigned, and `AttrValue::Raw { datatype, shape, data }` carries any other
|
||||
attribute verbatim. Both new variants are writable. Still lossy: a
|
||||
multi-dimensional numeric attribute is returned as a flat array (its shape is
|
||||
not reported).
|
||||
|
||||
## B-tree v2 chunk index (layout v4, index type 5) is not supported
|
||||
|
||||
|
||||
Reference in New Issue
Block a user