[Hdf-forum] Adding header attributes to an hdf5 file

Larry Knox lrknox at hdfgroup.org
Fri Aug 8 10:41:24 CDT 2014


For h5dump, if you add the –A option (h5dump –AH example.h5) it will show the contents of the string – it shows the values of all the attributes in addition to the metadata that you see with –H.  If you want the value of a specific attribute, -a <path to attribute> is an available h5dump option.

I don’t know how this translates to python, but if you use –AH with h5dump you should be able to tell that the actual string is in the file header.


From: Hdf-forum [mailto:hdf-forum-bounces at lists.hdfgroup.org] On Behalf Of Pat Tresslar
Sent: Friday, August 08, 2014 9:53 AM
To: hdf-forum at lists.hdfgroup.org
Subject: [Hdf-forum] Adding header attributes to an hdf5 file

I'm trying to add an attribute to a group of my hdf5 file for a citation so that when I call the header of the file (h5dump -H example.h5) it shows the attribute name 'Citation' as well as the text of the citation in my script. A comparison would be using netcdf files you can call (ncdump -h example.nc<http://example.nc>) to show such a description. I am programming in python, so far the only result I have been able to get from calling the header is the following:

ATTRIBUTE "Citation" {
DATATYPE H5T_STRING {
STRSIZE 126;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
}
So it shows that I'm trying to use a string, but instead of showing the contents of that string it just shows the variable's metadata.
Thanks in advance for the help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/attachments/20140808/aba0d498/attachment.html>


More information about the Hdf-forum mailing list