Part II: COMMANDS REFERENCE 

Ref Sec1.  ALIAS 

An alias for DEFINE ALIAS (p. 337). 

Ref Sec2.  CANCEL 

Cancels a program state or definition—generally paired with a SET or DEFINE command. See commands SET (p. 395) and DEFINE (p. 337) for further information. 

Arguments: 

The arguments, which are names of variables, data sets, or other definitions can be specified using wildcards. The * wildcard matches any number of characters in the name; the ? wildcard matches exactly one character. 

Ref Sec2.1.  CANCEL ALIAS 

Cancels a user-defined command alias. 

yes? CANCEL ALIAS ALIAS_NAME 

The command UNALIAS is an alias for CANCEL ALIAS. 


Ref Sec2.2.  CANCEL ATTRIBUTE 

/OUTPUT /DATASET 

Removes an attribute from a variable, or if /OUTPUT is specified, sets the output flag so that the attribute is not written to netCDF files when the variable is written. (See the section on access to dataset and variable attributes, p. 65

yes? CANCEL ATTRIBUTE[/qualifiers] varname.attname 

Examples: 

This command removes the long_name attribute entirely from the variable sst. 

yes? CANCEL ATTRIBUTE sst.long_name 

These commands set a flag so that the AXIS attribute is not written for the coordinate variables COADSX, COADSY, and TIME are written to an netCDF file. This applies to the default dataset 

yes? CANCEL ATTRIBUTE/OUTPUT (COADSX).AXIS 

yes? CANCEL ATTRIBUTE/OUTPUT (COADSY).AXIS 

yes? CANCEL ATTRIBUTE/OUTPUT (TIME).AXIS 



Ref Sec2.3.  CANCEL AXIS 

/MODULO /DEPTH /ALL /STRIDE 

CANCEL AXIS  forms the complement to DEFINE AXIS, or SET AXIS  It is also applicable to "persistent" axes which are defined by netCDF files such as climatological_axes.cdf -- axes which are not associated with any variables in the netCDF file, itself, and are not automatically deleted when the data set is canceled. 

yes? CANCEL AXIS AXIS_NAME 

Attempts to CANCEL AXIS on a axis which is used by a variable in a currently open data set will be rejected with a message indicating the reason. 

Command qualifiers for CANCEL AXIS: 

CANCEL AXIS/MODULO 

Cancels the modulo nature of a user-defined axis. 

yes? CANCEL AXIS/MODULO my_x_axis 

or 

yes? CANCEL AXIS/MODULO my_t* 

CANCEL AXIS/DEPTH 

Cancels the depth setting of a Z axis, which may have been set with a positive="down" attribute in a netCDF file, or for a user-defined axis with a DEFINE AXIS/DEPTH or SET AXIS/DEPTH command. If applied to an X, Y, or T axis, this qualifier is ignored. 

yes? CANCEL AXIS/DEPTH my_z_axis 

CANCEL AXIS/ALL 

Cancels all axes that have been defined by the user, and restores any coordinate storage that was used to define irregular axes. It does not cancel axes defined when a data set is opened. 

CANCEL AXIS/STRIDE 

Cancels the strided behavior of an axis that was set to native striding by a SET AXIS/STRIDE command. See the discussion of netCDF strides (p. 35.) 

CANCEL DATA_SET 

/ALL /NOERROR 

Removes the specified data set from the list of available sets. 

yes? CANCEL DATA_SET dset1, dset2, ..., dsetn 

        where each dset may be the name or number of a data set; or 

yes? CANCEL DATA/ALL 

(See also SET DATA_SET, p. 398, and SHOW DATA SET, p. 434.) 

Command qualifiers for CANCEL  DATA_SET: 

CANCEL DATA/ALL 

Eliminates all data sets from the list of accessible data sets. 

CANCEL DATA/NOERROR 

Suppresses the error message otherwise generated when a data set that was never set is canceled. Useful in GO scripts for closing data sets that may have been opened in previous usage of the script. 

Note that if a grid or axis from a netCDF file is used in the definition of a LET-defined variable (e.g. LET my_X = X[g=sst[D=coads_climatology]]) that variable definition will be invalidated when the data set is canceled (CANCEL DATA coads_climtology, in the preceding example). There is a single exception to this behavior: netCDF files such as climtological_axes.cdf, which define grids or axes that are not actually used by any variables. These grids and axes will remain defined even after the data set, itself, has been canceled. They may be deleted with explicit use of CANCEL GRID or CANCEL AXIS. 

CANCEL EXPRESSION 

Un-specifies the current context expression. Ferret's "action" commands can be issued without an argument (e.g.,  yes? PLOT), in which case Ferret uses the current context expression. This expression is either the argument of the most recent action command, or an expression set explicitly with SET EXPRESSION. 

yes? CANCEL EXPRESSION 

The qualifier /ALL can be used with this command, but it exists for compatibility purposes only and has no effect. 

CANCEL GRID 

 CANCEL GRID  forms the complement to DEFINE GRID It is also applicable to "persistent" grids  which are defined by netCDF files such as climatological_axes.cdf -- grids  which are not associated with any variables in the netCDF file, itself, and are not automatically deleted when the data set is canceled. 

Attempts to CANCEL GRID on a grid or axis which is used by a variable in a currently open data set will be rejected with a message indicating the reason. 

CANCEL LIST 

/ALL /APPEND /FILE /FORMAT /HEADING /PRECISION 

Toggles the effects of the SET LIST command. See command SET LIST (p. 407). 

yes? CANCEL LIST[/qualifiers] 

Command qualifiers for:  CANCEL LIST 

CANCEL LIST/ALL 

Restores all aspects of the LIST command to their default behavior. 

CANCEL LIST/APPEND 

Resets the listed output to NOT append to existing file. 

CANCEL LIST/FILE 

Resets the listed output to automatic file naming. 

CANCEL LIST/FORMAT 

Resets the listed output to its default formatting. 

CANCEL LIST/HEAD 

Instructs listed output to omit the descriptive data header. 

CANCEL LIST/PRECISION 

Resets the precision of listed data to 4 significant digits. 


Ref Sec2.4.  CANCEL MEMORY 

/ALL /PERMANENT /TEMPORARY 

Clears data currently cached in memory. 

yes? CANCEL MEMORY[/qualifier] 

Use this command to save memory space—by clearing data as soon as it is no longer needed virtual memory requirements can be reduced. This is especially useful for efficient batch processing. Default is CANCEL MEMORY/TEMPORARY. 

Example: 

    To produce an animation using minimal virtual memory try: 

    yes? REPEAT/T=lo:hi:delta GO min_mem_movie 


    Where the file min_mem_movie.jnl contains 

    CONTOUR/FRAME  temp[Z=0]        ! contour plot 

    CANCEL MEMORY/ALL               ! clear memory for next time step 

Command qualifiers for CANCEL MEMORY: 

CANCEL MEMORY/ALL 

Clears all variables stored in memory. 


CANCEL MEMORY/PERMANENT 

Clears all "permanent" variables stored in memory (i.e., variables loaded into memory with LOAD/PERMANENT). 


CANCEL MEMORY/TEMPORARY (default) 

Clears all non-permanent variables stored in memory. 

CANCEL MODE 

Sets the state of a mode to "canceled". 

yes? CANCEL MODE mode_name 

(See command SET MODE, p. 410, for descriptions of modes.) 


Ref Sec2.5.  CANCEL MOVIE 

This command is unnecessary in Ferret version 3.1 and later; it is provided for compatibility with older versions of Ferret. It restores the default movie file name (ferret.mgm) but is not needed to conclude capturing graphics to a movie file. 

yes? CANCEL MOVIE 

The qualifier /ALL can be used with this command, but it exists for compatibility purposes only and has no effect. 


Ref Sec2.6.  CANCEL SYMBOL 

/ALL 

Deletes a user-defined symbol (string variable) definition. 

yes? CANCEL STRING[/qualifier]   [symbol_name] 

Command qualifiers for CANCEL SYMBOL: 

CANCEL SYMBOL/ALL 

Deletes all user-defined symbol definitions. 

Examples: 

yes? CANCEL SYMBOL my_x_label   !eliminate my_x_label from the definitions
yes? CANCEL SYMBOL *x_label     !remove all strings ending in x_label
yes? CANCEL SYMBOL/ALL          !remove all user-defined symbols. 



Ref Sec2.7.  CANCEL REGION 

/I/J/K/L /X/Y/Z/T /ALL 

Cancels part or all of the current or named region. 

yes? CANCEL REGION[/qualifier] [region_name] 

Examples: 

yes? CANCEL REGION               !clear the current region 

yes? CANCEL REGION/T             !eliminate T from the current context 

yes? CANCEL REGION reg1          !clear the region named "reg1" 

Command qualifiers for CANCEL REGION: 

CANCEL REGION/I /J /K /L /X /Y /Z /T  

Eliminates I, J, K, L, X, Y, Z, or T axis information from current context or named region. 


CANCEL REGION/ALL 

Eliminates ALL stored region information (rarely used). 

CANCEL VARIABLE 

/ALL /DATASET 

Deletes a user-defined variable definition. 

yes? CANCEL VARIABLE[/qualifier]  [var_name] 

Command qualifiers for CANCEL VARIABLE: 

CANCEL VARIABLE/ALL 

Deletes all user-defined variable definitions. 

Examples: 

yes? CANCEL VARIABLE my_sst  !eliminate my_sst from the definitions
yes? CANCEL VARIABLE *wind   !delete all variables ending in wind
yes? CANCEL VARIABLE tau?    !delete variables named tau plus one character
yes? CANCEL VARIABLE/ALL     !delete all user-defined defined variables 

CANCEL VARIABLE/DATASET 

Deletes user define variables associated with the named dataset, which were defined by a DEFINE VARIABLE/DATASET command. 


Ref Sec2.8.  CANCEL VIEWPORT 

Cancels a defined viewport or cancels use of viewports. 

yes? CANCEL VIEWPORT view_name        !un-define view_name 

yes? CANCEL VIEWPORT                  !return to full window output 



Ref Sec2.9.  CANCEL WINDOW 

/ALL 

Removes graphics window(s) from the screen. 

yes? CANCEL WINDOW  n   !or 

yes? CANCEL WINDOW/ALL 

Command qualifiers for CANCEL WINDOW: 

CANCEL WINDOW/ALL 

Removes all graphics windows. 


Ref Sec3.  CONTOUR 

/I/J/K/L /X/Y/Z/T /D /FILL /FRAME /KEY /LEVELS /LINE /NOAXIS /NOKEY /NOLABEL /OVERLAY /PALETTE /PATTERN /SIZE /SPACING /SIGDIG /PEN /SET_UP  /TITLE /COLOR /TRANSPOSE /HLIMITS /VLIMITS /HLOG /VLOG /AXES /HGRATICULE /VGRATICULE /GRATICULE /MODULO 

Produces a contour plot. 

yes? CONTOUR[/qualifiers]   [expression] 

In a curvilinear coordinate system (map projections) 

yes? CONTOUR[/qualifiers]   expression, xcoords, ycoords (see p. 222

Example: 

yes? CONTOUR var1           !produce a contour plot of variable var1 

yes? CONTOUR var1, xcoords, ycoords 

                      !produce a contour plot of variable var1 

                    ! using curvilinear coordinates 


Parameters 

Expressions may be any valid expression. See the chapter "Variables and Expressions",  section "Expressions" (p. 73), for a definition of valid expressions. The expression will be inferred from the current context if omitted from the command line. 

Command qualifiers for CONTOUR: 

CONTOUR/I/J/K/L /X/Y/Z/T  /OVERLAY /SET_UP /FRAME /D /TRANPOSE /FILL /LINE /NOLABEL /LEVELS /KEY /NOKEY /PALETTE /HLIMITS /VLIMITS /TITLE /COLOR /NOAXES /PATTERN /SIZE /SPACING /SIGDIG /PEN /AXES 

CONTOUR/I/J=/K=/L=/X=/Y=/Z=/T=  

Specifies value or range of axis subscripts (I, J, K, or L), or axis coordinates (X, Y, Z, or T) to be used when evaluating the expression being plotted. 

CONTOUR/D= 

Specifies the default data set to use when evaluating the expression being contoured. 

CONTOUR/FILL   (alias FILL) 

Creates a color filled contour image. 

CONTOUR/FRAME 

Causes the graphic image produced by the command to be captured as an animation frame in the file specified by SET MOVIE. In general the FRAME command (p. 358) is more flexible and we recommend its use rather than this qualifier. 

CONTOUR/FILL/KEY 

Displays a color key for the palette used in a color-filled contour plot. Only valid in conjunction with /FILL (The key is displayed by default with CONTOUR/FILL or alias FILL). To control the color key position and labeling, see the command SHAKEY in the appendix, "Ferret Enhancements to PPLUS" (p. 563). 

CONTOUR/FILL/KEY=CONTINUOUS 

Chooses a continous color key for the palette used in a color-filled contour plot, without lines separating the colors. This option is particularly good for fill plots having many levels. Only valid in conjunction with /FILL 

CONTOUR/LEVELS 

Specifies the contour levels or how the levels will be determined. If the /LEVELS qualifier is omitted Ferret automatically selects reasonable contour levels. 

See the chapter "Customizing Plots", section "Contouring" (p. 213) for examples and more documentation on /LEVELS and color_thickness indices. See also the demonstration "custom_contour_demo.jnl". 

CONTOUR/LINE 

Overlays contour lines on a color-filled plot. Valid only with /FILL (or as a qualifier to alias FILL). When /LINE is specified the color key, by default, is omitted. Use FILL/LINE/KEY to obtain both contour lines and a color key. The /SET_UP qualifier disables the action of /LINE. When using /SET_UP, follow the PPL CONTOUR (or PPL FILL) command with a CONTOUR/OVERLAY command to draw contour lines on the plot. In fact, CONTOUR/OVERLAY offers all the functionality of FILL/LINE and gives better control over the plot appearance. 

CONTOUR/NOKEY 

Turns off display of a color key for the palette used in a color-filled contour plot. Only valid in conjunction with /FILL (or with alias FILL). 

CONTOUR/NOAXIS 

Suppresses all axis lines, tics and labeling so that no box appears surrounding the contour plot. This is especially useful for map projection plots. 

CONTOUR/NOLABELS 

Suppresses all plot labels. 

CONTOUR/OVERLAY 

Causes the indicated expression to be overlaid on the existing plot. 

Note (CONTOUR/OVERLAY with time axes): 

A restriction in PPLUS requires that if time is an axis of the contour plot, the overlaid variable must share the same time axis encoding as the base plot variable. If this condition is not met, you may find that the overlaid contour fails to be drawn. The solution is to use the Ferret regridding capability to regrid the base plot variable and the overlaid plot variable onto the same time axis. See the section on overlaying with a time axis (p. 189). 

CONTOUR/PALETTE= 

Specifies a color palette (otherwise, the current default palette is used). Valid only with CONTOUR/FILL (or as a qualifier to the alias FILL). The file suffix *.spk is not necessary when specifying a palette. Try the Unix command % Fpalette '*' to see available palettes. See command PALETTE (p. 371) for more information. 

Example: 

yes? CONTOUR/FILL/PALETTE=land_sea  world_relief 

The /PALETTE qualifier changes the current palette for the duration of the plotting command and then restores the previous palette. This behavior is not immediately compatible with the /SET_UP qualifier. See the PALETTE (p. 371) command for further discussion. 

CONTOUR/PATTERN= 

Specifies a pattern file (otherwise, the current default pattern specification is used). Valid only with CONTOUR/FILL (or as a qualifier to the alias FILL). The file suffix *.pat is not necessary when specifying a pattern. Try the Unix command % Fpattern '*' to see available patterns. See command PATTERN (p. 372) for more information. 


CONTOUR/COLOR= 

Sets line color (replaces the /PEN qualifier). The available color names are Black, Red, Green, Blue, LightBlue, and , Purple, and White (not case sensitive), corresponding to the /PEN values 1-6, respectively. (/COLOR also accepts numerical values.). 

Example: 

yes? CONTOUR/COLOR=red  sst 


CONTOUR/PEN= 

Sets line style for contour lines (same arguments as PLOT/LINE=). Argument can be an integer between 1 and 18; run GO line_samples to see the styles for color devices. 

Example: 

yes? CONTOUR/PEN=2  sst 


CONTOUR/SIZE= 

Controls the size of characters in the contour labels, using PLOT+ definition of "inches" .Default is 0.8'  See example under CONTOUR/SPACING below.  


CONTOUR/SIGDIG= 

Sets the number of significant digits for contour labels. Default is 2. See example under CONTOUR/SPACING below. 


CONTOUR/SPACING= 

Sets spacing for contour lines, using PLOT+ definition of "inches". The default spacing is 5.0. (See the CONSET command in the on-line PLOT+ Users Guide) 


Example o f CONTOUR/SIZE/SIGDIG/SPACING 

yes? LET my_field = SIN(X[x=1:6:.1])*COS(Y[y=1:6:0.1])
yes? CONTOUR/SIGDIG=1/SIZE=0.15/SPACING=3 my_field 

Specifies contour labels with a single significant digit using characters of height 0.15 "inches" at a nominal spacing of 3 "inches", consistent with the PLOT+ usage of "inches". (These are the same units as in, say, "ppl axlen 8,6", to specify plot axes of lengths 8 and 6 inches for horizontal and vertical axes, respectively.)   Note that the PLOT+ CONPRE and CONPST commands are also useful (see p. 529), giving control over the text font and color used in the labels and adding units to the labels. For example, the commands 

yes? PPL CONPRE @C002@CR
yes? PPL CONPST cm/sec 

will transform the labels in the above CONTOUR example to red (002), Complex Roman font with a units label of "cm/sec". 

CONTOUR/SET_UP 

Performs all the internal preparations required by program Ferret for contouring but does not actually render output. The command PPL can then be used to make changes to the plot prior to producing output with the PPL CONTOUR command. This permits plot customizations that are not possible with Ferret command qualifiers. See the chapter "Customizing Plots", section "Contouring" (p. 213). Please note that /SET_UP disables the /LINE qualifier. When using /SET_UP certain plotting states may have to be reset manually. 


CONTOUR/TITLE= 

Allows user to specify a plot title (enclosed in quotation marks). Without this qualifier Ferret selects a title based on information about the expression.  


CONTOUR/TRANSPOSE 

Causes the horizontal and vertical axes to be interchanged. By default the X and T axes of the data are drawn horizontally on the plot and the Y and Z axes of the data are drawn vertically. For Y-Z plots the Z data axis is vertical by default. 

Note that plots in the YT and ZT planes have /TRANSFORM applied by default in order to achieve a horizontal T axis. See /HLIMITS (below) for further details. Use /TRANSPOSE manually to reverse this effect. 

CONTOUR/HLIMITS= 

Specifies axis range and tic interval for the horizontal axis. Without this qualifier, Ferret selects reasonable values. 


yes? CONTOUR/HLIMITS=lo_val:hi_val[:increment]  [expression] 

The optional "increment" parameter determines tic mark spacing on the axis. If the increment is negative, the axis will be reversed. 

This qualifier does not have any impact on the context of the expression being plotted. If data is on a modulo x axis but the arguments of the /HLIMITS qualifier represent a region outside the actual coordinates of the data, only the range including the actual coordinates is shown.  Use /X=lo:hi or SET REGION or a context on the variable itself, var[X=lo:hi], to set the context for the expression. 

The /HLIMITS and /VLIMITS qualifiers will retain their "horizontal" and "vertical" interpretations in the presence of the /TRANSPOSE qualifier. Thus, the addition of /TRANSPOSE to a plotting command mandates the interchange of "H" and "V" on the limits qualifiers. 

CONTOUR/VLIMITS= 

Specifies the axis range and tic interval for the vertical  axis. See /HLIMITS (above) 


CONTOUR/XLIMITS=/YLIMITS= 

Note: XLIMITS and YLIMITS have been deprecated. Please use HLIMITS and VLIMITS instead. 

CONTOUR/AXES[=top,bottom,left,right] 

Turns plotting of individual axes off and on. This replaces the use of the "PPL AXSET" command. The syntax is 

     yes? CONTOUR/AXES[=top,bottom,left,right]  var 

where the arguments are 1 to turn the axis on and 0 to turn it off. For  example: 

yes? CONTOUR/AXES=0,1,1,0  sst     ! Draws the bottom and left axes only 


Note that contour plots with log axes can be drawn as explained in the FAQ, How can I make a 2D log (or log-log) plot? 

CONTOUR/MODULO 

Beginning with Ferret v5.81 the argument /MODULO for CONTOUR  plots will draw modulo replications in longitude for curvilinear data in order to fill out the specified extent in the longitude direction. For instance, if the xcoords variable contains longitudes in the range -270:90 we can draw a plot with longitudes 0:360 with the command 

yes? CONTOUR/HLIMITS=0:360/MODULO values, xcoords, ycoords 

CONTOUR/GRATICULE[=line specifiers] 

(Introduced in Ferret version 5.6) Turns on graticule lines for the horizontal and vertical axes. These are lines across the plot at the  tic marks. /GRATICULE sets both horizontal and vertical lines; to set each separately see /HGRATICULE and /VGRATICULE, below. The syntax is 

     yes? CONTOUR/GRATICULE[=line or dash,COLOR=,THICKNESS=]  var 

where the default is a thin, solid black line. The line colors available are Black, Red, Green, Blue, LightBlue, Purple, and White. The thickness codes are 1, 2, or 3 and as for plot lines, thickness=1 is a thin line, thickness=3 is the thickest, and THICK specified with no value defaults to thickness=2. For clarity the  arguments to GRAT may be placed in parentheses 

yes? CONTOUR/GRAT  sst     ! default graticules 


yes? CONTOUR/GRAT=(LINE,COLOR=red,THIICK=3) sst 


yes? CONTOUR/GRAT=(DASH,COLOR=lightblue) sst 


yes? CONTOUR/FILL/GRAT=(DASH,COLOR=white) sst 


The above commands make settings for the large tic marks. If small tic marks are being plotted on the axes, we can make settings for them as well using keywords SMALL and LARGE. Place all of the arguments for the /GRAT qualifier in double quotes. Note that the PPL AXNMTC command sets the plotting of small tics, and that small tics are used by default for many time axes. 

yes? ppl axnmtc 2,2
yes? CONTOUR/GRAT="LARGE(COLOR=blue,thick),SMALL(COLOR=lightblue)" sst 

CONTOUR/HGRATICULE[=line specifiers]/VGRATICULE[=line specifiers] 

Turns on graticule lines and sets the line characteristics of the graticule for the horizontal or vertical axis separately. You may specify only one of /HGRAT or /VGRAT if desired. These are lines across the plot at the  tic marks. The syntax is 

     yes? CONTOUR/HGRATICULE[=line or dash,COLOR=,THICKNESS=] /VGRATICULE=line or dash,COLOR=,THICKNESS=]  var 

where the default is a thin, solid black line. The line colors available are Black, Red, Green, Blue, LightBlue, Purple, and White. The thickness codes are 1, 2, or 3 and as for plot lines, thickness=1 is a thin line, thickness=3 is the thickest, and THICK specified with no value defaults to thickness=2. For clarity the  arguments to HGRAT may be placed in parentheses 

yes? CONTOUR/HGRAT/VGRAT  sst    !this is equivalent to PLOT/GRAT 


yes? CONTOUR/HGRAT=(LINE,COLOR=red,THIICK=3)/VGRAT=(color=green) sst 


yes? CONTOUR/HGRAT=(DASH,COLOR=lightblue) sst  ! horizontal only 


The above commands make settings for the large tic marks. If small tic marks are being plotted on the axes, we can make settings for them as well using keywords SMALL and LARGE. Place all of the arguments for the /HGRAT qualifier in double quotes. Note that the PPL AXNMTC command sets the plotting of small tics, and that small tics are used by default for many time axes. 

yes? ppl axnmtc 2,2
yes? CONTOUR/HGRAT="LARGE(COLOR=blue,thick),SMALL(COLOR=lightblue)" /VGRAT="LARGE(COLOR=blue,thick) sst 

Ref Sec4.  DEFINE 

Defines a new alias, region, grid, axis, variable, or viewport. 


Ref Sec4.1.  DEFINE ALIAS 

Defines an alias for a command. "ALIAS" is an alias for DEFINE ALIAS. 

yes? DEFINE ALIAS NAME COMMAND 

Example: 

yes? DEFINE ALIAS SDF SHOW DATA/FULL 



Ref Sec4.2.  DEFINE ATTRIBUTE 

/DATASET /TYPE /OUTPUT 

Defines a new attribute for a variable. The variable may be from a netCDF dataset, a user-defined variable, or a variable from another type of dataset. (See the section on access to dataset and variable attributes, p. 65

yes? DEFINE ATTRIBUTE[/qualifiers] varname.attname = expression 

Example: add new attributes with DEFINE ATTRIBUTE 

yes? USE etopo60 


yes? DEFINE ATT rose.floatval = 22 

yes? DEFINE ATT rose.pp = {1.5, 1.9} 

yes? DEFINE ATT/TYPE=string/OUTPUT rose.strval = "some text about ROSE" 

/DATASET=n applies the attribute to the variable in the specified dataset 

/TYPE is string or float. If it is  not specified, it is inferred from the expression. 

/OUTPUT sets the flag for output so that this attribute will be written when the variable is written to a netCDF file. By default, only those attributes which Ferret has historically written to output files are written. 


Ref Sec4.3.  DEFINE AXIS 

/X/Y/Z/T /DEPTH /FILE /FROM_DATA /MODULO /NAME /NPOINTS /T0 /UNITS /EDGES /CALENDAR /BOUNDS 

Defines an axis (axis name up to 16 characters). 

yes? DEFINE AXIS[/qualifiers]  axis_name
or
yes? DEFINE AXIS[/qualifiers]  axis_name = expr 

Example: 

yes? DEFINE AXIS/X=140E:140W:.2   AX140
or
yes? DEFINE AXIS/X   myaxis = {1, 5, 15, 35} 


Note on DEFINE AXIS: 

Axes which are "in use", because they are used by currently open data sets may now be redefined using DEFINE AXIS. 

In early versions of Ferret, attempting to redefine an in-use axis generated an error. This feature is especially useful to correct the  interpretation of erroneous files, or files which exhibit minor incompatibilities with Ferret. Use this feature with caution as it can be used to "fool" Ferret into an incorrect interpretation of a data file. 

Command qualifiers for DEFINE AXIS: 

DEFINE AXIS/X=/Y=/Z=/T=   

Specifies the limits and point spacing of an axis. 


yes? DEFINE AXIS/X=lo:hi:delta   axis_name 

The limits may be in longitude, latitude, or date format (for X, Y, or T axis, respectively)  or may be simple numbers. No units are assumed unless units are given explicitly with the /UNITS qualifier. 

Use /UNITS=degrees to obtain latitude or longitude axes. The X or Y qualifier determines which orientation "degrees" refers to. If an X axis has units of degrees longitude it is automatically marked as a modulo axis. 

For T axis, the limits may be dates (dd-mmm-yyyy:hh:mm:ss) or may be time steps. The delta increment is regarded as hours unless the /UNITS qualifier specifies otherwise. Note that time axes may not extend beyond year 9999. 

If the time limits are given as dates then this axis produces date-formatted output (unless CANCEL MODE CALENDAR is issued). If the time limits are given as time steps then all instances of this axis are labeled with time step values in the units specified with the /UNITS qualifier. 

Examples (evenly-spaced axes): 

yes? DEFINE AXIS/X=140E:140W:.2 ax140 

yes? DEFINE AXIS/Y=15S:25N:.5 axynew 

yes? DEFINE AXIS/Z=0:5000:20/UNITS=CM/DEPTH axzcm 

yes? DEFINE AXIS/T="7-NOV-1953":"23-AUG-1988:11:00":24  axtlife 

yes? DEFINE AXIS/T=25:125:5/UNITS=minutes   axt5min 


DEFINE AXIS/CALENDAR= 

Allows for non-Gregorian calendar axes. The calendars allowed are 

calendar name     

number of days/year 

notes 

GREGORIAN or STANDARD 

365.2425 

default calendar: proleptic Gregorian 

JULIAN 

365.25 

with leap years 

NOLEAP 

365 

no leap years 

ALL_LEAP 

366 

366 days every year 

360_DAY 

360 

each month is 30 days 

The calendar definitions conform to the netCDF conventions document for calendars.  See http://www.cgd.ucar.edu/cms/eaton/cf-metadata/CF-current.html#cal These calendar definitions are compatible with the Udunits standard (see http://www.unidata.ucar.edu/packages/udunits/udunits.dat) which has slightly different naming conventions. Also note that the default calendar in Ferret is the proleptic Gregorian calendar, i.e. the definition of a year is consistent throughout time and does not have an offset in the 1500's as the historical calendars did. However, files written using the NOAA/CDC standard for the "blended" Julian/Gregorian calendar are read correctly by Ferret: If a time axis has a time origin of 1-1-1 00:00:00, and uses the default calendar, and if the coordinates of axis lie entirely after the year 1582, then the historical 2-day shift is applied. 

The netCDF conventions recommend that the calendar be specified by the attribute time:calendar when there is a non-Gregorian calendar associated with a data set, i.e. 

time:calendar=noleap 

Ferret reads this attribute from a netCDF file, or gets it from a definition made with DEFINE ATTRIBUTE and assigns the designated calendar to the time axis. 

Example: 

Define a calendar axis and regrid an existing variable to this axis: 

yes? DEFINE AXIS/CALENDAR=JULIAN/T="15-JAN-1982":"15-DEC-1985":30/UNITS=days tmodel yes? LET twind = uwnd[GT=tmodel@NRST] 

When regridding from one calendar axis to another the length of a year is assumed to be constant, therefore the regridding calculates a scale factor based on the length of a second in each calendar, computed from the number of seconds per year for the calendars. 

DEFINE AXIS/DEPTH 

Specifies the Z axis to be a depth, positive downward, axis. A depth axis is indicated by a "(-)" following its title in a SHOW GRID or SHOW AXIS command. Depth axes are notated by "UD" (up-down) in the grid definition file, while normal vertical axes (such as an elevation axis in meteorology) are notated by "DU" (down-up). 

Example: 

yes? DEFINE AXIS/Z=0:5000:20/DEPTH/UNITS=CM AXZDCM 


DEFINE AXIS/EDGES 

The /EDGES qualifier indicates that the coordinates provided refer to the edges or boundaries between grid cells. When /EDGES is used, the coordinates of the grid points will be computed at the midpoints between the indicated edges. When /EDGES is used in conjunction with /FROM_DATA the number of grid points created will be equal to the number of coordinates minus one, since the list of edges includes both the upper and lower edge of the axis. An example of defining an axis by its edges is 


yes? DEFINE AXIS/Z=0:5010:20/EDGES/DEPTH/UNITS=CM AXZDCM 

A class of especially important uses for the /EDGES qualifier is to create custom calendar axes. This example creates a true monthly axis, with axis cells beginning on the first of each month: 

yes? ! Define a 20 year monthly axis starting in Jan 1950
yes? LET start_year = 1950
yes? LET nyears = 20
yes? LET indices = L[L=1:`nyears*12`]
yes? LET month = MOD(indices-1,12)+1
yes? LET year = start_year + INT((indices-1)/12)
yes? DEFINE AXIS/UNITS=days/T0=1-jan-1900/EDGES truemonth  = DAYS1900(year,month,1)

yes? ! Examine one year of it
yes? SHOW AXIS/T=1-jan-1958:1-jan-1959 truemonth
name      axis       # pts   start                end
TRUEMONTH TIME       239 i   16-JAN-1950 12:00    16-NOV-1969 00:00
T0 = 1-JAN-1900
  Axis span (to cell edges) = 7274
    L     T                  TBOX   TBOXLO              TSTEP (DAYS)
   96>  16-DEC-1957 12:00:00  31  01-DEC-1957 00:00:00   21168.5
   97>  16-JAN-1958 12:00:00  31  01-JAN-1958 00:00:00   21199.5
   98>  15-FEB-1958 00:00:00  28  01-FEB-1958 00:00:00   21229
   99>  16-MAR-1958 12:00:00  31  01-MAR-1958 00:00:00   21258.5
  100>  16-APR-1958 00:00:00  30  01-APR-1958 00:00:00   21289
  101>  16-MAY-1958 12:00:00  31  01-MAY-1958 00:00:00   21319.5
  102>  16-JUN-1958 00:00:00  30  01-JUN-1958 00:00:00   21350
  103>  16-JUL-1958 12:00:00  31  01-JUL-1958 00:00:00   21380.5
  104>  16-AUG-1958 12:00:00  31  01-AUG-1958 00:00:00   21411.5
  105>  16-SEP-1958 00:00:00  30  01-SEP-1958 00:00:00   21442
  106>  16-OCT-1958 12:00:00  31  01-OCT-1958 00:00:00   21472.5
  107>  16-NOV-1958 00:00:00  30  01-NOV-1958 00:00:00   21503
  108>  16-DEC-1958 12:00:00  31  01-DEC-1958 00:00:00   21533.5
  109>  16-JAN-1959 12:00:00  31  01-JAN-1959 00:00:00   21564.5 

The following example shows the computation of a custom climatological average. Given, for example, a multi-year time series of a daily measured variable, the climatological average of the variable for two unequal time periods could be computed by creating an axis with two points, using the FROM_DATA qualifier. The grid cells for these two points would extend from 15-Mar to 27-May  (about 73 days), and  from 27-May to 15-Mar (about 292 days). The actual dates on which the 2 points are located would be the midpoints of these two intervals, on 20-Apr and 20-Oct. 

yes? DEFINE AXIS/t=1-jan-0001:1-jan-0002:1/unit=days/t0=1-jan-0000 tencoding
yes? LET tstep = t[gt=tencoding]
yes? LET start_date = tstep[t=15-mar-0001]
yes? LET end_date = tstep[t=27-may-0001]
yes? DEFINE AXIS/T/UNITS=days/T0=1-jan-0000/EDGES/MODULO tax={`start_date,p=7`,`end_date,p=7`,`start_date+365.2425,p=7`} 

yes? DEFINE GRID/T=tax taxgrid 

yes? SHOW/L=1:2 grid taxgrid 

     GRID TAXGRID
 name       axis              # pts   start                end
 normal    X
 normal    Y
 normal    Z
 TAX       TIME                 2mi   20-APR      12:00    20-OCT  02:54 

            L     T                 BOX_SIZE       TIME_STEP (DAYS)
           1>  20-APR      12:00:00  73             475.5
           2>  20-OCT      02:54:35  292.2425       658.1212 


DEFINE AXIS/BOUNDS 

Define an axis from lists of coordinates and bounds. (See the discussion of netCDF bounds, page ). The specificaion may be either in terms of 2*N bounds or N+1 edges. For 2*N bounds the upper bound of each cell must be the same as the lower bound of the next cell.The coordinates must be inside (or may coincide with) the cell bounds. (Spaces are used here to clarify the pairs of bounds, but are not necessary and do not affect the way the data is read.) 

DEFINE AXIS/X/BOUNDS axisname = coordinates, bounds 

Examples: 

  First, a 2*N bounds definition and then an N+1 one. Note that the second definition has the coordinate z=0 at the same location as the edge of the first grid cell. 

   yes? DEF AXIS/X/BOUNDS xax =  {1,2,5,6}, {0.5,1.5, 1.5,2.5, 2.5,5.5, 5.5,6.5} 


   yes? LET a = {0,20,50,75,120}
  yes? LET b = {0,10,30,60,90,150}
  yes? DEF AXIS/Z/DEPTH/BOUNDS zax = a, b 

DEFINE AXIS/FILE= 

Reads a gridfile for grid and axis definitions. The gridfile specified should be in the standard TMAP gridfile format. There are several documents in $FER_DIR/doc regarding gridfiles and TMAP format (e.g., "about_grid_files.txt"). 


yes? DEFINE AXIS/FILE=grid_file.grd 

DEFINE AXIS/FROM_DATA 

Used only in conjunction with /NAME to define an axis from any expression that Ferret can evaluate. 


yes? DEFINE AXIS/FROM_DATA/NAME=axis_name   expr 

(This is a mechanism to convert dependent variables into independent axis data.) 

When defining an axis from a LET-defined variable or expression the condensed syntax (e.g.) 

yes? DEFINE AXIS/X axname=expression 

  replaces the older (still supported) syntax 

yes? DEFINE AXIS/X/NAME=axname/FROM_DATA expression 

Note that the values from which the axis is to be created must be in strictly increasing order. If the coordinates are repeated, Ferret will "micro-adjust" the values by adding multiples of 1 millionth of the axis range to the repeated values. Ferret will issue an informative message if it is micro-adjusting an axis. 

Example (unevenly-spaced axis): 

yes? DEFINE AXIS/X my_xaxis=pos[D=2]^0.5 

defines each coordinate of the axis "my_xaxis" as the square root of variable "pos" from data set 2. 

Variables in Ferret are always represented as single precision floating-point numbers. Coordinates are represented as double precision values. This presents a quandary when we wish to define an axis, and have double precision data representing the coordinates available as a variable (but not a coordinate variable)  in a netCDF file. Once that variable is read by Ferret, it becomes single precision and we lose the precision needed to define the axis. Starting with V6 of Ferret, a means is provided to work around this, in particular for making graphics. We read the data, specifying an offset which is applied when the data is read, and which gives the numbers fewer significant figures, so the variations are represented in single precision. This may be "undone" via a PPLUS command which applies the reverse offset to the coordinates at the time we make a plot. 

For example, say a variable called XVALS is in a netCDF file, which has data values {144.002, 144.0034, 144.005}. We want to create an axis from these values, and put the variable data_var onto that axis. Once XVALS is converted to single precision we would lose the variation. We can read the locations with the SET VAR/OFFSET command. It is convenient to define a variable to keep the constant offset, as it will be used again. 

Example: 

yes? SET DATA filename.nc
yes? LET xlon = 144
yes? SET VAR/OFFSET=`-1*xlon` xvals

yes?  ! when the data is read, the offset is added 

yes? LIST/NOHEADER xvals
1   / 1:  0.002000
2   / 2:  0.003400
3   / 3:  0.005000 

yes?  ! Define an axis, and put the variable onto this axis...
yes? DEFINE AXIS/X/UNITS=deg  xxaxis = xvals 

yes? LET var = data_var[gx=xxaxis@ASN] 

yes?   ! Add back the offset. This works with any plotting command.
yes? PLOT/SET var
yes? PPL XVALOFF `xlon`
yes? PPL PLOT 


DEFINE AXIS/MODULO[=len] 

Specifies that the axis being defined be treated as modulo; that is, the first point will wrap around and follow the last point (e.g., a longitude axis).The optional modulo length is the length in axis units of the modulo repeat. If a length is specified, it may be longer than the axis span, so that the axis is treated as a subspan modulo axis, and if no length is specified then the default modulo length for the type of axis is used. See the sections on modulo axes and subspan modulo axes for more information (p.167 ff). 

DEFINE AXIS/NAME= 

Used only in conjunction with /FROM_DATA to specify the name of the axis to be defined. 


yes? DEFINE AXIS/FROM_DATA/NAME=axis_name   expr 


DEFINE AXIS/NPOINTS= 

Specifies the number of coordinate points on the axis being defined. 


yes? DEFINE AXIS/Z=lo:hi/NPOINTS=n   ax_name 

This qualifier can be used instead of specifying Z=lo:hi:delta

DEFINE AXIS/T0= 

Specifies the date and time associated with the time step value 0.0 

Example: 

DEFINE AXIS/T="1-NOV-1980":"15-AUG-1988":72/T0="1-JAN-1800"  TNEW 

Note: The /T0 qualifier is optional; the underlying time step values are transparent to Ferret users for most purposes. The default value is 15-JAN-1901. 

DEFINE AXIS/UNITS= 

Specifies the units of the axis being defined. 


 A DEFINE AXIS command such as DEFINE AXIS/X=130E:80W:2 xax infers from the formatting of the longitude coordinates the implied qualifier "/UNITS=degrees". Similar for latitudes. 

Example: 

yes? DEFINE AXIS/Z=0:2000:100/UNITS=CM   ZCM 

Any string (up to 10 characters) is acceptable as a units string, but only the following units are recognized and used when computing axis transformations: 

NOTES: 

1) As of Ferret version 5.1 the definition of the unit "month" has been redefined to be exactly 1/12 of a climatological year. This change applies both to files that use "units=months" and to the DEFINE VARIABLE command. The climatological month is the length of an average month in the Gregorian calendar, including leap years -- 1/12 or 365.2485 days. Thus the command 

yes? DEFINE AXIS/T0=1-JAN-0000/T=0:12:1/EDGES/units=months/MODULO month_reg 

defines a climatological monthly axis which does not "drift" over time due to leap years. This non-drift behavior can be observed using a commands like 

yes? SHOW AXIS /l=1:12001:1200 month_reg 

which will show every 100th January over 1000 years. To create a monthly Gregorian  calendar axis - with axis cells beginning on the first of each month, see the example under DEFINE AXIS/EDGES (p. 340). 

2) The units dbar and mbar are recognized by Ferret, however, no automatic conversion is attempted between these and any other units. 

TIP: 

Ferret will convert recognized units of length to meters and recognized units of time to seconds during transformations such as integration (@IIN and @DIN) and differentiation (@DDB, @DDC, @DDF) (see "General Information about transformations," p. 113). Using this characteristic it is always possible to query Ferret about the conversion factors from meters or seconds by integrating a grid cell of width one on an axis of the units in question. For example: 

yes? ! query conversion factor to meters
yes? define axis/x=0:1:1/edges/units=feet xtest  ! 1 point, cell width=1 unit
yes? let vx = 0*X[gx=xtest]+1                    ! vx = 1
yes? list/prec=7 vx[x=@din]
            0*X[GX=XTEST]+1
            X (FEET): 0 to 1 (integrated)
         0.3048000

yes? ! query conversion factor to seconds
yes? define axis/t=0:1:1/edges/units=month ttest  ! 1 point, cell width=1 unit
*** NOTE: /UNIT=MONTHS is ambiguous ... using 1/12 of 365 days.
yes? let vt = 0*T[gt=ttest]+1                     ! vt = 1
yes? list/prec=7 vt[t=@din]
            0*T[GT=TTEST]+1
            T (MONTH): 0 to 1 (integrated)
         2628000. 



Ref Sec4.4.  DEFINE GRID 

/X/Y/Z/T /FILE /LIKE 

Defines a grid (name may be up to 16 characters). 

yes? DEFINE GRID[/qualifiers]   grid_name 

Example: 

yes? DEFINE GRID/LIKE=temp/T=my_t_axis   my_grid 

Command qualifiers for DEFINE GRID: 

DEFINE GRID/X=/Y=/Z=/T= 

Specifies what particular axis is to be the X, Y, Z, or T axis for this grid. 


yes? DEFINE GRID/X=axname  grid_name 

The name axname may be the name of an axis, the name of a grid that uses the axis desired, or the name of a variable for which the defining grid uses the axis desired. 

For example, 

yes? DEFINE GRID/X=U   gx 

will create a grid named gx which is one-dimensional—normal to Y, Z, and T. 

Note: Many axes possess an orientation implicit in their units, especially latitude, longitude, and time axes. The effects of using an axis in an inappropriate orientation, such as /X=time_axis, are unpredictable. 

DEFINE GRID/FILE= 

Reads a gridfile for GRID and AXIS definitions. The gridfile specified should be in the standard TMAP gridfile format. There are several documents in $FER_DIR/doc regarding gridfiles and TMAP format (e.g., about_grid_files.txt). 

Example: 

yes? DEFINE GRID/FILE=new_grids.grd 


DEFINE GRID/LIKE= 

Specifies a particular grid (by name or by reference to a variable defined on that grid) to use as a template to create a new grid. 


yes? DEFINE GRID/LIKE=grid_or_variable_name   grid_name 

All axes of the grid being created will be identical to the axes of the "LIKE=" grid except those explicitly changed with the /X, /Y, /Z, or /T qualifiers. The argument may be an expression. 

Example: 

yes? DEFINE GRID/LIKE=temp[D=2]/Z=ZAX  gnew    !temp from data set 2 

Examples:  DEFINE GRID 

1)    yes? DEFINE AXIS/T="1-JAN-1980":"31-DEC-1983":24 axday
yes? DEFINE GRID/LIKE=temp/T=axday gday
Define grid gday to be like the defining grid for temp but with a 4-year, daily-interval time axis. 

2)    yes? DEFINE GRID/LIKE=temp[D=ba022]/T=sst[D=nmc] gnmc3d
Define grid gnmc3d like temp from data set ba022 but with the same time axis as sst from data set nmc. 

3)    yes? DEFINE AXIS/X=140E:140W:.2 xnew
yes? DEFINE AXIS/Y=5S:5N:.2 ynew
yes? DEFINE AXIS/T="15-FEB-1982":"15-FEB-1984":48 tnew
yes? DEFINE GRID/X=xnew/Y=ynew/T=tnew gnew

Define grid gnew from new axes. The grid, gnew, will be normal (perpendicular) to Z. 


Ref Sec4.5.  DEFINE REGION 

/I/J/K/L /X/Y/Z/T /DI/DJ/DK/DL /DX/DY/DZ/DT /DEFAULT 

 Defines or redefines a named region_name (first 4 characters are recognized). 

yes? DEFINE REGION[/qualifiers] region_name 

If the qualifier /DEFAULT is not given only those axes explicitly named will be stored. If the qualifier /DEFAULT is given all axes will be stored. 

Command qualifiers for DEFINE REGION: 

DEFINE REGION/I=/J=/K=/L=/X=/Y=/Z=/T= 

Specifies region limits ( =lo:hi  or  =val). 


DEFINE REGION/DI=/DJ=/DK=/DL=/DX=/DY=/DZ=/DT= 

Specifies a change in region relative to the current settings (=lo:hi  or  =val). See examples below. 


DEFINE REGION/DEFAULT 

Saves all axes and transformations, not just those explicitly given. Commonly, a GO script begins with "DEFINE REGION/DEFAULT save" and ends with "SET REGION save". 

Examples:  DEFINE REGION 

1)    yes? DEFINE REGION/DEFAULT  save
Stores the current default region under the name "save". The region may be restored at a later time by the command   yes? SET REGION save

2)    yes? DEFINE REGION/X   xonly
Stores the current default X axis limits, only, as region xonly. 

3)    yes? DEFINE REGION/DX=-5   xonly
Stores the current default X axis limits minus 5 as region xonly. 

4)    yes? DEFINE REGION/Y=20S:20N/Z   yanz
Stores the given limits from the Y axis and the default Z axis limits. 

5)    yes? DEFINE REGION/DEFAULT/L=5   l5
Stores the current default region with the modification that L, the time step, is stored as 5. 

6)    yes? DEFINE REGION/DL=-1:+1  lp2
Stores an L region beginning 1 time step earlier and ending 1 time step later than the current default region as region lp2. 


Ref Sec4.6.  DEFINE SYMBOL 

Allows the user to define a string variable. Symbol names must begin with a letter and contain only letters, digits, underscores, and dollar signs. 

yes? DEFINE symbol symbol_name=string 

Example: 

yes? DEFINE symbol my_x_label = sample number 



Ref Sec4.7.  DEFINE VARIABLE 

/D /QUIET /TITLE /UNITS /BAD= 

Allows the user to define a variable from a valid algebraic expression. Note: LET is an alias for DEFINE VARIABLE. 

yes? DEFINE VARIABLE[/qualifiers]  name=expression 

Example: 

yes? LET SPEED = U^2 + V^2 

Parameters 

The expression may be any valid expression. See the chapter "Variables and Expressions", section "Expressions" (p. 73) for a definition of valid expressions. 

Variable names 

The name specified with DEFINE VARIABLE can be 1 to 128 characters in length—letters, digits, $ and _, beginning with a letter. Pseudo-variable names (I, J, K, L, X, Y, Z, T , XBOX, YBOX, ZBOX, TBOX) and operators (AND, OR, GT, GE, LT, LE, EQ, NE) are reserved and cannot be used. It is not recommended to use function names such as SIN, EXP, LN or Ferret operators and keywords like PLOT or AXIS as variable names. See the chapter "Variables and Expressions" (p. 59) for recognized operators and functions, or use the commands SHOW COMMAND and SHOW FUNCTION for a list of all commands and functions. 

If the name defined is the same as a variable name in a data set, the user-defined variable is used instead of the file variable. (Look for LET/D=d_set to control this behavior in future Ferret versions.) 

Examples: 

1)    yes? DEFINE VARIABLE sum = a+b
    or equivalently
yes? LET sum = a+b 

2)    yes? DEFINE VARIABLE/TITLE="velocity"/UNIT="m/sec" pos[T=@DDC]*0.01
Defines velocity in m/sec from position, pos, in cm. 

Command qualifiers for DEFINE VARIABLE: 

DEFINE VARIABLE/BAD=value 

Allows user to control the missing value of user-defined variables  The specified value will be used whenever the variable is LISTed (or SAVEd) to a file. Note that the missing value will revert to its default (-1E34) when this variable is combined in further calculations. 

Example: 

yes? let/bad=3 gap_3 = I[I=1:5]
yes? list gap_3
            I[I=1:5]
1   / 1:  1.000
2   / 2:  2.000
3   / 3:   ....
4   / 4:  4.000
5   / 5:  5.000
yes? let new_var = gap_3 + 5
yes? list new_var
            GAP_3 + 5
1   / 1:   6.00
2   / 2:   7.00
3   / 3:   ....
4   / 4:   9.00
5   / 5:  10.00
yes? list/form=(1PG15.3) new_var
            GAP_3 + 5
            X: 0.5 to 5.5
      6.00    
      7.00    
    -1.000E+34
      9.00    
      10.0    
 

DEFINE VARIABLE/D=dataset 

Restricts the scope of the variable name to the named data set. See further discussion in the chapter "Variables and Expressions", section "Defining New Variables" (p. 143). 

The qualifier "DATASET=" (LET/DATASET=...)  allows you detailed control over the multiple use of the same name. 

If the name or number of a data set is supplied then the /dataset qualifier indicates that this variable name is to be defined only in the specified data set. For example 

yes? LET/dataset=coads_climatology V_geostrophic = SLP[X=@DDC]/(F*RHO) 

Defines V_geostrophic only in data set coads_climatology. In other data sets the name V_geostrophic may refer to file variables or it may be given different definitions or it may be undefined. The data set may be specified either by name as in this example or by number as shown by SHOW DATA. Note that variables defined using LET/dataset=[name_or_number] will be shown in the SHOW DATA output for that data set as well as in SHOW VARIABLES. 

If the /dataset qualifier is applied without specifying a data set name then the interpretation is different. In this case the named variable becomes a default definition -- one which applies only if a data-set specific variable of the same name does not exist. For example, if the command 

yes? LET/DATASET sst = temp[Z=0] 

is issued then sst[D=levitus_climatology] will evaluate to temp[D=levitus_climatology,Z=0] because the variable sst does not exist in levitus_climatology, but sst[D=coads_climatology] will refer to the file variable name sst within the coads_climatology data set. 

LET/D is especially useful for editing data sets because it gives a ready way to distinguish between the pre-edit and post-edit versions of the variable. In this example we edit the data set etopo60, replacing a small rectangle in the Pacific Ocean. 

Example: 

! Do not use memory-cached data when editing.
! Always reread the most recent version from the file. 

yes? SET MODE STUPID 

! Save an exact copy of the original data for editing.    
! We will call our edited file "new_etopo.cdf"
yes? SET DATA etopo60
yes? LET/D=etopo60 depth = rose
yes? SET VARIABLE/TITLE="edited etopo depth"/UNITS=meters depth
yes? SAVE/FILE=new_etopo.cdf depth
yes? USE new_etopo.cdf

    ! "rose[d=etopo60]"    is the original.
    ! "depth[d=new_etopo]" is the edited version.
    ! Redefine "depth[d=etopo60]" as a tool for for selective editing.
yes? LET/D=etopo60 depth = rose[D=etopo60]-rose[D=etopo60] + correction

    ! An example edit: replace a small region with the value 500
yes? LET correction = 500
yes? SAVE/APPEND/FILE=new_etopo.cdf depth[D=etopo60,X=180:175w,Y=0:2n]
yes? PLOT/X=160e:160w/Y=1n rose[D=etopo60], depth[D=new_etopo] 


DEFINE VARIABLE/QUIET 

Suppresses message that, by default, tells you when you are redefining an existing variable. This qualifier is useful in command files. (This is the default behavior starting with Ferret version 5.2) 


DEFINE VARIABLE/TITLE= 

Specifies a title (in quotation marks) for the user-defined variable. This title will be used to label plots and listings. If no title is specified the text of the expression will be used as the title. (See also SET VARIABLE/TITLE, p. 423.) 


DEFINE VARIABLE/UNITS= 

Specifies the units (in quotation marks) of the variable being defined. (See command SET VARIABLE/UNITS, p. 423.) 


Ref Sec4.8.  DEFINE VIEWPORT 

/CLIP /ORIGIN /SIZE /TEXT /XLIMITS /YLIMITS/AXES 

Defines a new viewport (a sub-rectangle of the graphics window). 

yes? DEFINE VIEWPORT[/qualifiers]   view_name 

Issuing the command SET VIEWPORT is best thought of as entering "viewport mode."  While in viewport mode all previously drawn viewports remain on the screen until explicitly cleared with either SET WINDOW/CLEAR or CANCEL VIEWPORT. If multiple plots are drawn in a single viewport without the use of /OVERLAY the current plot will erase and replace the previous one; the graphics in other viewports will be affected only if the viewports overlap. If viewports overlap the most recently drawn graphics will always lie on top, possibly obscuring what is underneath. By default, the state of "viewport mode" is canceled. 

Example: 

yes? DEFINE VIEWPORT/XLIMITS=0,.5/YLIMITS=0,.5   LL 

Defines a viewport that will place graphical output into the lower left quarter of the screen, and names the viewport "LL". 

Command qualifiers for DEFINE VIEWPORT. 

DEFINE VIEWPORT/XLIMITS=/YLIMITS= 

Specifies the portion of the full window to be used. 


yes? DEFINE VIEWPORT/XLIMITS=x1,x2/YLIMITS=y1,y2   view_name 

The values of the limits must be in the range [0,1]; they refer to the portion of the window (of height and length 1) which defines the viewport. Together, /XLIMITS and /YLIMITS replace the CLIP, ORIGIN, and SIZE qualifiers in older Ferret versions. 

DEFINE VIEWPORT/TEXT= 

Controls shrinkage (or expansion) of text. 


yes? DEFINE VIEWPORT/TEXT=n  view_name 

In some cases text appearance may become unacceptable due to viewport size and aspect specifications. A value of 1 produces text of the same size as in the full window; 0 < n < 1 shrinks the text; n > 1 enlarges text. Sensible values go up to about 2. When the qualifier  /TEXT is omitted, Ferret computes a text size that is appropriate to the size of the viewport. 

Note that /TEXT modifies the prominence of the text through manipulation of axis lengths rather than through direct manipulation of the many text size specifications. A low value of text prominence produces axes that are "long" (as seen with SHOW SYMBOLS, p. 229, or PPL LIST XAXIS, p. 193), making the (fixed size) text appear less prominent. 

DEFINE VIEWPORT/AXES 

Specifies that user's limits are interpreted as the normalized positions of the plot axes rather than of the entire viewport . 


You can change PPL ORIGIN and PPL AXLEN only after SET VIEW is issued. Use the new qualifier PLOT/NOYADJUST to avoid resetting the Y origin -- relevant during PLOT commands that require extra room for a large key block under the axes or for viewports that lie close to the bottom of the window where there may not be room below the Y origin. If /NOYADJUST is specified, and the viewport is near the bottom of the window, the labelling at the bottom of the plot will be lost. 


DEFINE VIEWPORT/XLIMITS=x1,x2/YLIMITS=y1,y2/AXES   view_name 

Example 1: 

Ref_viewaxes_a

This example shows the effect of the /YADJUST qualifier on the plot command. Define two viewports and plot; on the left the Y axis is adjusted automatically, on the right we specify /NOADJUST and the labelling below the plot is not plotted. 

yes? DEFINE VIEW/AXES/XLIM=0:0.5/YLIM=0:0.5 llax
yes? DEFINE VIEW/AXES/XLIM=0.5:1/YLIM=0:0.5 lrax
yes? SET VIEW llax
yes? PLOT/VS/LINE/I=1:314 i*cos(i/20),i*sin(i/20)

yes? SET VIEW lrax
yes? PLOT/VS/LINE/I=1:314/NOYADJUST i*cos(3+i/20),i*sin(3+i/20) 

Example 2: 

Ref_viewaxes_b

DEFINE VIEWPORT/AXES can be used to set guide lines on a plot 


yes? CANCEL VIEW
yes? DEFINE VIEW/AXES allax
 

yes? SET VIEW allax
yes? PLOT/VS/LINE/HLIM=0:1/VLIM=0:1/NOLAB {0.5,0.5,,0,1},{0,1,,0.5,0.5}
yes? PLOT/VS/LINE/OVER/NOLAB {0.25,0.25,,0,1},{0,1,,0.25,0.25}
yes? PLOT/VS/LINE/OVER/NOLAB {0.75,0.75,,0,1},{0,1,,0.75,0.75}

yes? LABEL 0.26,0.95,-1,0,.2 @P2@AC<-At 0.25
yes? LABEL 0.76,0.95,-1,0,.2 @P3@AC<-At 0.75

yes? DEFINE VIEW /XLIM=0.25:0.75/YLIM=0.25:0.75/TEXT=1/AXES mid
yes? SET VIEW mid
yes? PLOT/VS/HLIM=-1:1/VLIM=-1:1/LINE/I=1:200 cos(i/15),sin(i/15) 


DEFINE VIEWPORT/CLIP=  

This qualifier is obsolete; see XLIMITS= and /YLIMITS= (above). Specifies the location of the upper right corner of the viewport. 


DEFINE VIEWPORT/ORIGIN= 

This qualifier is obsolete; see /XLIMITS= and /YLIMITS= (above). Specifies the location of the lower left corner of the viewport. 


DEFINE VIEWPORT/SIZE=   

This qualifier is obsolete; see /XLIMITS and /YLIMITS (above). Specifies the scaling factor to use relative to the size of the full window. 


Ref Sec5.  ELIF 

The ELIF command is a part of Ferret's conditional command execution capability: IF-THEN-ELIF-ELSE-ENDIF. It is valid only inside of an IF block. See further description under the IF command (p. 360) in this Commands Reference section. 


Ref Sec6.  ELSE