Hi,
I am using Visual Studio (C#) and HDF5 P/Invoke.
I have made an HDF5 file with groups and datasets with attributes of
different datatypes (in this case, let's say it is an integer, saved as
H5T.NATIVE_INT32, but I have the same problem for other datatypes). Now I
am making a code to read data from the HDF5 file. To read the attribute
value, I first need to determine the data type of the attribute value. I
have tried the following:
attributeId = H5A.open(groupId, attributeName, H5P.DEFAULT);
hid_t attributeSpace = H5A.get_space(attributeId);
H5S.class_t extentType = H5S.get_simple_extent_type(attributeSpace);
hid_t typeId = H5A.get_type(attributeId);
attributeClass = H5T.get_class(typeId);
type = H5T.get_native_type(typeId, H5T.direction_t.DEFAULT);
H5T.close(typeId);
However, the resulting variable type does not match with the
H5T.NATIVE_INTEGER type, or any other H5T type I can think of. In fact, even
H5T.get_native_type(H5T.NATIVE_INT, H5T.direction_t.DEFAULT) ==
H5T.NATIVE_INT
returns false, so it appears as if H5T.get_native_type() does not return a
type, but perhaps a copy or a pointer of it, which is not identical to the
type itself. Is this expected behaviour or a bug? How do I correctly figure
out the type of an attribute value?
Best regards,
Johan Lindberg