Message Boards Message Boards

0
|
5201 Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Export in "Real32" format with correct version "DataFormat"?

Posted 8 years ago

Hi! Could you please suggest correct version for Export in "Real32" format? It doesn't work

Export["test.h5", RandomReal[1, {5, 5, 5}], {"Real32", "DataFormat"}]
POSTED BY: Rodion Stepanov
5 Replies
Export["test.h5", RandomReal[1, {5, 5, 5}], "Real32"]
POSTED BY: Sander Huisman

thanks, it works to export but then for Import it is getting 1D array instead of 3D

In[163]:= Dimensions[Import["test.h5", "Real32"]]

Out[163]= {125}

Can it be proper?

POSTED BY: Rodion Stepanov

Binary files ("Real32" format) just store data as a concatenation of numbers, just 0s and 1s after each other, there is no dimensional data, units, et cetera. If you want HDF5 format you can do so like this:

Export["real32.h5", {"Datasets" -> {"/data" -> RandomReal[{0, 10}, {10, 10}]}, "DataFormat" -> {"Real32"}}, "Rules"]

and import again:

Import["real32.h5", "Data"]
POSTED BY: Sander Huisman

I would never find this solution. It deserve to be in the tutorial. Thank a lot! Best regards to Romain Volk and Mickaƫl Bourgoin :)

POSTED BY: Rodion Stepanov

Under Import and Export of the HDF5 documentation page it says:

Export["file.h5",{Subscript[elem, 1]->Subscript[expr, 1],Subscript[elem, 2]->Subscript[expr, 2],[Ellipsis]},"Rules"] uses rules to specify the elements to be exported.

But there is no example of that, and 'expr' and 'elem' are not clear what they are, so there is room for improvement.

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract