|
In operational radar product generation, a frequent need is to repeat a routine to several inputs, say tens or even hundreds of input volumes.
Rack supports defining such routines as scripts that can be invoked repeatedly using a single command line. A script is command sequence that is then executed automatically for each input:
So, –inputFile
<file> command – or simply <file> – implicitly triggers the script.
One can also invoke the script explicitly with –execScript
command. Defining a script also turns on variable expansion – see also examples in Formatting metadata output using templates .
In the following example, several measurement volume files are read. For each file, two products (Pseudo CAPPI at 500 meters and Echo Top with 20 dBZ threshold) are computed, then converted to Cartesian projections and finally stored to files.
In the example, special internal variable ${NOD}
is derived automatically from compound ${what:source}
variable of the input. One may likewise use ${what:date}
and ${what:time}
, for example.
${
...} like shell environments, so single hyphens are often useful for preventing variable expansion in shell. Supported variable values can be listed with –status
command.By default, unless –append
data was used, the resulting meteorological product is kept in the local context. This means that data from several radars can be processed and also stored as parallel processes.
Scripting becomes even more powerful when combined with Parallel computation .
An alternative to predefined scripts is to read commands from a file and insert them directly, equivalently to inserting them among command line arguments.
An example illustrates this. Assume that file cmdExample.txt
contains:
Then, consider the following command line:
As a result, the program will run as if the command in the file had been inserted on command line.
The latest versions of Rack
support also JSON files, which are useful in environments involving, say, graphical user interfaces – for example, a user may adjust a single product parameter at a time using dedicated widgets, and the system stores the values in a JSON structure. The above commands are equivalently defined in JSON as follows.
In the above JSON code, layout style varies on purpose; a group can be set on a single line or several lines, with indentation. For Rack, parameters can be set as a single element (string or number) or as a group, as illustrated. Note that commands that have no parameters must still have a value (empty string ""
or empty group {}
).
Hint: Remember that plain filenames are implicit –inputFile <file>
commands; hence the file can also be a list of input files (in above line format only, so excluding JSON). Using such a file together with –script
yields compact command lines especially in compositing.