10.0 Scripting Facilities
There are several scripting facilities that can be used with McIDAS to
create and display products and prompt the user for input.
The command ASK1
defines a question that prompts the user for a value which is entered into
the string named by ASK1.
The McIDAS BATCH
allows users to serially
execute a sequence of McIDAS commands that are stored in a text file.
BATCH is loosely modelled after the DOS/OS/2 batch facility. It supports
the passing of up to 9 parameters on the invocation line. There is
rudimentary logical flow control available in the BATCH file.
provides full access to the system string and key tables. Command
execution stops at the end of the file or if any of the commands
in the file fail. An example of a BATCH file used by the Unidata
F Key Menu system is BKGMAP.BAT which is used
to define and display various map types including the default background
The RUN command can
be used to execute a McBASI
script. McBASI is a BASIC-like interpreted scripting language available
in McIDAS. The script is a set of McBASI commands stored in a text
file. McBASI provides full access to the system tables and data
files and has read/write access to User Common. It has string manipulation
functions and trigonometrics functions.
A simple McBASI script is illustrated in the LBDR.MCB
script that is used by the Fkey menu for setting image loop bounds and
The McBASI script CFILLCLP.MCB runs a series
of ADDE commands to get information about user-specified grid in a
GRID file; copy the grid to a local dataset; convert the grid
representation of the data into image format; use the topography images
included in the Unidata McIDAS distribution to create a land-sea mask;
and finally to visualize the transformed data as an image.
GEWCOMP.MCB and GEWCOMP1.MCB
can be used to combine the GOES-East and West images (VIS, IR, or WV) into a
single image. The routines use two different approaches to creating the
Tcl/Tk is a UNIX scripting facility that provides high-level access to
the X Window system. It is used with the McIDAS-X F Key menu system
to prompt the user for input and display textual information. Tcl/Tk
has full logical flow control and looping. It has the capability of
X Window widget creation. Tcl/Tk is being used by Unidata and SSEC to
build the next generation McIDAS Graphical User interface.
strnvals.gui is an example of a Tcl/Tk script used by the Unidata
F Key Menu system.
UNIX shell scripts
McIDAS commands do not need a running McIDAS-X session to execute; users can
perform McIDAS processing directly from Unix shell scripts. In
addition, the execution of these scripts can be initiated by the Unix
time-based cron facility.
McIDAS commands run in Unix shell scripts need, however, to have a
common environment to interact with each other. This
environment is provided by the McIDAS mcenv facility. In the
absence of a common execution environment, each McIDAS command would
create, operate in, and then remove their own mini McIDAS session.
The Unidata McIDAS distribution contains several examples of Unix Bourne
shell scripts that run one or more McIDAS commands.
mcscour.sh is intended to be used for daily scouring
of McIDAS-XCD produced data files.
mcbatch.sh is included as a template that users
are encouraged to copy and use as a basis for running McIDAS BATCH files
outside of an existing McIDAS session. Likewise,
mcrun.sh is included as a template for running
a sequence of McIDAS commands outside of a McIDAS session.