I would like to export data in HDF5 format with Mathematica 9. The Mathematica manual about Import and Export of this format can be read here.
As I'm dealing with large arrays, export often lead to 100MB+ files.
I'd like to use the HDF5 "DataEncoding"
to compress the exported data, but I can't find a way to use it.
For example, let's consider an array called
datapourrie = RandomInteger[99, {100000, 2, 5}]
First, I export it in simple ASCII format, for the purpose of comparison:
Export["expl.dat", datapourrie]
expl.dat
is correctly written, with a size of 4.1 MB.
Now, let's try in HDF5 format:
Export["expl.h5", datapourrie, {"Datasets", "mydata"}]
The file is correctly written in HDF5 format. It's 5.0 MB (the data + metadata). I tested it with a HDF5 viewer outside of Mathematica: everything's OK.
Now, I'd like to compress it, because one of the main advantages of HDF5 format is that it can be used as a binary (compressed) file format. From the Mathematica 9 manual, I read:
"DataEncoding"
can be none,"GZIP"
or"SZIP"
My problem is that I can't find a way to use this DataEncoding! I would expect the correct sentence to be:
Export["explgzip.h5", datapourrie, {"Datasets", "mydata"}, "DataEncoding" -> "GZIP"]
but it produces exactly the same file as without the "DataEncoding"
tag.
What am I doing wrong?