Fortran Logicals in HDF5

Is there a way to store logicals using HDF5, or do I need to convert them to integer values? I have data structures in a Fortran program that include logical type components that I am trying to store in HDF5 format.

James,

  1. There is currently no pre-defined datatype for Booleans, Logicals, etc. Improvisation (e.g., integer conversion) is your only option for now.
  2. Don’t give up hope! Believe it or not, at The HDF Group, we also practice Boolean logic, most of the time. We talk about support for Booleans almost every week and, if I had to bet money, it’ll happen this year(?). If and when we introduce them, we might want to take a slightly more general approach, and, in addition to the classics (true, false), leave the backdoor open for missing and meaningless. Maybe we should have “narrow” and “wide” Booleans?

Best, G.

Thanks! It would be great to have that option–I’m working with a code that has boolean variables as components of defined types, and the integer conversion is awkward…