HDFGroup / hdf5-json

Specification and tools for representing HDF5 in JSON
https://support.hdfgroup.org/documentation/hdf5-json/latest/
Other
73 stars 25 forks source link

jsontoh5 fails with committed type #23

Closed jreadey closed 9 years ago

jreadey commented 9 years ago

Example: python jsontoh5.py ../data/json/committed_type.json out/comitted_type.h5

jreadey commented 9 years ago

The above conversion doesn't crash, but creates a HDF5 where the dataset is not using the committed type.
Output of h5dump:

HDF5 "out/committed_type.h5" {
GROUP "/" {
   DATASET "DS1" {
      DATATYPE  H5T_COMPOUND {
         H5T_STD_I64BE "Serial number";
         H5T_STRING {
            STRSIZE 3;
            STRPAD H5T_STR_NULLPAD;
            CSET H5T_CSET_ASCII;
            CTYPE H5T_C_S1;
         } "Location";
         H5T_IEEE_F64BE "Temperature (F)";
         H5T_IEEE_F64BE "Pressure (inHg)";
      }
      DATASPACE  SIMPLE { ( 4 ) / ( 4 ) }
      DATA {
      (0): {
            12345678,
            "SEA",
            56.3,
            29.35
         },
      (1): {
            12333343,
            "LAX",
            73.3,
            32.33
         },
      (2): {
            14543645,
            "PDX",
            65.3,
            31.23
         },
      (3): {
            14344545,
            "IDA",
            72.3,
            30.43
         }
      }
   }
   DATATYPE "Sensor_Type" H5T_COMPOUND {
      H5T_STD_I64BE "Serial number";
      H5T_STRING {
         STRSIZE 3;
         STRPAD H5T_STR_NULLPAD;
         CSET H5T_CSET_ASCII;
         CTYPE H5T_C_S1;
      } "Location";
      H5T_IEEE_F64BE "Temperature (F)";
      H5T_IEEE_F64BE "Pressure (inHg)";
   }
}
}
jreadey commented 9 years ago

Fix checked in. Added hdf5dbTest case: testCreateCommittedCompoundTypeDataset that repos the error and verifies the fix.