You could try making your dataset using an N-bit type based on a copy of an 8-bit type, and then using the N-bit filter. You can then end up handling each Boolean value as a byte in memory, but they’re stored more compactly on disk. Might even compress well too.
Dan From: Hdf-forum [mailto:[email protected]] On Behalf Of [email protected] Sent: 10 February 2016 21:23 To: HDF Users Discussion List Subject: Re: [Hdf-forum] Boolean values I don’t think the hdf Boolean is any different than an integer. If you create a Boolean dataset and query the type, it comes back that it’s an int. You can’t tell after the fact that the data was specified as Boolean. I suppose you can create a packed Boolean type, but you’ll have to do the grunt work of muxing and de-muxing the Booleans. Ultimately, I stuck my bools in separate sbytes. From: Hdf-forum [mailto:[email protected]] On Behalf Of David Sent: Wednesday, February 10, 2016 4:12 PM To: HDF Users Discussion List Subject: [Hdf-forum] Boolean values Is there a way to read/write compact boolean or bitfield values? I see the bitfield types but I can't understand how it's different than writing ints. The API examples show hand packing/unpacking of the bits. How is H5T_NATIVE_B8 different from H5T_NATIVE_UINT8? Ideally I'd like 8-bit bools in memory packed into 1-bit bools on disk so it's easy to work with when loaded but stored compactly. Thanks, David
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org Twitter: https://twitter.com/hdf5
