|Introduction to VCS Scripting|
Many attributes are needed to create a graphical representation of a variable, e.g. attributes to identify the variable and to label the plotting axes. By use of VCS scripts, most of these attributes can be manipulated to create the desired visual effect, and the resulting attributes can be saved for later use. VCS scripts also allow the user to save a sequence of interactive operations for replay, and to recover from a system failure.
Initial Attributes Script
As a part of its initialization, VCS reads a script file initial.attributes to load the tables of primary and secondary elements with a variety of attribute sets. Although not required to run VCS, this initial.attributes file contains many predefined attribute settings to aid the beginning user of VCS. The path to the file must be
where /$HOME denotes the user's home directory. (Note, when VCS is executed for the first time, a /PCMDI_GRAPHICS subdirectory will be created automatically if one has not already been created.) The user also can customize the initial.attributes file.
Another script file can be read immediately after the initial.attributes script file. It is assigned on the command line by entering
vcs -i /path/input_script_filename
vcs -ni /path/input_script_filename
when executing VCS.
During the reading of the input_script_filename, VCS operates in a batch-like mode: the VCS Canvas may appear with graphical displays, but will eventually disappear. If the -i option is exercised, control will become interactive once the input_script_filename has been read, and the VCS Interface will appear, showing the last plot displayed in batch mode. If the -ni option is exercised, VCS will exit without displaying the interactive Interface, once the input_script_filename has been read.
Saving a Continuous Script
A continuous script can be saved during an interactive session by assigning an output file on the command line:
vcs -o /path/output_script_filename
The replay of this output script file will not reproduce the manipulations of buttons and menus that are seen during the interactive session, but will reproduce the graphical displays and the changes to the tables and their attributes sets. The appropriate CGM, raster, netCDF, HDF, and/or DRS files also will be saved. (See also the Example on saving these types of files.)
Saving Error Messages
During the processing of the initial.attributes script file, any error message will be written to the UNIX standard output file. During the processing of the input file defined by the -i option, the error message will, by default, be written to the file
These error messages can optionally be saved to a file dictated by the user with the command line option
vcs -e /path/error_output_filename
The errors occurring during the interactive portion of a VCS session will be sent both to the VCS message panel and to the error file. See also the section on VCS Command Line Options in the Setup Information.
Script Assignment Statements
In an assignment statement, the specific table of attribute sets is identified by a prefix, and the table entry is specified by a name for the attribute set; they are separated by an underline. Attribute assignments are enclosed within parentheses. The syntax is:
tableprefix identifies the table
attributename names the attribute set that will appear in the table
assignments can be specified in any of the following forms:
attributename(sub-attributename = assignment, ...),
attributename(sub-attributename = assignment, ...)(another set)...,
assignment=value or `string' or attribute set name
There are also script commands for performing various actions. Examples include: