I am trying to export some largish integer arrays to HDF5 and know that every entry in them would fit into an unsigned 8 bit integer array. As the default "DataFormat" for export that Mathematica is using is a 32bit integer array the resulting files are unnecessarily large. Does anyone know the correct syntax to export such an integer array as an 8 bit integer dataset?
I found the following suggestions in this answer and a comment to this answer:
Export["int8.h5",
RandomInteger[{2^8 - 1}, {100, 100}],
"DataFormat" -> {"UnsignedInteger8"}
]
Export["int8.h5",
RandomInteger[{2^8 - 1}, {100, 100}],
{"UnsignedInteger8", "DataFormat"}
]
but they both seem to not work at all or not create the expected data representation in the files, which can be checked by either HDFView (which I consider authorative) or Mathematica itself with:
Import["int8.h5","DataFormat"]