During the course of development, there are multiple versions of our file. I need to be able to read any form of the files. I can do this via the naming conventions, which have basically remained the same. I’m stuck. I cannot figure out how to read in the Type of a table (we have changed types on some of the variable data over the life of the project). I have tried various things. A snippet of what I’m attempting to do follows:
pid = [open group]
did = H5Dopen(pid, name);
type = H5Tget_class(H5Dget_type(did));
switch (type){
case H5T_COMPOUND:
if ((H5Tget_table_info(pid, name, &fields, &records))<0){
// handle error
}
if ((H5Tget_field_info(pid, name, fnames, fsizes, foofsets, &size))<0){
// handle error
}
Up through this, everything works and I know (at least) the data size for each field – which is good, but doesn’t tell me what data type it is. And, that is where I’m stuck.
I have attempted various things. The one that I really expected to be the “right thing” is:
for (i=0; i<fields; ++i){
H5Tget_memeber_type(did, i);
Though the H5TBget_table_info() and H5TBget_field_info() calls succeed, the call into H5Tget_member_type() fails with:
HDF5-DIAG: Error detected in HDF5 (1.10.3) thread 0:
#000: H5Tcompound.c line 224 in H5Tget_member_type(): not a compound datatype
major: Invalid arguments to routine
minor: Inappropriate type
Though, I cannot figure how this isn’t a compound datatype when the class returned to type put me in the case H5T_COMPOUND.
Please point me in the right direction.
Thanks,
Andy
Edit: Corrected code blocks.