Direct Access to UV Variables

The main routines to access the variables are the uvgetvr and uvputvr routines. These read or write (respectively) an array of variables of given name (varname). The data read or written are in the array data (which can be a character string or an integer, real or double precision array, depending on the routine called). Exactly n values are read or written. Except for character strings, it is a fatal error, when reading, if n does not agree with the actual number of values for the variable). For a character string, the string is blank padded on a read (no n parameter is needed).

When reading an old data set, the uvgetvr routines should not be called before the first call to uvread. When creating a data set, the initial values for all variables should be written, by calls to the uvputvr routines, before the first call to the uvwrite routine (see Section 2.5.7 for some enlightenment on this issue).

Often it occurs that we are interested in a variable which has a single value, but we are not sure if the variable is present in the dataset. It would be possible to handle this with uvprobvr (Section 2.5.8) and uvgetvr. If the variable is not present, then we would want to use a default value. The uvrdvr routines package these three steps. It returns the value of the variable, data. If the variable is missing from the data stream, the default value, default, is returned. One disadvantage is that the uvrdvr routines only every return a single value (the first value in a multi-element variable).

The routine uvread functions by scanning through the variable streams, and returns with its results, when the ``correlation data'' (``corr'' or ``wcorr'') is encountered. If you are not interested in reading the correlation data (i.e. if you do not intend calling uvread), then the uvscan routine can be used to scan through the variable stream until another variable is encountered. Actually uvscan may well read somewhat past the desired variable, until it has read all variables which changed simultaneously with the desired one. Uvscan returns 0 is the variable was successfully found, -1 if an end of file was encountered, or 1 if the variable was not found. Note that it may not make a great deal of sense to intermix calls to uvscan and uvread.

Miriad manager