Table field name length

Hello,

I am using the high-level table API to read in a table from an HDF5 data file. I am using the h5tbget_field_info_f routine, which I need to supply with an empty array for the field names. Is there a robust way to find out what length to make the individual field names in the array? I found that in the case I am looking at, I need to define

  character(len=255),allocatable :: field_names(:slight_smile:

If I do not use a value of 255, then the field_names have whitespace in the wrong places, and if the length is too short I even get malloc errors. Therefore, it seems that the length has to match the length used to store the data in the file. Therefore, is there a way to find out in advance the length needed for the field names before calling h5tbget_field_info_f?

Just to be clear, I am using h5tbget_table_info_f to get nfields which I can use to allocate field_names, but I am trying to find out the value for the length of each individual element in field_names(:slight_smile:

Thanks in advance for any help,

Thomas

Thomas,

I am afraid this high-level Fortran API may not be working properly (regression test is missing; I am filing a bug report).

Meanwhile, you may try to use Fortran function h5tget_member_name_f http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#Datatype-GetMemberName to get the correct name size. Unfortunately you will need to open the table with the h5dopen_f call and get a type identifier using h5dget_type_f before you can use h5tget_member_name_f.

Elena

···

On Jul 1, 2010, at 12:49 PM, Thomas Robitaille wrote:

Hello,

I am using the high-level table API to read in a table from an HDF5 data file. I am using the h5tbget_field_info_f routine, which I need to supply with an empty array for the field names. Is there a robust way to find out what length to make the individual field names in the array? I found that in the case I am looking at, I need to define

character(len=255),allocatable :: field_names(:slight_smile:

If I do not use a value of 255, then the field_names have whitespace in the wrong places, and if the length is too short I even get malloc errors. Therefore, it seems that the length has to match the length used to store the data in the file. Therefore, is there a way to find out in advance the length needed for the field names before calling h5tbget_field_info_f?

Just to be clear, I am using h5tbget_table_info_f to get nfields which I can use to allocate field_names, but I am trying to find out the value for the length of each individual element in field_names(:slight_smile:

Thanks in advance for any help,

Thomas

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org