Reading Annotations
Contents:
Typical functions for reading annotations are as follows:
The an_read program is a sample program for reading annotations.
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. It reads an HDF file
called an.hdf, and prints out the total number of annotations and the
annotations.
Following is a detailed review of what this program does:
- Opens a file (Hopen/hopen).
- Initializes the AN interface (ANstart/afstart).
- Gets and prints the total number of file label, file description,
data label, and data description annotations (ANfileinfo/affileinfo).
- Selects each File Label annotation
(ANselect/afselect),
reads the annotation (ANannlen/afannlen and ANreadann/afreadann)
and prints it, and then terminates access to the annotation
(ANendaccess/afendaccess).
- Selects each File Description annotation (ANselect/afselect), reads the annotation
(ANannlen/afannlen and ANreadann/afreadann) and prints
it, and then terminates access to the annotation
(ANendaccess/afendaccess).
- Selects each Data Label annotation (ANselect/afselect), reads the annotation
(ANannlen/afannlen and ANreadann/afreadann) and prints it, and then terminates
access to the annotation
(ANendaccess/afendaccess).
- Selects each Data Description annotation (ANselect/afselect), reads the
annotation (ANannlen/afannlen and ANreadann/afreadann) and prints
it, and then terminates access to the annotation
(ANendaccess/afendaccess).
- Terminates access to the annotation interface (ANend/afend).
- Closes the file (Hclose/hclose).
Following is the output from the an_read program:
Number of file labels: 1
Number of file descriptions: 1
Number of data labels: 1
Number of data descriptions: 1
File Label: This is a file label.
File Description: This is a file description.
Data Label: This is a data label.
Data Description: This is a data description.
Programs used in this tutorial:
[Compiling a program]