I have an HDF5 file I am trying to read. According to the DataType, there are around 25 items. I only need a couple of the items. The DataSpace tells me there are 7500 entries of the data structure. For simple items like an integer, I have successfully read all 7500 integers. What I am having problems with is I have an H5T_ARRAY of 1000 H5T_COMPOUND objects. Each Compound object contains two Floats. So there are 7500 instances of 1000 Compound element arrays in my data that I cannot read.

According to the DataType here is the snippet relevant to my code.

HDF5 "raw_150913_130019_31095_0020_001_NB1.be01" {
GROUP "/" {
DATATYPE "DRx3" H5T_COMPOUND {
H5T_ARRAY { [5] H5T_STD_U32LE } "guid";
H5T_STD_I32LE "version";
H5T_IEEE_F64LE "d_tot";
H5T_STD_U32LE "dwl_start_sec";
..... // More single item elements left out
H5T_STD_U32LE "clock_dec_factor";
H5T_STD_U32LE "num_samps_per_swp";
H5T_STD_U32LE "sweep_index";
H5T_STD_U32LE "sequence_dummy";
H5T_ARRAY { [1000] H5T_COMPOUND {
H5T_IEEE_F32LE "f_i";
H5T_IEEE_F32LE "f_q";
} } "wb_data";
}
DATASET "DRx3data" {
DATATYPE "/DRx3"
DATASPACE SIMPLE { ( 7500 ) / ( H5S_UNLIMITED ) }
DATA {
(0): {
[ 352430272, 25602, 2314, 1442149219, 43629 ],
1,
1.44215e+09,
1442149219,
0,
1,
1,
0,
1,
0,
0,
0,
3,
0,
0,
0,
0,
1,
31095000,
20000,
0,
1000,
1000,
1,
1000,
[ {
1.09068e+09,
4.53469e+08
}, {
4.03303e+08,
4.11846e+08
}, {
-1.35295e+08,
-1.70107e+08
}, {
9.49486e+07,
5.58919e+07
}, {
-6.65301e+07,
-7.93531e+06
}, {

I have set stuff up with the following code:

// Open the file, dataset, and dataspace
std::string path = "/data/testFile.be01";
H5::H5File file(path, H5F_ACC_RDONLY);
H5:ataSet dataset = file.openDataSet("DRx3data");
H5:ataSpace dataspace = dataset.getSpace();
H5:ataType datatype = file.openDataType("DRx3");

// Get the number of elements and number of samples
int nelems = dataspace.getSimpleExtentNpoints();
int numSampsPerSweep[nelems];

// Create number of samples type
H5::CompType sampsType(sizeof(uint));
sampsType.insertMember("num_samps_per_swp", 0, H5::PredType::STD_U32LE);
dataset.read(numSampsPerSweep, sampsType);

So in this code, I can successfully read "num_samps_pe_swp" and store all 7500 instances of it. But I am uncertain how to read "f_i" and "f_q" from "wb_data" and also am uncertain how to tell there are 1000 elements like the DataType says. Here is what I have tried, but has not worked.

H5::CompType iqDataType(sizeof(complex_t));
iqDataType.insertMember("f_i", HOFFSET(complex_t, f_i), H5::PredType::NATIVE_FLOAT);
iqDataType.insertMember("f_q", HOFFSET(complex_t, f_q), H5::PredType::NATIVE_FLOAT);
complex_t* iqData = new complex_t[(nelems * 1000)]; // 1000 hard coded until I learn how to read how big the array is
dataset.read(iqData, iqDataType);

Any suggestions on how to read an array and/or a Compound type would be greatly appreciated!
Thanks!
Todd