HDF5DotNet an unknown compound dataset


#1

Hi everybody !

I've got a problem trying to read some compound dataset in HDF5 file using
HDF5DotNet Wrapper.

How to read a compound dataset without knowing in advance the memory
structure in C#?.

All the examples in C using structures already match the data structure of
the compound dataset.

Here is a snippet of code i've used:

                case H5T.H5TClass.COMPOUND:

                    TableFieldInfo oTableFieldInfo =
H5TB.getFieldInfo(oGroupId,"unite");

                    H5DataSetId oDatasetId = H5D.open(oGroupId,
a_strNomDataset);
                    H5DataTypeId oDataTypeId = H5D.getType(oDatasetId);

                    // Get the number of fields of the compound dataset
                    int numFields = H5T.getNMembers(oDataTypeId);

                    // Look at each of the member fields
                    for (int i = 0; i < numFields; i++)
                    {
                        H5T.H5TClass memberClass =
H5T.getMemberClass(oDataTypeId, i);

                        string memberName =
H5T.getMemberName(oDataTypeId,i);
                        H5DataTypeId memberDataTypeId =
H5T.getMemberType(oDataTypeId, i);
                        int nOffset = H5T.getMemberOffset(oDataTypeId, i);
                        int nLength = (int)H5T.getSize(memberDataTypeId);

                        Console.WriteLine(String.Format("Member Name: {0};
Class: {1}; Length: {2}", memberName, memberClass.ToString(),
nLength.ToString()));

                        H5T.close(memberDataTypeId);
                    }

                    H5D.read(oDataSetId, oDataTypeId, new
H5Array<???>(???));

                    /* For Testing purpose */
                    IntPtr[] off = oTableFieldInfo.fieldOffset;
                    IntPtr[] size = oTableFieldInfo.fieldSize;
                    IntPtr[] type_taille = oTableFieldInfo.typeSize;

                    break;
By what i can replace the interrogation marks at the line:
H5D.read(oDataSetId, oDataTypeId, new H5Array<???>(???));

I've rewrite the H5BTtead_fields_name high-level function in C# but the
problem remain because we need to put a structure for the H5D.read()
function!

Thanks for help !


#2

Rackamm, how are you? I'M traveling at the moment and will get back to you later in the week/early next week. The general approach I'VE taken involves dynamically generating/loading .NET code. You'd read the dataset into memory as a byte array and then use BitConverter and the information you've gathered using the H5T interface to create the kinds of .NET objects you'll use downstream.

Best, G.


#3

Was this answered? I’m dealing with the same question (C#, reading unknown compound attributes).

Thanks.