Subject: Re: Using Tags to write Annotations in HDF with FORTRAN

From: [email-masked] (Doug Ilg)
Date: 5 Jul 1995 17:30:05 GMT

Neil,

I've got a couple tips on annotations for you.  I think your problem stems from some
confusion over the purpose of the annotation functions.  Here's a quick explanation:

There are three major types of annotations provided by the HDF annotation interface (DFAN).
	o File annotations, attached to whole files
	o Object annotations, attached to individual data objects (tag/ref pairs)
	o Tag annotations, attached to a specific type of data object (rarely used)

Under each of these, there are two subtypes.
	o Labels, used for naming things
	o Descriptions, used for extended textual descriptions of things

In addition, each of the other interfaces can define any descriptive auxilliary data
objects it needs.  The SDS interface contains many of these interface-specific features,
like labels, units, and formats for each dimension of a data array, as well as for the
data array, itself.

The routines you've shown below are of the object annotation type, which is definitely
not appropriate for the file description, but *may* be okay for the SDS label you want
to store.

In article <[email-masked]>, [email-masked] (Neil White) writes:
|> 
|> 
|> I'm trying to write out a HDF consisting of 22 SDS where each is
|> 	real rdata(2796,52,4)
|> 	character fdesc*350, flabel*25
|> I have no real problem generating the HDF and adding the file
|> desciption using
|> 
|> 	iret=dapdesc(hdfnme,101,2,fdesc,350)

Actually, this isn't the proper way to add a file description.  The above call would
produce an annotation *to* a file description, not an annotation that *is* a file
description.  The routine you should use is DAAFDS(), but you must first open the
file with Hopen().  You'll find documentation for the routine on page 19 of the
"HDF Reference Manual" for Version 3.3.

|> But putting a label is doesn't work
|> 
|> After writing the SDS I'ved used 
|> 	lastref=dslref()
|>  to get the ref of the last SDS
|> 
|> 	iret=dsplab(hdfnme,704,lastref,flabel,25)
|> 
|> doesn't create the tag refeference  (ie it doesn't show when using the
|> utility  HDFLS
|> 
|> Is this the right tag to be using inconjunction with dsplab ????

The only explanation I can think of for this behavior is the fact that you've chosen
to annotate the tag 704, which is DFTAG_SDL (scientific data labels).  The problem
with that tag is that (I think) you're not guaranteed to have a unique DFTAG_SDL for
each SDS.  You'd be much better off annotating the DFTAG_SD (scientific data), which
would be 702.  (I'm assuming that you intend to put a label on an SDS, rather than
the whole file, in which case you'd want to use DAAFID.)

Now that I think about it, what you really want to do is probably write out the actual
DFTAG_SDL (704) with the DSSDAST (set data strings) and DSSDIST (set dimension strings).
Those functions appear on pages 81 and 84, respectively, in the Reference Manual.

|> All help greatfully appreciated

Finally, I'd like to encourage you to use the new SD interface to write your files
(assuming you don't already).  The SD interface has the capability (borrowed from
netCDF) to store global and local attributes for SDSs.

			-Doug Ilg
			 EOSDIS Project
			 Hughes STX