Getting Information from a Vgroup
Contents:
Following are some of the functions you can use to get information
on a Vgroup:
(Functions in bold are included in the example program for this tutorial.)
The following program opens the HDF file, vg_sd1.hdf (for FORTRAN,
vg_sd1f.hdf), and reads every Vgroup in this file, listing all
tag/ref pairs in each Vgroup (You can either download the C or FORTRAN
program at the end, or just take a
look at the HTML version with the HDF calls highlighted):
If you have downloaded this program, then you can
compile and run it.
Following is a detailed review of what this program does:
- Open the HDF file in Read Only mode and start the Vgroup interface.
- Cycle through the Vgroups using Vgetid/vfgid, getting and printing the name
(Vgetname/vfgnam)
and class (Vgetclass/vfgcls) of the Vgroup, and the total number of
tag/reference id pairs in the Vgroup (Vntagrefs/vntrc).
- For each Vgroup found, cycle through and print the tag/references
(Vgettagref/vfgttr).
- Terminate access to the Vgroup and Vgroup interface, and close the file.
Following is what this program outputs:
Vgroup Name: MyVgroup
Vgroup Class: MyClass
Found tag = 720 ref = 2 at position 1
Vgroup Name: fakeDim0
Vgroup Class: Dim0.0
Found tag = 1962 ref = 4 at position 1
Found tag = 1962 ref = 5 at position 2
Vgroup Name: sd1Dim0
Vgroup Class: Var0.0
Found tag = 1965 ref = 6 at position 1
Found tag = 106 ref = 7 at position 2
Found tag = 701 ref = 7 at position 3
Found tag = 720 ref = 2 at position 4
Vgroup Name: vg_sd1f.hdf
Vgroup Class: CDF0.0
Found tag = 1965 ref = 6 at position 1
Found tag = 1965 ref = 8 at position 2
NOTE: Another way to have done this would have been to use the Vinquire (vfinq)
function. In this case you would not need to call Vgetname (vfgnam) since
the Vinquire (vfinq) passes back the Vgroup name in addition to the number
of entries in a Vgroup.
Programs used in this tutorial:
[Compiling a program]