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:
TRUE condition:
FALSE condition:
Grave accent (immediate mode) expressions can easily be used in
conjunction with the IF syntax. For example,
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
The single line style
allows IF-THEN-ELSE logic to be applied on a single line. For
example, to make a plot only when the surface (Z=0) temperature
exceeds 22 degrees we might use
The single line syntax options include
Note that both ELSE and ENDIF are optional in the single line
syntax. Groups of commands enclosed in parentheses and separated by
semicolons can be used as clause_1 or as clause_2. There is no
ELIF statement in the single line syntax. However, IF conditions can be nested as in
The multi-line style
expands the IF capabilities by adding the ELIF (pronounced else if)
statement. Multi-line IF statement follows the pattern
Note that THEN is optional at the end of IF
and ELIF statements but the ENDIF
statement ir required to close the entire IF block. Single line IF
statements may be included inside of multi-line IF blocks.
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":
SEA SURFACE TEMPERATURE
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).
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
`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.($DATASET%|coads>TRUE|%)
.
IF `TEMP[X=160W,Y=2N,Z=0] GT 22` THEN PLOT TEMP[X=160W,Y=2N]
IF condition THEN clause_1
IF condition THEN clause_1 ENDIF
IF condition THEN clause_1 ELSE clause_2
IF condition THEN clause_1 ELSE clause_2 ENDIF
IF `i1 GT 5` THEN (IF `j1 LT 4` THEN go option_1 ELSE go option_2)
IF condition_1 THEN
clause_1_line_1
clause_1_line_2
.
.
.
ELIF condition_2 THEN
clause_2_line_1
.
.
.
ELIF condition_3 THEN
.
.
.
ELSE
.
.
.
ENDIF
yes? STAT/T=15-JAN:15-DEC SST[X=@VAR,Y=@VAR]
LONGITUDE: 20E to 20E(380) (XY variance)
LATITUDE: 90S to 90N (XY variance)
.
.
.