Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica HDF5 and compound arrays

Does anybody have a workaround in Mathematica for reading HDF5 compound arrays? I have a simple 2D compound type (int/float) in a table but it is currently ignored.

An example HDF5 type might be:

DATATYPE H5T_COMPOUND {
    H5T_IEEE_F32LE "X";
    H5T_IEEE_F32LE "Y";
}
like image 857
user530486 Avatar asked Dec 19 '10 14:12

user530486


1 Answers

There is a package, apparently created by Scot Martin here.

As far as I can see, it implements a lot of the HDF5 functionality, including Compound Types.

Here is a brief snippet from 11 HDF5HighLevel Examples.nb in the package:

With[
 {
  file = FileNameJoin[{Directory[], subfolderWithExamples, "h5ex_t_cmpd.h5"}],
  dataSet = "DS1"
  },
 CompoundDataType`Information[file, dataSet]
 ]
(*
{"DataSpaceDimensions" -> {4}, 
 "MemberDataTypeClass" -> {0, -3, 1, 1},  
 "MemberMemorySize" -> {8, 8, 8, 8}, 
 "MemberName" -> {"Serial number"  , "Location", 
                  "Temperature (F)", "Pressure (inHg)"},  
 "MemberOffset" -> {0, 8, 20, 28}, 
 "MemberSize" -> {8, 8, 8, 8}, 
 "MemoryDataTypeSize" -> 32, 
 "NumberOfMembers" -> 4}
*)

HTH!

like image 175
Dr. belisarius Avatar answered Oct 21 '22 22:10

Dr. belisarius