Sets features of the operating environment for program Ferret.
/TYPE /OUTPUT /LIKE
Set or reset attribute characteristics for a variable and/or attribute. (See the section on access to dataset and variable attributes)
yes? SET ATTRIBUTE/TYPE=float varname.attname
SET ATTRIBUTE/OUTPUT= varname[.attname] sets a flag for each attribute which determines whether it is written to output netCDF files. It can turn on writing of all or none of the attributes, or /OUTPUT=default gives the standard set of Ferret output attributes. It is applied as follows.
SET ATT/OUTPUT varname.attname
Sets an individual attribute to be written when the variable is written
SET ATT/OUTPUT=all varname
Output all attributes that have been defined for a variable
SET ATT/OUTPUT=default varname
Write only the outputs that Ferret typically writes by default
SET ATT/OUTPUT=none varname
Output no attributes for the variable
/MODULO /DEPTH /CALENDAR /T0 /UNITS /STRIDE /OFFSET /REGULAR
Set or resets characteristics of an existing axis.
Indicates that an axis is to be treated as a depth axis (graphics made with positive down).
yes? SET AXIS/DEPTH z_ax
Resets the calendar definition for a time axis.The allowed calendars are GREGORIAN, NOLEAP, JULIAN, 360_DAY, and ALL_LEAP. This qualifier is ignored if it is applied to a non-time axis. Applying this qualifier does not change the coordinates of the axis, but only their interpretation. For example, create an axis which is by default a Gregorian calendar axis, containing a leap day. Then reset it to a NOLEAP calendar. The coordinate values are the same but their interpretation as dates is changed.
yes? DEFINE AXIS/T=0:100:1/T0="1-JAN-2004 00:00:00"/UNITS=days tax yes? LIST/L=58:62 T[GT=tax] VARIABLE : T axis TAX SUBSET : 5 points (TIME) 27-FEB-2004 00 / 58: 57.00 28-FEB-2004 00 / 59: 58.00 29-FEB-2004 00 / 60: 59.00 01-MAR-2004 00 / 61: 60.00 02-MAR-2004 00 / 62: 61.00 yes? SET AXIS/CALENDAR=noleap tax yes? LIST/L=58:62 T[GT=tax] VARIABLE : T axis TAX SUBSET : 5 points (TIME) CALENDAR : NOLEAP 27-FEB-2004 00 / 58: 57.00 28-FEB-2004 00 / 59: 58.00 01-MAR-2004 00 / 60: 59.00 02-MAR-2004 00 / 61: 60.00 03-MAR-2004 00 / 62: 61.00
Indicates that an axis is to be treated as a modulo axis (the first point "wraps" and follows the last point, as in 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. If it is not specified, the axis length is used as the modulo length. See the sections on modulo axes and subspan modulo axes for more information.
yes? SET AXIS/MODULO x_ax yes? SET AXIS/MODULO/len=365.2425 days_axis
Indicates that an axis is to be treated as a regularly-spaced axis. Axes may have been saved to a netCDF file in such a way that they appear to be irregular but in fact should be treated as regularly-spaced. (See also SET DATA/REGULART)
yes? SET AXIS/REGULAR x_ax or yes? SET AXIS/REGULAR `sst,RETURN=taxis`
Indicates that the axis is to be treated everywhere it is used, with the stride specified. The stride value directs Ferret to use every nth point along the axis. If variables and grids from different data sets have this exact same axis, then the striding is applied for all those variables and grids. The striding may be cancelled with CANCEL AXIS/STRIDE. See the discussion of netCDF strides.
This qualifier is valid only if /STRIDE= is also specified. Otherwise it is ignored. The value of the offset the delta from the first index value, so that /OFFSET=0 means start at index=1, and
yes? SET AXIS/STRIDE=5/OFFSET=2 my_x_axis
is equivalent to this old stride syntax
yes? LET new_var = old_var[i=3:1000:5]
The stride syntax var[i=start:end:delta] is also still valid.
! Open a dataset with the time axis representing monthly data starting in January ! Set strides so that we pick out every December. yes? use my_monthly_data yes? SET AXIS/STRIDE=12/OFFSET=11 `var,RETURN=taxis` yes? LIST/L=1:10 var VARIABLE : SST[X=300:330@AVE,Y=10:20@AVE] DATA SET : COADS 2x2 Degree Monthly Average Surface Marine Observations FILENAME : coads.cdf FILEPATH : /home/shiva/data/ SUBSET : 10 points (TIME) LONGITUDE: 60W to 30W LATITUDE : 10N to 20N DEC-1946 / 1: 26.73 DEC-1947 / 2: 26.06 DEC-1948 / 3: 26.13 DEC-1949 / 4: 26.26 DEC-1950 / 5: 26.62 DEC-1951 / 6: 26.30 DEC-1952 / 7: 26.85 DEC-1953 / 8: 26.53 DEC-1954 / 9: 25.58 DEC-1955 / 10: 26.64
Sets, or resets, the time origin of a time axis, in the T or the F direction
yes? SET AXIS/T0="1-JAN-1990" t_ax yes? SET AXIS/T0="15-MAR-1950 12:00:00" timeax yes? SET AXIS/T0=1-jan-2001 f4axis
If the axis is not a time or forecast-time axis, this qualifier is ignored. Applying this qualifier does not change the coordinates of the axis, but only their interpretation. If /T0 is applied to an axis that did not previously have a time origin, the axis will become a calendar-formatted axis, with time coordinates automatically translated into date/time strings on listings, and formatted time axes on plots.
Sets, or resets, the units of an axis.
yes? SET AXIS/UNITS=days t_ax yes? SET AXIS/UNITS=meters xax
Applying this qualifier does not change the coordinates of the axis, but only their interpretation. UNITS are expressed as a string and are converted according to the usual rules for Ferret axes, see the description of units under DEFINE AXIS
/EZ /VARIABLE /TITLE /FORMAT /GRID /SKIP /COLUMNS /SAVE /RESTORE /ORDER /TYPE /SWAP /REGULART /DELIMITED /BROWSE
SET DATA/EZ /COLUMNS /FORMAT /GRID /SKIP /TITLE /VARIABLE
Specifies ASCII, binary, netCDF, GT, or TS-formatted data set(s) to be analyzed.
1) ASCII or binary:
yes? SET DATA/EZ[/qualifiers] data_set1, data_set2, …
or equivalently, with alias FILE:
yes? FILE[/qualifiers] data_set1, data_set2, ...
yes? SET DATA/FORMAT=cdf netCDF_file
or equivalently, with alias USE
yes? USE netCDF_file
or for a netCDF dataset on a DODS server,
yes? use "http://www.ferret.noaa.gov/cgi-bin/nph-nc/data/coads_climatology.nc"
3) GT or TS-formatted
yes? SET DATA data_set1, data_set2, ...
In the case of GT or TS-formatted files, an extension of .des is assumed. A previously SET data set can be SET by its reference number, as shown by SHOW DATA, rather than by name.
4) Descriptor files (multi-file datasets). Include the file extension. Beginning with Ferret v6.84 the default dataset type is NetCDF/OPeNDAP. This means that descriptor files are recognized only if the file extension .des ends the file name. Either SET DATA or USE will work:
yes? SET DATA multi.des yes? USE multi.des
If a Unix filename includes a path (with slashes) then the full path plus name must be enclosed in double quotation marks.
yes? use "/home/mydirectory/mydata/new_salinity.cdf"
Note: Maximum simultaneous data sets that may be open at once is limited to 100. Use CANCEL DATA if the limit is reached.
Command qualifiers for SET DATA_SET:
OPEN is an alias for SET DATA /BROWSE
Opens a ThreddsBrowser window for selecting a data set to analyze. (See ThreddsBrowser requirements and set-up below.) When a data set is successfully chosen, the data set name or URL is appended to the list to the data sets (if any) specified in the command.
When ThreddsBrowser starts, you will be asked to select a location to look for data sets. A drop-down list of previous locations used is provided, or you can enter a new location by either typing in a THREDDS catalog website address or selecting a local directory. So, for instance, suppose you want to open the coads_climatology data set and another dataset that your want to browse for. Entering the command:
yes? set data /browse /format=cdf coads_climatology
will bring up the ThreddsBrowser window:
After selecting the location to display, the browser will give a directory tree listing the data sets at the site:
When "Use dataset" is pressed, the ThreddsBrowser window will disappear, a comment will be written indicating the final Ferret command actually executed, and the prompt will return to allow you to continue working.
yes? set data /browse /format=cdf coads_climatology !-> set data /format=cdf coads_climatology "http://edac-dap3.northerngulfinstitute.org/thredds/.... yes? show data currently SET data sets: 1> /home/users/tmap/ferret/linux/fer_dsets/data/coads_climatology.cdf name title I J K L SST SEA SURFACE TEMPERATURE 1:180 1:90 ... 1:12 AIRT AIR TEMPERATURE 1:180 1:90 ... 1:12 SPEH SPECIFIC HUMIDITY 1:180 1:90 ... 1:12 WSPD WIND SPEED 1:180 1:90 ... 1:12 UWND ZONAL WIND 1:180 1:90 ... 1:12 VWND MERIDIONAL WIND 1:180 1:90 ... 1:12 SLP SEA LEVEL PRESSURE 1:180 1:90 ... 1:12 2> http://edac-dap3.northerngulfinstitute.org/thredds/dodsC/ncom_fukushima_agg/Fukushima_best.ncd (default) name title I J K L TIME_OFFSET offset hour from start of run f ... ... ... 1:257 TIME_RUN run times for coordinate = time ... ... ... 1:257 SURF_TEMP_FLUX model surface temperature flux 1:622 1:667 ... 1:257 SURF_SALT_FLUX model surface salinity flux 1:622 1:667 ... 1:257 ....
If a local directory is selected as the location to display, you will be asked for filename extensions of data sets to display. Then the directory, and all the directories under it, will be searched for data sets. If there is a very large number of files and directories, a progress window will be displayed. Finally, a directory tree of data sets, very similar to that for THREDDS catalogs, will be shown.
Note that any aliases will be translated in the comment returned after selecting a data set.
yes? use /browse !-> SET DAT/FORM=CDF "/home/users/tmap/ferret/linux/fer_dsets/data/etopo120.cdf"
ThreddsBrowser requirements and set-up: ThreddsBrowser requires Java version 1.6 or later. If the 'java' program is not on your path (not found when run from the command line), you will need to define the enviroment variable JAVA_HOME to the Java home directory, which has a bin subdirectory containing the java executable ($JAVA_HOME/bin/java should run). Also, the enviroment variable FER_LIBS needs to be defined as the directory containing threddsBrower.jar and toolsUI.jar files. Optionally, the enviroment variable FER_DATA_THREDDS can be defined as a space-separated list of initial "known locations". These environment variables should be defined in your ferret_paths script.
Specifies the format of the data set(s) being SET. Allowable values for "file_format" are "cdf", "delimited", "free", "stream", "unformatted", or a FORTRAN format in quotation marks and parentheses.
yes? SET DATA/FORMAT=file_format [data_set_name_or_number]
Valid arguments for /FORMAT=
3) SET DATA/FORMAT=descriptor
Will open the dataset as a descriptor file. The extension must be included in the file name. USE/FORMAT=descriptor is also valid. If the file extension is .des or .mc then the file will be recognized as a descriptor file without the /FORMAT qualifier. (.mc is recognized only in Ferret v6.85 and higher).
yes? SET DATA/FORMAT=CDF my_netcdf
yes? USE my_netcdf
See the chapter "Data Set Basics", section "NetCDF data."
The permutation argument contains information both about the order of the axes in the file and the direction.
The order indicated through the /ORDER qualifier should always be exactly the reverse of the order in which the dimensions of variables as revealed by the netCDF ncdump -h command are declared. (This ambiguity reflects the linguistic difference between "C ordering" and "FORTRAN ordering". The default X-Y-Z-T ordering used in the COARDS standard and in Ferret documentation would be referred to as T-Z-Y-X ordering if we used C terminology.)
Thus, to USE a file in Ferret in which the data on disk transposes the X and Y axes we would specify
To use a file in which the data were laid down in XZ "slabs", such as might occur in model outpus we would specify
To indicate that the coordinates along a particular axis are reversed from the "right hand rule" ordering, for example a Y axis which runs north to south (not uncommon in image data), we would precede that axis by a minus sign. For example
The minus sign should be applied to the axis position **after** transposition. Thus if a file both transposed the XY axis ordering and used north-to-south ordering in latitude one would access the file with
NetCDF files, while in principle self-documenting, may be contain axis ambiguities. For example, a file which is supposed to contain a time series, but lacks units on the coordinate variable in the file may appear to be a line of data on the X axis. The /ORDER qualifier can be used to resolve these ambiguities. For this example, one would initialize the file with the command
Notes for USE/ORDER:
a) Note that specifying USE/ORDER=XYZT is not always equivalent to specifying default ordering. For example, if a netCDF file contained variables on an XYT grid, the /ORDER=XYZT specifaction would tell Ferret to interpret it as an XYZ grid.
b) Also note, the /ORDER qualifier will be ignored if either the file is not netCDF, or the file is netCDF but has an "enhanced" header (see SAVE/HEADING=enhanced)
Speeds initialization of large netCDF data sets with known regular time axes. When Ferret initializes a netCDF file (the SET DATA/FORMAT=cdf command or the USE command alias), it checks for the attribute point_spacing = "even" on the time axis. If found, Ferret knows that the coordinates are evenly spaced and reads only the first and last coordinate on the axis to obtain a complete description. If not found, Ferret must read the full list of coordinates -- a time-consuming procedure for very large files. After reading the coordinates, Ferret determines if they are regular. The /REGULART qualifier instructs Ferret to treat the time axis as regular regardless of the presence or absence of a point_spacing attribute in the file, speeding up the initialization time on files lacking point_spacing, but known to be regular. If the file happens to contain a bounds attribute on the time axis, and /REGULART is specified, then the bounds are ignored.
Note that when writing netCDF files Ferret, by default, does NOT include the point_spacing attribute. This is because Ferret's default file characteristic is to be append-able, with no guarantees that the appended time steps will be regularly spaced. For output files of fixed length with regular time steps it is advisable to use the SAVE/RIGID qualifier. This allows Ferret to include the point_spacing="even" attribute. If the files will be very large (too large for the full time range to be in memory), then use the /RIGID/TLIMITS= qualifiers to specify the full, ultimate fixed size and use SAVE/APPEND to insert data into the file piecemeal.
If the file has the bounds attribute for the record axis (files written with Ferret version 5.70 and after include the bounds attribute for all irregular axes), then we can append further timesteps to the file and keep the correct point spacing. If there is a gap between the last time in the existing file and the first time being appended, Ferret adds a void point, consisting of missing data, centered on the interval between the upper cell bound of the time axis in the file and the lower cell bound of the new data being written.
Ferret reads and checks the coordinate data when a dataset is initialized. Coordinates must be strictly increasing. If coordinates are repeated, Ferret will attempt to create a strictly-increasing axis by "midro-adjusting" the coordinates.
yes? use repeat_t_coord.nc *** NOTE: Axis has repeated values -- micro-adjusting TMIN
To avoid this adjustment, specify USE/STRICT.
yes? cancel data/all yes? use/STRICT repeat_t_coord.ncyes? use/strict repeat_t_coord.nc *** NOTE: Coordinates out of order or missing on axis TMIN at subscript 4 *** NOTE: A dummy axis of subscripts will be used
See the section on NetCDF data for more on the process of initializing coordinate data.
3) SET DATA/FORMAT=UNFORMATTED
To use the format "unformatted" the data must be floating point, binary, FORTRAN-style records with all of the desired data beginning on 4-byte boundaries. This option expects 4 bytes of record length information at the beginning and again at the end of each record. The "-" designator ( /VARIABLES) can be used to skip over unwanted 4-byte quantities (variables) in each record. See the chapter "Data Set Basics", section Binary data.
NOTE: Integer format is not supported by Ferret; to read integer data use an equivalent F format, for instance, FILE/FORMAT=(f5.0). See also reading "delimited" files for reading string data or data with dates which have mixed string and numeric information.
The format specified is for reading each record; it cannot be used to specify the total number of values read. That is determined by the grid for the variables. The grid is by default an abstract axis of length 20408, or it may be set explicitly using DEFINE AXIS, DEFINE GRID and SET DATA/GRID= commands.
yes? SET DATA/EZ/FORMAT="(5X,F12.0)"/VAR=year my_data_set ! or equivalently, yes? FILE/FORMAT="(5X,F12.0)"/VAR=year my_data_set
5) SET DATA/FORMAT=STREAM
/FORMAT=stream is used to indicate that a file contains either unstructured binary output (typical of C program output) or fixed-length records suitable for direct access (all records of equal length, no record length information embedded in the file). With caution it is also possible to read FORTRAN variable-length record output. This sort of file is typically created by "quick and dirty" FORTRAN code which uses the simplest FORTRAN OPEN statement and outputs entire variables with a single WRITE statement.
This format specifier allows you to access any contiguous stretch of 8-byte values from the file. The /SKIP=n qualifier specifies how many values should be skipped at the file start. The /GRID=name qualifier specifies the grid onto which the data should be read and therefore the number of values to be read from the file (the number of points in the grid). Note that an attempt to read more data than the file contains, or to read record length information, will result in a fatal FORTRAN error on UNIX systems and will crash the Ferret program.
For multiple variables, use the /COLUMNS=n specifier to specify how many 8-byte values separate each variable in the file. Each variable is assumed to represent a contiguous stream of values within the file and all variables are assumed to possess the same number of points. (A "poor man's method" is to create multiple Unix soft links pointing to the same file and multiple SET DATA/EZ commands to specify one variable from each link name.)
See the chapter "Data Set Basics", section Binary data for further discussion and examples of binary types. Also see the section below under SET DATA/TYPE for a list of the data types that may be read using SET DATA/FORMAT=STREAM
SET DATA/FORMAT=DELIMITED[/DELIMITERS=][/TYPE=][/VAR=] filename
Initializes a file of mixed numerical, string, and date fields. If the data types are not specified the file will be analyzed automatically to determine data types. Using delimited files, the number of variables that can be read from a single file is increased from 20 to 100.
The alias COLUMNS stands for "SET DATA/FORMAT=DELIMITED"
/DELIMITER - list of field delimiters. Default is tab or comma. You can list any ascii character. For example, if fields are delimited with X and also with tabs and commas, use /DELIM="X,\t,\,". Special characters include
- \b - blank
- \t - tab
- \n - newline
- \nnn - decimal value from ASCII table
/TYPE is the list of data types of the fields. Field types may be any of
- "-" - skipped
- LATITUDE - e.g. 87S or 21.5N (interpreted as negative or positive, respectively)
- LONGITUDE - e.g. 160W or 30E (interpreted as negative or positive, respectively)
- TIME - e.g. hh:mm or hh:mm:ss.s/
- DATE - e.g. mm/dd/yy or mm/dd/yyyy or yyyy-mm-dd or yyyymmdd - value returned is days from 1-jan-1900 (consistent with the DAYS1900 function) using US date formats.
- EURODATE - e.g. dd/mm/yy or dd/mm/yyyy or yyyy-mm-dd using European style date formats
- DATIME - combined US date and time, separated by a space and read together as one field., e.g. 05/16/2013 14:22:15
- EDATIME -combined Eurodate and time formats, separated by a space and read together as one field, e.g.
DATIME and EDATIME are first implemented in Ferret V7.1. In future DATIME and EDATIME will also allow Z and T as a separator.
See the section on delimited files in the Data Set Basics chapter "Reading Delimited Data" for examples.
Restores the current default data set number that was saved with SET DATA/SAVE.
This is useful in creating GO files that perform their function and then restore Ferret to its previous state.
Saves the current default data set number so it can be restored with SET DATA/RESTORE.
This is useful in creating GO files that perform their function and then restore Ferret to its previous state.
Associates a title with the data set.
yes? SET DATA/EZ/TITLE="title string" file_name yes? USE/TITLE="pmel data set" "http://www.ferret.noaa.gov/cgi-bin/nph-nc/data/coads_climatology.nc"
For EZ, netCDF, or DODS datasets, set a title. This title appears on plotted outputs at the top of the plot.
yes? SET DATA/EZ[/qualifiers] ASCII_or_binary_file ! or, equivalently, yes? FILE[/qualifiers] ASCII_or_binary_file
yes? FILE/VARIABLE=my_var my_data.dat
See the chapter "Data Set Basics", section ASCII data for more information and examples.
Beginning with Ferret v6.93, the FILE command when given without a grid, Ferret determines the size of the file and defines an axis and grid on which to read the variables. It takes any /skip and /columns qualifiers into account. This means that `VAR,RETURN=isize` for variables in the dataset return the correct result.
[Prior to Ferret v6.93, when used on its own, SET DATA/EZ/VAR= uses a default axis length which may be shorter than the size of your data. If this is the case, use DEFINE AXIS and DEFINE GRID commands, and FILE/GRID= to read your data, as discussed in the "Data Set Basics" chapter.]
Specifies the number of columns in the EZ data file.
By default the number of columns is assumed to be equal to the number of variables (including "-"'s) specified by the /VARIABLES qualifier.
Specifies the defining grid for the data in the data set. The argument can be the name of a grid or the name of a variable that is already defined on the desired grid.
yes? SET DATA/EZ/GRID=sst[D=coads] snoopy
This is the mechanism by which the shape of the data (1D along T axis, 2D in the XY plane, etc.) is specified. See also the examples in the section Reading ASCII files. By default Ferret uses grid EZ, a line of up to 20480 points oriented along the X axis.
Specifies the number of records to skip at the start of a data set before beginning to read the data. By default, no records are skipped.
For ASCII files a "record" refers to a single line in the file (i.e., a newline character). If the FORMAT statement contains slash characters the "data record" may be multiple lines; the /SKIP qualifier is independent of this fact.
For FORTRAN-structured binary files the /SKIP argument refers to the number of binary records to be skipped.
For unstructured (stream) binary files (e.g., output of a C program) the /SKIP argument refers to the number of words (8-byte quantities) to skip before reading begins.
For ASCII delimited files, /TYPE specifies the type of each variable to be read (see SET DATA/FORMAT=DELIMITED). For unstructured (stream) binary files (see SET DATA/FORMAT=STREAM), /TYPE specifies the data type of a set of variables in the file. For stream files, the available values and their corresponding types are:
yes? SET DATA/EZ/FORMAT=STREAM/TYPE=14,R4/VAR=V1,V2 foobar.dat
will read a file containing INTEGER*4 and REAL*4 numbers into the variables v1 and v2.
Names the variables of interest in the file. Default is v1.
yes? FILE/VARIABLES="var1,var2,..." file_name
Except in the case of /FORMAT=stream, Ferret assumes that successive values in the data file represent successive variables. For example, if there are three variables in a file, the first value represents the first variable, the second represents the second variable, the third the third variable, and the fourth returns to representing the first variable. The maximum number of variables allowed in a single free-formatted data set is 20. The "Delimited Read" option allows for 100 variables. See SET DATA/FORMAT=DELIMITED for reading from a delimited file.
Variable names may be 1 to 24 characters (letters, digits, $, and _) beginning with a letter. To indicate a column is not of interest use "-" for its name.
Example: (the third column of data will be ignored)
yes? SET DATA/VARIABLES="temp,salt,-,u,v" ocean_file.dat
Specifies the order (ORDER=permutation) in which axes are to be read. This qualifier does NOT work for delimited files (SET DATA/FORMAT=delimited). For netCDF files there are additional options for this qualifier; see SET DATA/FORMAT=CDF/ORDER.
yes? FILE/ORDER=XY sst ! X varies fastest yes? FILE/ORDER=YX sst ! Y varies fastest
The "permutation" string may be any permutation of the letters X, Y, Z, and T. If the /format=stream qualifier is used, the string may also contain V (for variable). This allows variables to be "interleaved."
Specifies the default context expression. When Ferret's "action" commands (PLOT, CONTOUR, SHADE, VECTOR, WIRE, etc.) are issued with no argument, the default context expression is used. This is the expression last used as argument to an action command, or it may be set explicitly with SET EXPRESSION. See the chapter "Variables and Expressions", section Expressions for a full list of action commands.
yes? SET EXPRESSION expr1 , expr2 , ...
1) yes? SET EXPRESSION temp
Sets the current expression to "temp".
2) yes? SET EXPRESSION u , v , u^2 + v^2
Set the current expressions to "u , v , u^2 + v^2"
When running Ferret in batch "gif" mode, starting Ferret with either ferret -gif or ferret -bacth filename.gif, a temporary file is created and the graphics information written to it. Beginning with Ferret v6.84, the command SET GIFFILE names this temporary file as directed. Then a FRAME command saves this file with the name given by SET GIFFILE, or the name given in the FRAME command. This is useful if running multiple Ferret sessions.
For instance, name the file with the session ID: (Try the command SHOW SYMBOLS on starting Ferret for more ideas).
ferret -gif yes? set giffile "/home/users/plotdirectory/image_($session_pid).gif" yes? [plot commands] yes? frame/file="/home/users/plotdirectory/image_`aa`.gif" ! Or, to leave the original name, just yes? frame
yes? SET GRID[/qualifier] [grid_or_variable_name]
yes? SET GRID sst[D=coads] yes? SET GRID ! use grid from last data accessed
See the chapter "Grids and Regions", section Grids.
Command qualifiers for SET GRID:
Restores the current default grid last saved by SET GRID/SAVE. Useful together with SET GRID/SAVE to create GO files that restore the state of Ferret when they conclude.
Saves the current default grid to be restored later. Useful together with SET GRID/RESTORE to create GO files that restore the state of Ferret when they conclude.
yes? use coads_climagoloty yes? set region/x=40e:110e/y=60s:20s/L=6 yes? go mp_stereographic_north yes? go mp_aspect yes? go mp_grid yes? shade/noaxes sst, x_page, y_page
/APPEND /FILE /FORMAT /HEADING /PRECISION/NCFORMAT/ENDIAN/DEFLATE/SHUFFLE/XCHUNK/YCHUNK/ZCHUNK/TCHUNK/ECHUNK/FCHUNK /OUTTYPE
Uses SET LIST to specify the default characteristics of listed output.
yes? SET LIST/qualifiers
Command qualifiers for SET LIST:
Specifies that by default the listed output is to be appended to a pre-existing file. Cancel this state with CANCEL LIST/APPEND.
Specifies a default file for the output of the LIST command.
yes? SET LIST/FILE=filename
The filename specified in this way is a default only. It will be used by the command
yes? LIST/FILE variable
but will be ignored in
yes? LIST/FILE=snoopy.dat variable
If the filename specified is "AUTO", or if no name is given at all, Ferret generates a filename based on the data set, variable, and region. The resulting name is often quite long but may be shortened by following "AUTO" with a minus sign and the name(s) of the axes to exclude from the filename.
Note: the region information is not used in automatic netCDF output filenames.
yes? SET LIST/FILE=AUTO yes? LIST/L=500/X=140W:110W/Y=2S:2N/FILE sst[D=coads]
Sends data to file WcoadsSST.X140W110WY2S2NL500.
yes? SET LIST/FILE=AUTO-XY yes? LIST/L=500/X=140W:110W/Y=2S:2N/FILE sst[D=coads]
Sends data to file WcoadsSST.L500.
yes? SET LIST/FORMAT=option yes? SET LIST/FORMAT !reactivate previous format
produces ASCII output
produces unformatted (binary) output
produces netCDF output
produces TMAP GT format
See also SET LIST/NCFORMAT which sets details of NetCDF-4 formatted files.
1) yes? SET LIST/FORMAT=(1X,12F6.1)
Specifies a FORTRAN format (without row or column headings).
2) yes? SET LIST/FORMAT=UNFORMATTED
Specifies binary output. (FORTRAN variable record length record structure.)
- When using GT format all variables named in a single LIST command will be put into a single GT-formatted timestep.
- Very limited error checking will be done on FORTRAN formats.
- FORTRAN formats are reused as necessary to output full record.
- Latitude axes are listed south to north when /FORMAT is specified.
Specifies that ASCII output is to be preceded by a heading that documents data set, variable, and region. Cancel the heading with CANCEL LIST/HEAD.
Sets the output data type for all variables written to netCDF files. The types may be DOUBLE, FLOAT, INT, SHORT, or BYTE. CANCEL LIST/OUTTYPE will restore the default netCDF write behavior. See the notes in the documentation of the SAVE command for details about output data types.
Specifies the data precision (number of significant digits) of the output listings. This qualifier has no effect when /FORMAT= is specified.
yes? SET LIST/PRECISION=#_of_digits
Note that this controls only the output precision of the data. (Prior to Ferret v6.8, in fact at most 7 digits are significant since Ferret calculations were performed in single precision.)
For writing NetCDF files, specifies that the output file will be of one of these output formats:
SET LIST/NCFORMAT=netcdf4 !write a NetCDF-4 formatted file, using HDF5 SET LIST/NCFORMAT=classic !write a Netcdf-4 Classic Model Formatted file, compatible with software that uses NetCDF-3. SET LIST/NCFORMAT=64BIT_OFFSET ! Writes the 64-bit offset format, a variation on the classic format
SET LIST/NCFORMAT=netcdf4 may be abbreveiated as SET LIST/NCFORMAT=4 and SET LIST/NCFORMAT=classic may be abbreviated as SET LIST/NCFORMAT=3.
The NetCDF documentation describes these formats:
In netCDF classic format, the problem of endianness is solved by writing all data in big-endian order. The HDF5 library allows data to be written as either big or little endian, and automatically reorders the data when it is read, if necessary.
By default, netCDF uses the native types on the machine which writes the data. Users may change the endianness of a variable (before any data are written). In that case the specified endian type will be used in HDF5 (for example, a H5T_STD_I16LE will be used for NC_SHORT, if little-endian has been specified for that variable.)
SET LIST/ENDIAN= big SET LIST/ENDIAN= little SET LIST/ENDIAN= native
The default setting is native.
Sets the level of HDF5 compression. DEFLATE=0 turns off compression, DEFLATE=1 sets a deflate level of 1. The setting may be between 0 and 9; however levels greater than 1 are not recommended by the HDF5 documentation. Specifying SET LIST/DEFLATE with no value turns on the compression and sets the level to 1. See the NetCDF and HDF5 documentation for details of HDF5 compression.
SET LIST/DEFLATE ! turns on compression SET LIST/DEFLATE=1 ! same as the above command SET LIST/DEFLATE=0 ! turns off compression
Settings for HDF5 shuffle 0=off/ 1=on. See the NetCDF and HDF5 documentation for details.
SET LIST/SHUFFLE ! Turns on HDF5 shuffle SET LIST/SHUFFLE=1 ! same as the above command SET LIST/SHUFFLE=0 ! turns off shuffle
Settings for HDF5 chunking.
yes? SET MEMORY/SIZE=megawords
The command SET MEMORY provides control over how much "physical" memory Ferret can use. (In reality the distinction between physical and virtual memory is invisible to Ferret. The SET MEMORY command merely dictates how much memory Ferret can attempt to allocate from the operating system.)
SET MEMORY controls only the size of Ferret's cache memory—memory used to hold intermediate results from computations that are in progress and used to hold the results of past file IO and computations for re-use. The default size of the memory Ferret will allocate is 25.6 megawords. This memory size can be set larger or smaller than this figure. We are allocating double-precision "words" so the same command allows you to load the same amount of data, but will request twice the memory from the operating system, and the default memory cache is 25.6×8= 204.8 megabytes.
See MEMORY USAGE in this users guide for further details on setting the memory size appropriately and on handling operations that are memory intensive.
yes? SET MEMORY/SIZE=100
Sets the maximum size of Ferret's memory cache to 100 million (8-byte) words. (Approximately 0.8 Gigabytes)
- As a practical matter memory size should not normally be set larger than the physical memory available on the system. Memory is allocated up to the limit given by the SIZE, as needed in the Ferret session. If Ferret is unable to allocate the requested memory, it will return an error message.
- The effect of SET MEMORY/SIZE= is identical to the "-memsize" qualifier on the Ferret startup command line.
- The effects of SET MEMORY/SIZE last only for the current Ferret session. Exiting Ferret and restarting will reset the memory cache to its default size.
- If memory is severely limited on a system Ferret's default memory cache size may be too large to permit execution. In this case use the "-memsize" qualifier on the command line to specify a smaller cache.
- To set the amount of memory every time you start Ferret, add a SET MEMORY/SIZE= command to your .ferret startup file
Specifies special operating modes or states for program Ferret.
yes? SET MODE[/LAST] mode_name[:argument]
imposes PPLUS ASCII font types on plot labels
uses date strings for T axis (vs. time step values)
uses "DEPTH" as Z axis label
attempts calculations too large for memory [has no effect, Ferret v7.2 and higher]
turns on internal program diagnostic output
sets drawing of graticule lines on all subsequent plots
continues command file after errors. On an error, the
automatically interpolates data between planes
records keyboard commands in a journal file
uses "N" "S" notation for labeling latitudes
reset number of line colors from the default of 6
uses "E" "W" notation for labeling longitudes
captures graphics in GKS metafiles (ignored by PyFerret)
reset default number of contour or color levels for contour, color fill or shade plots, default 30
controls whether NO VALID DATA is written across plots. Cancel to leave such plots blank.
listed output from PPLUS is directed to the named file
refreshes graphics on systems lacking "backing store"
utilizes GKS segment storage
controls cache hits in memory (diagnostic)
controls whether variable and axis names are upcased on output
displays each command file line as it is executed
waits for carriage return after each plot
Command qualifiers for SET MODE:
Resets mode to its last state.
yes? SET MODE/LAST mode_name
Example: (a command file that will not alter Ferret modes)
yes? CANCEL SYMBOL fer_last_error ! we will check for any errors in this block of code yes? SET MODE IGNORE_ERRORS ! 1st line of command file . !. ... code which may encounter errors . yes? SET MODE/LAST IGNORE_ERRORS ! last line of command file yes? ! After a block of code, see the last error encountered, if any yes? IF ($fer_last_error"0|*>1") THEN SHOW SYMBOL fer_last_error
The SET MODE ASCII_FONT command causes program Ferret to precede plot labels with the PPLUS font descriptor "@AS" (ASCII SIMPLEX font). This assures that special characters (e.g., underscores) are faithfully reproduced. For special plots it may be desirable to use other fonts (e.g., to obtain subscripts). CANCEL MODE ASCII_FONT is for these cases.
default state: set
This mode accepts an optional argument specifying the degree of precision for the output date. If the argument is omitted the precision is unchanged from its last value.
default state: set (argument: minutes)
SET MODE CALENDAR accepts the following arguments:
|AUTO||* see below|
The argument is uniquely identified by the first two characters.
The "auto" state, new in Ferret v7, will automatically choose an appropriate resolution depending on the time resolution of the time axis of the variable being plotted or listed.
yes? SET MODE CALENDAR:DAYS
Causes times to be displayed in the format dd-mmm-yyyy.
When CALENDAR mode is canceled the "equivalent" in the table above determines the precision of the time steps displayed exactly as in SET MODE LONGITUDE.
SET MODE DEPTH_LABEL causes Ferret to label Z coordinate information in the units of the Z axis. This affects both plotted and listed output. This mode accepts an optional argument specifying the degree of precision for the output. If the argument is omitted the precision is unchanged from its last value.
yes? SET MODE DEPTH:argument
default state: set (argument: -4)
See the example under "SET MODE LONG" for a detailed description of precision control.
As of Ferret v7.2, this command has been deprecated. The command no longer has any effect on the operation of Ferret. For use with earlier Ferret versions see this description.
SET MODE DIAGNOSTIC
SET MODE DIAGNOSTIC causes Ferret to display diagnostic information in real time about its internal functioning. It is intended to help Ferret developers diagnose performance problems by displaying what the Ferret memory management subsystem is doing. The message "strip gathering on xxx axis" indicates that Ferret has broken up a calculation into smaller pieces. Subsequent "strip" and "gathering" messages indicate that sub-regions of the calculations are being processed and brought together.
default state: canceled
See the FAQ, How do I interpret the output of "SET MODE DIAGNOSTIC? for help interpreting the output.
SET MODE FRUGAL
SET MODE FRUGAL:<size> changes the percentage of the memory reserve, provided to allow a degree of control of memory over Ferret’s memory managementas discussed in Understanding Ferret Memory Management Concepts and Tools. By default the argument of MODE FRUGAL is set at 30 (percent), indicating that 30% of vailable memory will be held in reserve when memory management actions are required to reduce large calculations into a number of smaller fragments. CANCEL MODE FRUGAL is equivalent to SET MODE FRUGAL 0. Comparing the following output to the session shown under SHOW MEMORY/DIAGNOSTIC illustrates MODE FRUGAL behavior. The fragment (chunk) size is reduced from 8 to 5 as the MODE FRUGAL argument is increased from 0 to 30 percent.
SET MODE GRATICULE
SET MODE GRATICULE turns on plotting of graticule lines at the tic marks of both the horizontal and vertical axes of all subsequent plots. In effect this is equivalent to specifying the GRATICULE qualifier for all plot commands. See documentation of the /GRATICULE qualifier with the various plot commands, for instance PLOT/GRATICULE. You may specify line types with SET MODE GRATICULE:(type) where type is color, dash, or thickness
yes? SET MODE GRATICULE yes? SET MODE GRATICULE:(color=red) yes? SET MODE GRATICULE:(dash,color=blue) yes? SET MODE GRAT:"LARGE(COLOR=blue),SMALL(COLOR=lightblue)"
Currently, dash types cannot be customized, as they can for PLOT/DASH. Look for this in a future release of Ferret.
SET MODE IGNORE_ERROR
SET MODE IGNORE_ERROR causes Ferret to continue execution of a command file despite errors encountered. When an error is encountered (regardless of the setting of this mode) a symbol FER_LAST_ERROR is set containing the text that is output to standard error. See an example using MODE IGNORE_ERROR.
default state: canceled
SET MODE INTERPOLATE
Note: The transformation @ITP provides the same functionality as MODE INTERPOLATE with a greater level of control.
SET MODE INTERPOLATE affects the interpretation of world coordinate specifiers (/X, /Y, /Z, /T, /E, /F) in cases where the position is normal to the plane in which the data is being examined. When this mode is SET and a world coordinate is specified which does not lie exactly on a grid point, Ferret automatically interpolates from the surrounding grid point values. When this mode is canceled, the same world coordinate specification is shifted to the grid point of the grid box that contained it before computations were made (see examples).
default state: canceled
If the grid underlying the variable temp has points defined at Z=5 and at Z=15 (with the grid box boundary at Z=10) and data is requested at Z=12 then
yes? SET MODE INTERPOLATE yes? LIST/T=18249/X=130W:125W/Y=0:3N/Z=12 temp
lists temperature data in the X-Y plane obtained by interpolating between the Z=5 and Z=15 planes. Whereas,
yes? CANCEL MODE INTERPOLATE yes? LIST/T=18249/X=130W:125W/Y=0:3N/Z=12 temp
lists the data at Z=15. The output documentation always reflects the true location used.
SET MODE LABELS
SET MODE LABELS restores the default behavior of labeling, if CANCEL MODE LABELS has been issued. CANCEL MODE LABELS implements the /NOLABELS qualifier for all plots after it has been set.
SET MODE LOGO
SET MODE LOGO turns on the Ferret logo (three lines at the upper right of plots), if it has been turned off by CANCEL MODE LOGO
SET MODE JOURNAL causes Ferret to record all commands issued in a journal file. Output echoed to this file may be turned on and off via mode JOURNAL at any time.
default state: set
yes? SET MODE JOURNAL:my_journal_file.jnl
The optional argument to MODE JOURNAL specifies the name of the output journal file—with no argument, the default name "ferret.jnl" is used. Journal files for successive Ferret sessions are handled by version number. See the chapter "Computing Environment", section "Output file naming".
SET MODE LATIT_LABEL causes Ferret to output latitude coordinate information in degrees N/S format (instead of the internal latitude coordinate). This affects both plotted and listed output.
This mode accepts an optional argument specifying the degree of precision for the output. If the argument is omitted the precision is unchanged from its last value.
yes? SET MODE LAT:2
default state: set (argument: 1)
See the example under "SET MODE LONG" for a detailed description of precision control.
SET MODE LONG_LABEL causes Ferret to output longitude coordinate information in degrees E/W format (instead of the internal longitude coordinate). This will affect both plotted and listed output.
This mode accepts an optional argument specifying the degree of precision for the output. If the argument is omitted the precision will be unchanged from its last value.
yes? SET MODE LONG:2
default state: set (argument: 1)
The argument of SET MODE LONG is an integer specifying the precision. If the argument is positive or zero it specifies the maximum number of decimal places to display. If the argument is negative it specifies the maximum number of significant digits to display.
Suppose the longitude to be displayed is 165.23W. Then
yes? SET MODE LONG:1 will produce 165.2W yes? SET MODE LONG:-3 will produce 165W
When LONG mode is canceled the argument still determines the output precision.
SET MODE LINECOLORS
SET MODE LINECOLORS allows for a new number of colors for plot lines to be set. The default is 6.
The new number of LINECOLORS will take effect on the next new plot window (or on the first window if no plots have been drawn yet in the session). If plots have already been drawn, Ferret will issue a NOTE indicating that the new number of colors will takes effect after the command SET WINDOW/NEW.
The first 6 colors are always defined. Further colors are initially grey; these colors as well as the first 6 may be redefined using the PPL COLOR command.
yes? SET MODE LINECOLORS:8 *** NOTE: New # of line colors will take effect on next new window: SET WIN/NEW then define pen colors yes? SET WINDOW/NEW yes? PPL COLOR,7,100,50,0 ! orange yes? PPL COLOR,8,60,0,100 ! purple
See the example in the chapter on Customizing Plots.
Note that once you have defined new colors, they can be used for axes, text, and graticule lines as well as for plotting lines of data.
Example: Here we use a seventh color, leaving it defined as gray. Use this color for graticule lines.
yes? SET MODE LINECOLORS:7 yes? USE etopo60 yes? FILL/GRATICULE=[DASH,COLOR=7,THICKNESS=1] rose
MODE LINECOLORS cannot be canceled; issuing the command CANCEL MODE LINECOLORS will reset the number back to 6.
In PyFerret, metafiles are not used. MODE METAFILE is ignored. If SET MODE METAFILE is issued, PyFerret will issue a NOTE and continue.
The optional argument to MODE METAFILE specifies the name of the output metafile—with no argument, the default name "metafile.plt" is used. Multiple output files (i.e., successive plots) are handled by version number. See the chapter "Computing Environment", section "Output file naming"
See the chapter "Computing Environment", section "Hard copy)" for details on generating graphics files and hard copy.
yes? SET MODE METAFILE:june_sst.plt
default state: canceled (default argument when set: "metafile.plt")
SET MODE NLEVELS
Sets the initial number of contour/color levels that will be used when computing automatic contour levels. Previously this value was always 10. If you are drawing just color plots without contour lines, 40 is a good value to use; if you often use contour lines or FILL/LINE, then a smaller number will look good.
yes? SET MODE NLEVELS 40 yes? SET MODE/LAST nlevels ! restores previous value
SET MODE NODATA_LAB
Sets or cancels the NO VALID LABEL that is placed on plots when all the data referenced by the plotting command is missing. Default is SET, so that this label DOES appear, in the middle of the plot for 2D plots, or as part of the labels at the bottom for line plots.
Sometimes it's convenient to plot all-missing data, as an underlay to set up plot axes. In this case, the NO VALID DATA label is not wanted. CANCEL MODE nodata_lab will remove that label.
yes? USE levitus_climatology yes? ! This plot has NO VALID DATA across the middle. yes? SHADE/K=1/X=50E:70E/Y=40:50/NOLAB temp yes? ! This plot is just blank. yes? CANCEL MODE nodata_lab yes? SHADE/K=1/X=50E:70E/Y=40:50/NOLAB temp
SET MODE PPLLIST
Directs listed output from PPLUS commands (e.g., PPL LIST LABS) to the specified file. This mode is useful for creating scripts that customize plots. The user can specify the name of the output file by giving it as an argument, otherwise file name "ppllist.out" is assigned.
yes? SET MODE PPLLIST:plot_symbols.txt yes? PPL LISTSYM yes? SPAWN grep "WIDTH" plot_symbols.txt
default state: canceled
SET MODE REFRESH
The SET MODE REFRESH command causes Ferret to update windows following "occlusion" events on X-servers that lack a backing store (SGI workstations have been a case in point).
default state: canceled (except on SGI systems)
SET MODE SEGMENTS causes Ferret to utilize GKS segments ("GKS" is the Graphical Kernel System—an international graphics standard). On some systems MODE SEGMENTS may be necessary to update windows following "occlusion" events or to resize window with the mouse.
Segments, however, make heavy demands on the system's virtual memory. If Ferret stops during graphics output due to insufficient virtual memory try CANCEL MODE SEGMENTS.
default state: set
SET MODE STUPID
Note: MODE STUPID is included for diagnostic purposes only.
SET MODE STUPID controls the ability of Ferret to reuse results left in memory from previous commands. It also affects its ability to reuse intermediate variables that are referenced multiple times during complex calculations. Given with no argument
yes? SET MODE STUPID
causes Ferret to forget data cached in memory. The result is that all requests for variables are read from disk and no intermediate calculations are reused. The program will be significantly slower as a result.
A lesser degree of cache limitation occurs with the command
yes? SET MODE STUPID: weak_cache
which causes Ferret to revert to the cache access strategy that it used previous to Ferret version 5.0. In this mode cache hits are unreliable unless the region of interest is fully specified. (Unspecified limits will typically default to the full range of the relevant axis.)
default state: canceled
SET MODE UPCASE_OUTPUT
By default Ferret changes variable and attribute names to uppercase form, and they are written in uppercase to netCDF files. In order to keep the original lowercase or mixed-case spelling of variable and attribute names when they are written to netCDF files, issue the command
yes? CANCEL MODE UPCASE_OUTPUT
and the original upper- or lower-case spellings to be used.
default state: SET
Beginning with Ferret v7, this MODE also applies to the output of SHOW commands, and the results of commands such as `var,RETURN=xaxis`, so that these outputs reflect what is in the dataset.
SET MODE VERIFY
SET MODE VERIFY causes commands from a command file ("GO file") to be displayed on the screen as they are executed. Note that if MODE VERIFY is canceled, loop counting in the REPEAT command is turned off.
default state: SET, argument "default"
Note: Many GO files begin with CANCEL MODE VERIFY to inhibit output and end with SET MODE/LAST VERIFY to restore the previous state. Only if an error or interrupt occurs during the execution of such a command file will the state of MODE VERIFY be affected.
SET MODE VERIFY can accept arguments to further refine control over command echoing.
yes? SET MODE VERIFY: DEFAULT
- This will be the default state if no argument is given
- Ferret echos commands taken from GO scripts
- Ferret echos commands in which symbol substitutions occur or in which embedded expressions are evaluated
yes? SET MODE VERIFY: ALL
- In addition to the cases above Ferret also displays the individual commands that are generated by repeat loops and semicolon-separated command groups
- Ferret displays a REPEAT loop counter ("!-> REPEAT: ...")
yes? SET MODE VERIFY: ALWAYS
- Echoing behavior is the same as argument ALL but ALWAYS, in addition, causes CANCEL MODE VERIFY to be ignored when it is encountered in a GO file. This functionality is useful when debugging GO scripts. Entering CANCEL MODE VERIFY or SET MODE VERIFY:DEFAULT from the command line will cancel this state.
SET MODE WAIT
SET MODE WAIT causes Ferret to wait for a keyboard keystroke from the user after each plotted output is completed. This is useful on graphics terminals that do not have a separate graphics plane; on these terminals SET MODE WAIT prevents the graphical output from being wiped off the screen until the user is ready to proceed.
default state: canceled
SET MODE 6D_LAB
(Ferret v6.8 and higher.) SET MODE 6D_LAB causes Ferret to show all 6 dimensions in the output of SHOW DATA, SHOW GRID, STATISTICS, and in diagnostic output. To see only the four dimensions X,Y,Z,T issue a "CANCEL MODE 6D_LAB" command. This setting affects only the output listed from these commands; 6D grids may be used when the mode is canceled.
default state: set
/COMPRESS /FILE /LASER /START
Note: HDF movies were discontinued with Ferret v6.6. The HDF-5 library used by NetCDF-4 does not contain the call that was used to make these movies. See the documentation in chapter 5 Note on using whirlgif to make a movie about creating animations from a set of gif images.
Changes the chunk cache settings from the defaults. (Ferret v6.6 and higher) The options are:
/SIZE= new size in mb
/NELEMS see the netcdf4 documentation
/PREEPMT see the netcdf4 documentation
See the NetCDF documentation for details about these settings.
Allows messages and data listings normally printed to the console to be written to a file. The options are:
/TEE write the messages to file as well as to the console
/JOURNAL write the messages to the journal (prefixed with '! ')
/FILE= write the messages to the file named by this option
/APPEND append to the above file if it exists
/CLOBBER overwrite the above file if it exists
The additional arguments STDOUT and/or STDERR can be given to indicate which information is redirected (or no longer redirected). If STDOUT is given, informational messages and data listings will be redirected. If STDERR is given, error and warning messages will be redirected. If neither is given, STDOUT will be assumed.
Beginning with Ferret v6.9, whenever SET REDIRECT has been issued, Ferret writes extra lines to the output file(s) specified in the redirection. These lines show the GO calls made, and where the session exits every GO script. Run Unix command line tool FshowGO on this file to show the nested calls to scripts in that session, together with any script arguments. The GO lines shown are the scripts and arguments exactly as they were run by the Ferret session.
- Using the /JOURNAL /TEE options will record messages and data listings in the journal file while still being written to the console.
- Under Linux, unwanted output (such as known warnings) can be eliminated by using the option /FILE="/dev/null"
- The STDOUT and STDERR redirects can go to different files by using two SET REDIRECT commands.
- Information written to a file may not be visible until that file is closed by Ferret. Use CANCEL REDIRECT to close a redirect file without shutting down Ferret.
Send all of the output to a file, and to the console.
yes? SET REDIRECT/TEE/CLOBBER/file=log.txt yes? GO my_script yes? CANCEL REDIRECT
Keep any errors or warnings in a file and show them on the console, otherwise operate silently.
yes? SET REDIRECT/TEE/CLOBBER/FILE=errors.txt STDERR yes? SET REDIRECT/CLOBBER/FILE="/dev/null" STDOUT yes? go my_script ! Now see all commands at the console, but continue sending errors also to errors.txt yes? CANCEL REDIRECT STDOUT
When SET REDIRECT is turned on, lines are added to the output file that are used by FshowGO to trace all of the calls made in scripts
yes? set redirect/file=demo_out.txt yes? go mp_stereo_demo yes? quit
Use the Unix command FshowGO to see all of the calls that this demo made, including the arguments to the scripts.
> > FshowGO demo_out.txt GO mp_stereo_demo GO mp_stereographic_north 320 45 GO mp_aspect GO mp_land GO mp_polymark pOLY/OVER/NOLAB/NOAXES/NOKEY/PALETTE=black xlon, ylat, , square, 0.3 GO polymark pOLY/OVER/NOLAB/NOAXES/NOKEY/PALETTE=black x_page*mp_mask y_page*mp_mask 0 square 0.3 GO polyshape square GO mp_graticule 280 360 10 10 80 10 GO mp_label 280 8 0 -40 0.12 "@CR280" GO mp_label 290 8 0 -30 0.12 "@CR290" ... GO mp_label 260 70 1 0 0.14 "@CRETOPO Topography" GO mp_label mid_lon 5 0 0 .18 "@CRObservation Sites"
/I/J/K/L/M/N /X/Y/Z/T/E/F /DI/DJ/DK/DL/DM/DN /DX/DY/DZ/DT/DE/DF
yes? SET REGION[/qualifiers] [ reg_name]
See the chapter "Grids and Regions", section Regions for further information.
1) yes? SET REGION/X=140E
Sets X axis position in the default context.
2) yes? SET REGION/@N !N specifies X and Y but not Z or T
Sets only X and Y in the default context (since X and Y are defined in region N but Z and T are not).
3) yes? SET REGION N
Sets ALL AXES in the default region to be exactly the same as region N. Since Z and T are undefined in region N they will be set undefined in the default context.
4) yes? SET REGION/@N/Z=50:250
Sets X and Y in the default region to be exactly the same as region N and then sets Z to the range 50 to 250.
5) yes? SET REGION/DZ=-5
Set the region along the Z axis to be 5 units less than its current value.
6) yes? SET REGION/DJ=-10:10
Increases the current vertical axis range by 10 units on either end of the axis.
Command qualifiers for SET REGION:
Modifies current region information by the specified increment of an axis subscript (I, J, K, L, M, or N) or axis coordinate (X, Y, Z, T, E, or F). See examples above. Syntax: /D*=val, or /D*=lo:hi.
SET TEXT/FONT= /COLOR= /ISIZ= /ITALIC /BOLD [text-group name]
Set the text style for labels on plots. Text settings may be made for all text at once, or using text-group names to specify a particular style for a set of lables, e.g. the tic-mark labels on axes, the main title, the colorbar labels. See also SHOW TEXT and CANCEL TEXT. Text settings persist in the PyFerret session. Once labels have been drawn as part of a plot, the text style for those labels is not changed by further SET TEXT settings. Any new labels drawn after a call to SET TEXT will be drawn with that style.
In PyFerret, the SET TEXT/FONT= option is used to name a font. The fonts available are those available to the Python packages. The HERSHEY font which draws letters exactly as is done in Ferret, is currently the default.
yes? set text/font=arial
SET TEXT/COLOR= makes a color setting. The argument may be a Ferret color setting, or the form (R,G,B) or (R,G,B,A).
yes? set text/font=arial/color=(20,50,70) ! or, yes? set text/font=courier/color=blue
For contour plots, the text on the contour lines themselves will be the same color as the contour lines themselves unless a setting is made on the sub-group for CONTOUR labels, see below.
The SET TEXT/BOLD option sets the text to bold style, if it is available in the currently chosen font.
The following text groups are defined for SET TEXT. When a text group name is given on the SET TEXT command, the settings are applied only to that text grouping. If there is no argument, the settings are applied to all text. When using text groupings, any global text settings persist until changed with another SET TEXT command or with CANCEL TEXT.
|HTICS||tic mark labels on horizontal axis|
|VTICS||tic mark labels on vertical axis|
|HLAB||horizontal axis label|
|VLAB||vertical axis label|
|MOVEABLE||moveable (user added) labels|
Make a global font setting, and a customization for the colorbar labels. The labels will all be in the same font, Times. In addition the color key labels are smaller and italic.
! The labels will all be in the same font, Times. In addition the color key labels are smaller and italic. yes? set text/font=times yes? set text/italic/isiz=-2 CBAR yes? shade/key=horizontal my_var yes? cancel text ! restores defaults
Large labels look good with the PyFerret fonts. Choosing a style for the moveable labels (added with the LABEL or ANNOTATE commands).
yes? set text/font=arial yes? fill sst yes? set text/italic/bold moveable yes? annotate/norm/xpos=0.5/ypos=0.5/halign=0/siz=0.2 "COADS January Temperature"
Control over contour label text helps them stand out. Note that without a SET TEXT/COLOR= setting for the contour text-group, the contour labels always match the color of the contour lines.
yes? use levitus_climatology yes? set text/font=arial yes? set text/color=(100,20,0) contour yes? contour/z=0/nolab temp
Using PyFerret, we have access to special characters including Math symbols, Greek and other non-Latin alphabets, and International symbols such as the Euro sign, by means of HTML character syntax, e.g. see references such as
The following title specifications both put a lowercase letter tau into the title as shown below.
yes? set text/font=arial ! we must use a font other than the Hershey font yes? plot/title="stress <#964>-x" tau ! or, yes? plot/title="stress <&tau>-x" tau
The syntax is either <#nnnn> where the number is up to four digits as listed in the HTML character tables, or <&name> if a name is assigned. When the character is a Greek letter, capitalizing the name will result in a capital letter.
yes? set text/font=arial yes? shade/title="Delta <&Delta> and chi <&chi>" myvar yes? let/units="<°>C"/title=`"temp,return=title"` plotvar = temp yes? plot/z=40 plotvar yes? ! Now make a blue Diamond symbol at a location. yes? set text/color=blue yes? annotate/user/x=0/y=50/siz=0.2/halign=0/valign=0 "<&diams>"
- NOTE: Care should be taken when defining attributes for variables. In the example
yes? let/units="<°>C"/title=`"temp,return=title`" plotvar = temp yes? plot/z=40 plotvar
we define a variable for plotting with the units string containing a degree sign. However saving a variable to a netCDF file with units of "<°>C" is non-standard.
The following tables list all of the names recognized by PyFerret, along with the corresponding numerical codes. See the references sited above for examples of the symbols, or try them in PyFerret: (At this time, these are not all tested. Some may interact with Ferret/PyFerret causing spurious warnings or other unexpected behavior.)
Math and Symbols
Markup-significant and Internationalization
PyFerret: subscripts and superscripts in labels
In PyFerret, when using pyFerret fonts, the tags <sub> </sub> enclosing text in a label will make that portion of the text a subscript; likewise <sup> </sup> will make the enclosed text a superscript.
yes? plot/title="m<sup>2</sup>" area
Note: care should be taken when defining variables. Saving a variable to a netCDF file with units of "m<sup>2</sup>" is non-standard.
/BAD /GRID /TITLE /UNITS /DATASET /NAME /OFFSET /SCALE /OUTTYPE
Modifies characteristics of a variable defined by DEFINE VARIABLE or SET DATA/EZ. This command permits variables within a single EZ data set to be defined on different grids and it allows the titles and units to be superseded for the duration of a session, only, on netCDF and GT data sets.
yes? SET VARIABLE/qualifiers variable_name
The variable name can be a simple name or a name qualified by a data set.
yes? SET VAR/UNITS="CM" WIDTH[D=snoopy]
Command qualifiers for SET VARIABLE:
Designates a value to be used as the missing data flag. The qualifier is applicable to EZ data set variables and to netCDF data sets. The bad value which is specified will be used in subsequent outputs and calculations involving this variable. It applies only for the duration of the current Ferret session. It does not alter the data files. It is not applicable to variables defined with DEFINE VARIABLE.
For netCDF files only, if the file contains Fortran NaN (not a number), the user may designate NaN as the bad value flag for a given variable in a netCDF dataset. SET VARIABLE/BAD=NAN.
When the command SET VARIABLE/BAD= is be used to set one of the two missing value flags of a file variable, the bad value which is specified will be used in subsequent outputs and calculations involving this variable.
Ferret is aware of up to two missing value flags for each variable in a netCDF file. Under most circumstances, netCDF file variables use only a single flag. With a command like
SET VARIABLE/BAD=-999 my_file_var
you can specify -999 as an additional missing value flag. It is this value which will be present in all subsequent SAVEs to files and calculations.
Note that if the netCDF file contains two distinct flag values specified by the netCDF attributes "missing_value" and "_FillValue", then this command will migrate the value specified by missing_value to the position previously occupied by _FillValue and replace the one specified by missing_value. Thus a double usage of this command allows you to control both flags. You can use the command "SHOW DATA/VARIABLES" to see both bad value flags.
Sets the defining grid for a variable in an EZ data set. The argument may be an expression.
yes? SET VARIABLE/GRID=my_grid width[D=snoopy]
This is the mechanism by which the shape of the data (1D along T axis, 2D in the XY plane, etc.) is specified. By default Ferret will use grid EZ, a line of up to 20480 points oriented along the X axis. The qualifier is not applicable to variables defined with DEFINE VARIABLE.
This is effectively a RENAME command -- applies to all classes of variables (but not pseudo-variables). Useful for renaming variables whose names are incorrect, or not meaningful; or if we want to define a new variable but name it using an existing variable name (see Example 2 below). A common application of this is in creating output netCDF files in which contain modified versions of variables from input files.
yes? SET VARIABLE/NAME=new old
Give more useful names to a variable in a dataset. This changes the names for the variables that Ferret stored when it initialized the dataset. (In this example, we would probably also want to use SET VAR/UNITS and SET VAR/TITLE to set those attributes for the variables.)
yes? SHOW DATA currently SET data sets: 1> http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/fake_data.nc (default) name title I J K L M N V1 V1 1:180 1:90 ... 1:12 ... ... V2 V2 1:180 1:90 ... 1:12 ... ... yes? SET VARIABLE/NAME=north_vel V1[d=1] yes? SET VARIABLE/NAME=east_vel V2[d=1] yes? SHOW DATA currently SET data sets: 1> http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/fake_data.nc (default) name title I J K L M N NORTH_VEL V1 1:180 1:90 ... 1:12 ... ... EAST_VEL V2 1:180 1:90 ... 1:12 ... ...
Sometimes we want to define a new variable but use an existing variable name. Say there is a variable "temp" in the dataset and a mask to apply to it, showing where the data is to be treated as valid and invalid. Every time we use "temp" we'll want to apply the mask. To define a masked temperature, we could say "LET masked_TEMP = " but because we want to always use the masked variable, it would be nice if the new variable were named "temp" instead. So, rename the file variable and define a new variable with the name we want to use.
yes? USE temp_dat yes? SHOW DATA currently SET data sets: 1> ./temp_dat.nc (default) name title I J K L M N TEMP TEMPERATURE 1:360 1:180 1:20 ... ... ... MASK 1:360 1:180 ... ... ... ... ! We want the masked variable to be named TEMP. So re-name the file variable to something else. yes? SET VARIABLE/NAME=temp_in temp[d=1] ! Define the masked TEMP variable. Use SET VAR/UNITS and /TITLE to keep these attributes from the file variable. yes? LET/D=1 temp = IF mask EQ 1 THEN temp_in yes? SET VAR/UNITS="`temp_in,RETURN=units`"/TITLE="`temp_in,RETURN=title`" temp yes? SHOW DATA currently SET data sets: 1> ./temp_dat.nc (default) name title I J K L M N TEMP_IN TEMPERATURE 1:360 1:180 1:20 ... ... ... MASK 1:360 1:180 ... ... ... ... ------------------------------ TEMP[D=temp_dat] = IF MASK EQ 1 THEN TEMP_IN yes? SHADE/K=1 temp
Associates a title with the variable. This title appears on plotted outputs and listings. The qualifier is applicable to all variables.
yes? SET VARIABLE/TITLE="title string" var_name
yes? SET VARIABLE/UNITS="units string" var_name
For variables in netCDF files only, set an offset which will always be applied when the data is read from the file. This offset is applied after any offset factor specified by an attribute in the file. For applying a scale and offset to data when writing data to a netCDF file see writing packed data to a netCDF file
An application of this is when we want to use a variable to define an axis, but the variations in the data aren't well represented by a single precision variable. This is described in the section on DEFINE AXIS/FROM_DATA.
For variables in netCDF files only, set a scale factor which will always be applied when the data is read from the file. This factor is applied after any scale factor specified by an attribute in the file. See also SET VARIABLE/OFFSET, above.
When a scale factor and offset are specified, the scale factor is applied first:
var = scale*var_in + offset
If scale and offset values have been set, with either netCDF attributes or with a SET VARIABLE/SCALE=/OFFSET=, they may be accessed with the RETURN= keyword.
yes? USE coads_climatology yes? SAY `sst,RETURN=nc_scale` !-> MESSAGE/CONTINUE 1 1 yes? SAY `sst,RETURN=nc_offset` !-> MESSAGE/CONTINUE 0 0 yes? SET VAR/SCALE=10/OFF=50 sst yes? SAY `sst,RETURN=user_off` !-> MESSAGE/CONTINUE 50 50 yes? SAY `sst,RETURN=user_scale` !-> MESSAGE/CONTINUE 10 10
We can control the data type of variables written to output netCDF files, with SET VAR/OUTTYPE=. The netCDF library is used to convert the data type of a Ferret FLOAT value to the requested output type. The types allowed are DOUBLE, FLOAT, INT, SHORT, and BYTE, or use SET VAR/OUTTYPE=INPUT to preserve the type the data had on input. To write integers, for instance,
yes? SET DATA etopo60 yes? SET VAR/OUTTYPE=int4 rose yes? SAVE/X=180/FILE=r_int.nc rose LISTing to file a.nc *** NOTE: Converting data type of missing_value NC_FLOAT to match output type of variable NC_INT ** netCDF error: data in attribute missing_value not representable in output type NC_INT
Here, the missing_value of the variable cannot be represented as an integer, and the variable was not written. Correct for this by assigning a new missing_value to the variable before writing:
yes? SET DATA etopo60 yes? SET VAR/OUTTYPE=int4/BAD=200000 rose yes? SAVE/X=180/FILE=r_int.nc rose LISTing to file a.nc *** NOTE: Converting data type of missing_value NC_FLOAT to match output type of variable NC_INT
Note that not all data can be represented in all types. Also note that prior to Ferret v6.8, when data is written to DOUBLE (or any other type for that matter), it is always converted from the Ferret internal representation of single precision FLOAT data: Even if the original data was double precision, when it is read from the netCDF file it is always converted to single precision.
Sets the rectangular region within the output window where output will be drawn.
yes? SET VIEWPORT 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.
Pre-defined viewports exist for dividing the window into four quadrants and for dividing the window in half horizontally and vertically. See the chapter "Customizing Plots", section 6.7, Pre-defined Viewports, for a list.
/ASPECT /CLEAR /LOCATION /NEW /SIZE /TITLE
Additional PyFerret-only qualifiers for SET WINDOW:
/ANTIALIAS /NOANTIALIAS /COLOR /OPACITY /THICKEN /TEXTPROM /OUTLINE /XINCHES /YINCHES /XPIXELS /YPIXES /QUALITY /ENGINE
Creates, resizes, reshapes or moves graphics output windows.
yes? SET WINDOW[/qualifiers] [window_number]
Note: Multiple windows may be simultaneously viewable but only a single window receives output at any time.
1) yes? SET WINDOW/NEW
Creates a new output window and sends subsequent graphics to it.
2) yes? SET WINDOW 3
Sends subsequent graphics to window 3.
3) yes? SET WINDOW/SIZE=.5
Resizes current window to ½ of full.
4) yes? SET WINDOW/ASPECT=.5
Reshapes current window with Y/X equal to 1:2. The effect of this command is not seen until a plot is sent to the window.
5) yes? SET WINDOW/LOCATION=0,.5
Puts the lower left corner of the current window at the left border of the display and half way up it.
6) yes? SET WINDOW/TITLE="new title"
On the next new window, changes the title in the top bar.
Command qualifiers for SET WINDOW:
See the discussion below for PyFerret-only settings for /ASPECT combined with window size settings in inches or pixels.
1) yes? SET WINDOW/ASPECT=y_over_x n
Sets the overall aspect ratio of window n.
2) yes? SET WINDOW/ASPECT=y_over_x
Sets the overall aspect ratio of the current window.
3) yes? SET WINDOW/ASPECT=y_over_x:AXIS
Sets the axis length aspect ratio of the current window.
The total size (area) of the output window is not changed.
The default value for the overall window ratio is y/x = 8.8/10.2 ~ 0.86.
The default value for the axis length ratio is y/x = 6/8 = 0.75.
Use PPLUS/RESET or SET WINDOW/ASPECT=.75:AXIS to restore defaults.
The aspect ratio specified is a default for future SET WINDOW commands
The origin (lower left) is restored to its default values: 1.2, 1.4
When using "SET WINDOW n" to return to a previous window that differs from the current window in aspect ratio, it is necessary to re-specify its aspect ratio with /ASPECT, otherwise PPLUS will not be properly reset. If you return to a previous window, you cannot expect to make an overlay on the plot that is there. The PPLUS settings for axis lengths and other properties of the plot will have been overwritten.
Sets the location for the lower left corner of named (or current) window. The coordinates x and y must be values between 0 and 1 and refer to distances from the lower left corner of the display screen (total length and width of which are each 1).
yes? SET WINDOW/LOCATION=x,y [window_number]
yes? SET WINDOW/NEW
Resizes a window to r times the area of the standard window. (The length of the sides changes by the square root of r.) If the window number is omitted the command will resize the currently active window. (The default window size is 0.7.)
yes? SET WINDOW/SIZE=r [window_number]
Prior to Ferret v6.8, the actual size of the window is reset to fit on the output device.
Starting with Ferret v6.8, the size is not limited. This allows creation of large gif images; setting the size of a gif image is described in the FAQ, controlling the size of GIF output. In standard x-windows mode, the window is no longer limited by the size of the monitor window, so the image may extend outside your viewing area, and in some instances Ferret may crash. In batch postscript mode, and when using metafiles, setting the size of the window has no effect.
SET WINDOW/TITLE[=title text]
On the next new window, changes the title in the top bar. By default this title is FERRET_n_date:time, where n is the window number, and the date and time are for the Ferret session (see the symbols SESSION_DATE and SESSION_TIME). The title is saved in the symbol WIN_TITLE.
! After drawing a plot, the title at the top of the window is of the form ! FERRET_1_8-Aug-08:13:07 yes? PLOT/I=1:5 i yes? SHOW SYMBOL win_title WIN_TITLE = "8-Aug-08:13:07" yes? SET WINDOW/NEW/SIZE=0.3/TITLE="small window" yes? SHOW SYMBOL win_title WIN_TITLE = "small_window"
The title at the top of the window will be FERRET_2_small_window.
PyFerret Only qualifiers for SET WINDOW:
Assigns whether lines are draw with or without anti-aliasing. The default is to use anti-aliasing, which results in lines that appear smoother in raster (such as PNG and JPEG) images. Rarely will one want to turn off anti-aliasing. Only one of these options can be given.
Assigns the color of the background of the window as well as images saved from this window. The color may be specified as a color name or color number as in Ferret; or with an (R,G,B) or (R,G,B,A) value. The values of R, G, B, and A go from zero to 100 and are the percent of red, green, blue, and opacity (alpha channel) for the color.
Opacity is a value between 0 and 100. The opacity of the background color is also used when saving images in formats, such as PNG, that support opactity (the alpha channel). The /TRANSPARENT option to the FRAME command in PyFerret is equivalent to temporarily setting SET WINDOW /OPACITY=0 for just the image being saved by that FRAME command.
Assigns the line thickness scaling factor for the window. Any line thicknesses, even those explicitly specified, are scaled by this factor before being drawn. This allows one to modify the thickness of all lines in a plot to suit ones needs. This value will need to be modified if one significantly changes the actual size of the plot window using the /XINCHES= /YINCHES= PyFerret options to the SET WINDOW command.
When drawing color-filled rectangles and other polygons, this option allows one to specify the thickness of a outline to be drawn around each polygon. The color of the outline will be the same as the fill color. The main purpose of this option is to provide a work-around fix to some PostScript and PDF viewers that show thin white lines in FILL and SHADE plots. Typically only a very small value (0.05) is needed for this fix. If a value of zero is given, these outlines will not be drawn. The default behavior is to not draw these outlines.
Assigns the scaling factor for all text in the window. All text sizes, even those explicitly specified, are scaled by this factor before being drawn. This allows one to modify the size of all text in a plot to suit ones needs. Rarely will this option be need as text is automatically adjusted for the window "inch" size.
/XINCHES= /YINCHES= /ASPECT=
Assigns the default pixels size of the working plot being shown. Using these options is preferred over the use of the /SIZE option. These options scale the displayed plot to the indicated size but do not affect the actual "inch" size of the working plot. Normally these options are used when one wants to see how a raster image of the given size and aspect ratio will look when saved. Only two the these three options can be given. If you only want specify the pixel size of a saved image, use the /XPIXELS /YPIXELS PyFerret options to the FRAME commands.
/XPIXELS= /YPIXES= /ASPECT=
Assigns the actual "inch" size of the working plot being shown. This should only be used by advanced users that want to have an known plot "inch" size when creating the plot, such as for explicit placement of labels relative to the edges of the window. (See the ANNOTATE command for a flexible method for putting labels onto a plot.) Only two the these three options can be given. If you only want specify the inch size of a saved image, use the /XINCHES /YINCHES PyFerret options to the FRAME commands.
Set the quality of the plot. The default, /QUALITY=HIGH should almost always be used. The other option is /QUALITY=DRAFT which can be useful for on-the-fly animations, or may give quicker displayed but lower quality plots when displaying plots remotely over a slow connection.
Set the graphics engine to perform the plotting. This should only be used by very advanced users, or programmers wishing to develop their own PyFerret graphics engine. All standard options are available to the usual users through other commands. Currently the only options are /ENGINE=Cairo (almost equivalent to using the PyFerret -nodisplay command-line option), /ENGINE=PipedViewerPQ (equivalent to SET WINDOW /QUALITY=HIGH), and /ENGINE=PipedImage (equivalent to SET WINDOW /QUALITY=DRAFT). There is one scenario that a normal Ferret user might use this option: if one did not specify -nodisplay on the PyFerret command line but then wants to create and save a plot without displaying it and without restarting PyFerret, one can do this with the /ENGINE=Cairo option to SET WINDOW.