SHOW VARIABLE my*var
IF $answer THEN GO script1 ELSE GO script2 ENDIF
PLOT/T=1-jan:31-dec my_variable[X=@VAR,Y=@VAR]
yes? yes? SHOW DATA
Wildcards "*" and "?" may now be used in these commands
For example,
yes? CANCEL VARIABLE *wind ! matches "zonal_wind" and "wind"
yes? SHOW SYMBOL tau? ! matches taux and tauy
The number of aliases that may be defined has been increased from 30 to 150.
An IF-THEN-ELSE syntax has been added to allow conditional execution of Ferret commands. It may be used in two styles -- single line and multi-line. In both the single and multi-line styles the truth or false of the IF condition is determined case-insensitive recognition of one of these options:
Examples:
IF ($yes_or_no) THEN GO yes_script ELSE GO no_script
IF `i GT 5` THEN SAY i is too big ENDIF
IF ($dset%|coads>TRUE|%) THEN (GO my_plot; LABEL 4,5 COADS)
IF `i LT 3` THEN GO option_1 ELIF `i LT 6` THEN GO option_2 ELSE GO option_3 ENDIF
TRUE condition:
FALSE condition:
Grave accent (immediate mode) expressions can easily be used in
conjunction with the IF syntax. For example, `3 GT 2`
(Is
three greater than 2?) evaluates to "1" (TRUE) and `3 LT
2`
(Is three less than 2?) evaluates to "0" (FALSE). If the
result of a grave accent expression is invalid, for example division
by zero as in `1/0`, the string "bad" is, by default, generated. Thus
invalid expressions are regarded as FALSE.
Furthermore, symbol substitution permits IF decisions to be based
text-based conditions. Suppose, for example, the symbol ($DATASET)
contains either coads or levitus. Then an IF condition
could test for coads using
($DATASET%|coads>TRUE|%)
.
The single line syntax options include
IF `i1 GT 5` THEN (IF `j1 LT 4` THEN go option_1 ELSE go option_2)
The multi-line style expands the IF capabilities by adding the ELIF (pronounced else if) statement. Multi-line IF statement follows the pattern
In previous versions of Ferret transformations which were applied to several axes, e.g. my_variable[X=@VAR,Y=@VAR] were computed as sequential applications of the 1-dimensional transformation. (Special exceptions to this were @AVE and @DIN which, when applied in X and Y simultaneously, computed 2-dimensional transformations). The results of such calculations were not always the desired ones. In the example, my_variable[X=@VAR,Y=@VAR] the result of sequential 1-dimensional transformation would be a variance of a variance.
In Ferret version 4.3 the transformations @AVE, @DIN, @VAR, @NGD, and @NBD, when applied to multiple axes simultaneously will be computed as true multi-dimensional transformations. Thus my_variable[X=@VAR,Y=@VAR] computes the variance of my_variable over a 2-dimensional XY region. These transformations may similarly be applied to 1, 2, 3, or 4-dimensional regions. The output will document the geometry of the calculation. In the following example @VAR is documented as "XY variance":
yes? STAT/T=15-JAN:15-DEC SST[X=@VAR,Y=@VAR]
SEA SURFACE TEMPERATURE
LONGITUDE: 20E to 20E(380) (XY variance)
LATITUDE: 90S to 90N (XY variance)
.
.
.
All other transformations besides those named above are computed as sequential 1-dimensional transformations when specified simultaneously on multiple axes. However, note that all other transformations are either i) unaffected by the sequential calculation (e.g. @MAX); or ii) nonsensical as multi-dimensional transformations (e.g. @DDC); or iii) ambiguous as multi-dimensional transformations (e.g. @SBX).
The 4 character string yes? at the start of a Ferret command is ignored. This enables groups of Ferret commands to be copyed and pasted from the screen as Ferret commands.