type_class argument for H5LTget_attribute_info not properly documented


#1

In the documentation for H5LTget_attribute_info at <https://support.hdfgroup.org/HDF5/doc/HL/RM_H5LT.html#H5LTget_attribute_infothe documentation for the type_class argument is sadly lacking what is said is:

The class identifier. To a list of the HDF5 class types please refer to the Datatype Interface API help.

But the what I could find on the Datatype Interface API at https://support.hdfgroup.org/HDF5/doc1.6/UG/11_Datatypes.html does not give a clear answer. For example, I created an attribute using H5LTset_attribute_string. I would have expected the type_class for that to be H5T_STRING but H5T_STRING (in my fortran program) has a value of 216172782113784384 but type_class was set to 3 by H5LTget_attribute_info.


#2

Hello!

The class type for a string is 3, so it looks like H5LTget_attribute_info is returning the correct value. The class types are defined in H5T_class_t in H5Tpublic.h:

typedef enum H5T_class_t {
H5T_NO_CLASS = -1, /*error */
H5T_INTEGER = 0, /*integer types */
H5T_FLOAT = 1, /*floating-point types */
H5T_TIME = 2, /*date and time types */
H5T_STRING = 3, /*character string types */
– cut –

I updated the Reference Manual entry for H5LTget_attribute_info to better describe the class type. See:
https://portal.hdfgroup.org/display/HDF5/H5LT_GET_ATTRIBUTE_INFO

(Note that the https://support.hdfgroup.org/ web site is no longer being updated. For the most current information please refer to: https://portal.hdfgroup.org/)

-Barbara


#3

@bljones
I figured out the problem. It turns out that H5T_STRING will not work under Fortran. What needs to be used is H5T_STRING_F. And if I follow the link you give to the https://portal.hdfgroup.org/display/HDF5/H5T_GET_CLASS page I do not see any mention of the fortran equivalents of the class identifiers.

This brings up another point. I find the documentation very frustrating to go through. For example, if https://support.hdfgroup.org/ is not being maintained, there should be a notice on the web pages in https://support.hdfgroup.org/ to notify and to point people where the up-to-date information is kept. [Note: There is notice on the top entry page but I found the https://support.hdfgroup.org/HDF5/doc1.6/UG/11_Datatypes.html page doing a google search so I did not see the notice on the top page.]


#4

It might help to look at the fortran datatypes examples at:

https://support.hdfgroup.org/HDF5/examples/api-fortran.html#dtyp

The normal convention is to append all the C H5T defined types with an “_F”

Scot


#5

The problem is that while this is documented somewhere it is very easy to miss. Thus, for example, a link from the https://portal.hdfgroup.org/display/HDF5/H5T_GET_CLASS page the page where the fortran version is discussed would alleviate some frustration for someone who is new to HDF5 programming.


#6

@bljones Thanks for the information. When I put a “print *, H5T_STRING” statement in my program I get the number 216172782113784384 and not 3. Do you understand this?