The behaviour of Surf can be modified by the use of environment variables.
This section describes environment variables that are spcific to Surf. Surf has variables for determining the location of the data (DATADIR and SCUBA_PREFIX)6 and the behaviour of the automatic filenaming system (SCUBA_SUFFIX).
DATADIR can be used to specify an alternative location for the raw data. This means that users do not need to make multiple copies of the demodulated data files (for example, at the JAC support scientists access the data archive directly and never take their own copies) and saves disk space.
As an example, at the JAC, to access demodulated data taken on the 30th October 1997 all that is needed is
$DATADIR is supported by all routines that access demodulated data (reduce_switch, sdip, skydip, sculog etc.) but is not recognised by routines that deal with partly processed data.
Note that use of DATADIR is equivalent to setting a unix-style path of: .:$DATADIR (i.e. the current working directory is always chosen in preference to DATADIR).
In general, the initial stages of data reduction involve data taken on the same night. Typing in the full name of demodulated data files every time an observation is to be analysed is somewhat tedious and it would be much simpler if only the observation number was required.
Two pieces of information are required to spcify the file associated with a particular observation:
The SCUBA_PREFIX environment variable can be used to inform Surf of the form of the fixed prefix.
Data files of the form prefix_dem_nnnn can be accessed by observation number (nnnn) so long as
SCUBA_PREFIX is set to prefix (the _dem_ is added automatically).
Also, if the full path name is specified for SCUBA_PREFIX, DATADIR is not required. As an
example, data in /scuba/observe/19971015/dem can be accessed by number either by
setting
or by just setting SCUBA_PREFIX:
Note that the current directory is not searched in the second case (since the software adds the prefix before trying to load the file). The scusetenv command can be used to set this variable (this command is especially useful when reducing data at the Joint Astronomy Centre as DATADIR is also set correctly).
Most Surf tasks automatically constructs a default output filename based on the input filename (rebin bases the output filename on the object name). In this way it is possible for the filename to reflect the data reduction history.7 The SCUBA_SUFFIX environment variable can be used to select the preferred method to use for constructing the output name.
Three modes are available:
In this mode, the output filename is constructed by appending the short suffix related to the current task to the input filename.
In this mode, the output filename is constructed as follows:
For example, for scuclip an input string of o15_lon_ext would become an output string of
o15_lon_clip (i.e. the trailing _ext has been replaced with _clip. This method ensures that
the length of the filename does not grow out of control during the data reduction.
Additionally, if the suggested output filename would be the same as the input (e.g. by
running scuclip successively), a ‘-’ is appended to the string so that the two can be
distinguished.
This is the default method (and is used by scuquick).
In this mode, the output filename is constructed by appending the long suffix related to the current task to the input filename. This means that the filename becomes longer and longer as the reduction proceeds.
The method of choice can be selected by setting SCUBA_SUFFIX to one of the above values (case independent) e.g.:
The suffix strings related to each task and mode are detailed in table 2 and typical examples from a data reduction are shown in table 3. Currently modes LONG and VERBOSE share the same suffices but use them in different ways.
| Task | Short | Long | Verbose |
| reduce_switch | o15 | o15 | o15 |
| flatfield | o15f | o15_flat | o15_flat |
| extinction | o15f_lon_x | o15_lon_ext | o15_flat_lon_ext |
| scuclip | o15f_lon_xc | o15_lon_clip | o15_flat_lon_ext_clip |
| remsky | o15f_lon_xcs | o15_lon_sky | o15_flat_lon_ext_clip_sky |
| despike | o15f_lon_xcsd | o15_lon_dsp | o15_flat_lon_ext_clip_sky_dsp |
| despike | o15f_lon_xcsdd | o15_lon_dsp- | o15_flat_lon_ext_clip_sky_dsp_dsp |
| rebin | 3c279 | 3c279 | 3c279 |
Three non-Surf environment variables can be used to affect the behaviour of Surf.
As described in (SUN/92), this variable defines the directory in which HDS will create temporary files. This variable must sometimes be set when you are accessing data from directories in which you do not have write permission.
Usually, this variable should be set to a local scratch disk:
This has the additional advantage that NFS traffic can be reduced when accessing data on remote disks as the scratch files can be written locally.
Another useful environment variable is ADAM_ABBRV. If this envrionment variable is set, parameter abbreviation is turned on (e.g., PIXSIZE_OUT can be referenced as PIX).
If this environment variable is set when an ADAM task terminates, the calling process will exit with system status set to 1 if the ADAM status was set, or 0 if the ADAM status was okay. This is useful when writing shell scripts.
All the ADAM environment variables are listed in SUN/144 [15].
6These variables are directly comparable with the Specx [14] use of the DATADIR environment variable and the
set-gsd-filename command.
7The Kappa command hislist provides an explicit data reduction history for a file.
ann = observation number
b??? = first three letters of the selected sub-instrument (e.g. lon, sho, p20, p11, p13)
cThese include the throw and position angle of the chop to be added to the data.