Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. DATATYPE H5T_COMPOUND {
  2. H5T_IEEE_F32LE "X";
  3. H5T_IEEE_F32LE "Y";
  4. }
  5.  
  6. With[
  7. {
  8. file = FileNameJoin[{Directory[], subfolderWithExamples, "h5ex_t_cmpd.h5"}],
  9. dataSet = "DS1"
  10. },
  11. CompoundDataType`Information[file, dataSet]
  12. ]
  13. (*
  14. {"DataSpaceDimensions" -> {4},
  15. "MemberDataTypeClass" -> {0, -3, 1, 1},
  16. "MemberMemorySize" -> {8, 8, 8, 8},
  17. "MemberName" -> {"Serial number" , "Location",
  18. "Temperature (F)", "Pressure (inHg)"},
  19. "MemberOffset" -> {0, 8, 20, 28},
  20. "MemberSize" -> {8, 8, 8, 8},
  21. "MemoryDataTypeSize" -> 32,
  22. "NumberOfMembers" -> 4}
  23. *)
  24.  
  25. Needs["h5dumpImport`"]
  26. datasets = Import["testData.h5", {"Datasets"}];
  27. dumpFile = h5dump["/usr/bin/h5dump", "testData.h5", datasets[[1]]];
  28. dumpImport = h5dumpImportNew[h5dumpImport[], dumpFile];
  29. dumpImport.h5dumpImportData[All]
  30. dumpImport.h5dumpImportClose[];
  31.  
  32. {{1, 11, 111, 1111, 11111, 111111, 1111111, 1.1, 11.11, "one"},
  33. {2, 22, 222, 2222, 22222, 222222, 2222222, 2.2, 22.22, "two"},
  34. {3, 33, 333, 3333, 33333, 333333, 3333333, 3.3, 33.33, "three"}}
  35.  
  36. In[3]:= Import["ExampleData/sample2.h5", "/Compound"]
  37.  
  38. Out[3]= {
  39. {
  40. <|
  41. "Country" -> "Botswana",
  42. "Military" -> {5.3, 4.5},
  43. "Elevation" -> <|"Max" -> 4892, "Min" -> 513, "Highest point" -> "Otse Hill"|>
  44. |>,
  45. <|
  46. "Country" -> "Chile",
  47. "Military" -> {8.8, 3.7},
  48. "Elevation" -> <|"Max" -> 6893, "Min" -> 0, "Highest point" -> "Ojos del Salado"|>
  49. |>
  50. }, {
  51. <|
  52. "Country" -> "France",
  53. "Military" -> {5.3, 3.3},
  54. "Elevation" -> <|"Max" -> 4810, "Min" -> -10, "Highest point" -> "Mont Blanc"|>
  55. |>,
  56. <|
  57. "Country" -> "Laos",
  58. "Military" -> {18.9, 4.3},
  59. "Elevation" -> <|"Max" -> 2817, "Min" -> 70, "Highest point" -> "Phou Bia"
  60. |>
  61. |>
  62. }}
  63.  
  64. In[2]:= Import["ExampleData/sample2.h5", {"DataFormat", "/Compound"}]
  65.  
  66. Out[2]= <|
  67. "Class" -> "Compound",
  68. "Structure" -> <|
  69. "Country" -> "String",
  70. "Military" -> <|"Class" -> "Array", "Dimensions" -> {2}, "DataFormat" -> "Real64"|>,
  71. "Elevation" -> <|
  72. "Class" -> "Compound",
  73. "Structure" -> <|"Max" -> "Integer16", "Min" -> "Integer16", "Highest point" -> "String"|>
  74. |>
  75. |>
  76. |>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement