I'm not sure you can attach attributes to attributes, so what I would do
is this:
1) create a atomic types based on the type of data fields used in the
metadata.
2) commit the atomic types to the file, named as the unit in question,
e.g. "meters", "seconds", etc.
3) create a compound type to hold the metadata that uses said committed
types for the fields, and commit *that* type to the file.
4) create attributes attached to the compound type, named after the
field in the compound type, of the atomic types defined above.
5) attach the metadata attributes using the above committed compound type.
It's a bit complicated, but I think that's about the only way to do what
you want at this time. It is, at least, decipherable on some level :-)
Here's a brief example in h5dump output:
DATATYPE "Antenna" H5T_COMPOUND {
H5T_ARRAY { [3] H5T_IEEE_F64BE } "delta XYZ";
} ATTRIBUTE "delta XYZ" {
DATATYPE "/Types/meters"
DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
DATA {
(0): 0
}
}
DATATYPE "meters" H5T_IEEE_F64BE;
rudigens wrote:
Greetings,
I am trying to figure out how to attach units to some metadata that I try to
store as attributes with an HDF5 data set.
Here is an example of the metadata I am talking about:
<imageRaster>
<numberOfRows>5923</numberOfRows>
<numberOfColumns>6048</numberOfColumns>
<rowSpacing units="s">6.06688654869458333E-09</rowSpacing>
<columnSpacing units="s">1.21951219625771046E-04</columnSpacing>
<groundRangeResolution>2.14232081144331898E+00</groundRangeResolution>
<azimuthResolution>1.10000002384185791E+00</azimuthResolution>
<azimuthLooks>1.00000000000000000E+00</azimuthLooks>
<rangeLooks>1.00000000000000000E+00</rangeLooks>
</imageRaster>
Row and column spacing can be expressed in different ways: meters or
seconds. Without units attached these attributes remain ambiguous. I have
not seen anything in the documentation that explains how to do this with
attributes.
Any suggestions are greatly appreciated.
Cheers,
Rudi
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org