HDF5.jl icon indicating copy to clipboard operation
HDF5.jl copied to clipboard

The H5T_BITFIELD class should not be directly mapped to Bool

Open mkitti opened this issue 10 months ago • 1 comments

https://github.com/JuliaIO/HDF5.jl/pull/540 mapped H5T_NATIVE_B8 to Bool. However, this seems be an error. A Bool should bit a H5T_BITFIELD with a precision of 1 as described by PyTables.

H5T_BITFIELD: This class is used to represent the Bool type. Such a type must be build using a H5T_NATIVE_B8 datatype, followed by a HDF5 H5Tset_precision call to set its precision to be just 1 bit.

h5py chooses to read the class of H5T_BITFIELD as unsigned integers: https://github.com/h5py/h5py/pull/1889

@tamasgal I'm considering requiring the precision to be set to 1 to interpret the value as a Bool. Rather I think we should consider mapping H5T_NATIVE_B8 to a UInt8.

mkitti avatar Apr 11 '24 21:04 mkitti

Oh, yes, I think you are right. Mapping H5T_NATIVE_B8 to a UInt8 would make most sense to me too.

tamasgal avatar Apr 11 '24 21:04 tamasgal