Adding Attributes to a Vdata and its Fields
Contents:
A feature new to HDF, as of HDF 4.1r1, is the ability to create
and read attributes (auxiliary information) for Vdatas.
Following are the calls that you need to do this:
In this tutorial, we will take example 4, vd_ex4 and modify it to create
the following attributes:
Vdata attribute:
name: "Fixed_type"
data type: int32
count: 4
values: 32, 16, 32, 8
Attribute for the field, "Speed":
name: "Symbol"
data type: char
count: 3
values: "MAX"
Basically, all you need to do is add the following two calls to vd_ex4
along with any variables that you need to define to make it compile.
C:
istat = VSsetattr (vdata_id, _HDF_VDATA, "Fixed_type", DFNT_INT32,
4, (VOIDP)values);
istat = VSsetattr (vdata_id, 2, "Symbol", DFNT_CHAR, 3, "MAX");
FORTRAN:
retn = vsfsnat(vdata_id, -1, 'Fixed_type', DFNT_INT32, 4, values)
retn = vsfscat(vdata_id, 2, 'Symbol', DFNT_CHAR8, 3, 'MAX')
Following is the vd_ex4 program in HTML that adds attributes.
You can optionally download this program, and
compile and run it.
To see what the resulting HDF file looks like with attributes, see
the next section, "Contents of HDF File with Attributes":
Following are the contents of the HDF files containing the attributes
created in this tutorial example:
Programs used in this tutorial: