There are a few symbols, generated automatically by drawing plots or at Ferret run-time. Those are shown like all symbols by SHOW SYMBOLS, and their values can be used in scripts, but they cannot be directly redefined by the user. These are listed here.
In addition PPLUS defines a number of global symbols which are available to the user. They are documented in the chapter "Customizing Plots", section PPLUS special symbols and also listed in the PPLUS Users Guide.
the number of pixels in the horizontal (X) and vertical (Y) size of the current Ferret output window. Note: these are "0" if there is no current window -- hence they can be used as a test of whether there is an open window.
gives "BIG" or "LITTLE" according to endianness of the CPU
To write scripts that run under both Ferret and PyFerret, syntax that is valid only under one or the other programs can be chosen with, for example,
IF ($program_name"0|PyFerret>1|*>0") THEN SET TEXT/FONT=arial ELSE SET MODE META ENDIf ... Ferret script commands IF ($program_name"0|PyFerret>1|*>0") THEN FRAME/FILE=my_output.pdf ELSE CANCEL MODE META ENDIF
The symbol PEAK_MEMORY contains the peak amount of “essential” memory that has been required since the last time this symbol was zeroed by SET MEMORY/SIZE=<size> or CANCEL MEMORY. See more detailed discussion under Understanding Ferret Memory Management Concepts and Tools.
yes? spawn ls myfile.dat yes? IF ($spawn_ok) THEN GO list_data ELSE GO create_file
Clock and timing symbols:
gives the elapsed time in seconds since the start of the Ferret session. This is done via a call to the intrinsic function SYSTEM_CLOCK and therefore its results may be system dependent. See examples below
When it is evaluated, this calls the intrinsic function Dtime and sets the value to the delta-CPU-time since the last evaluation of this symbol (with SHOW SYMBOL, or with an evaluation of ($DELTA_CPU) ). It is called and set to zero Ferret initializes, so the first evaluation gets delta-cpu time since the start of the Ferret session. See examples below
>ferret NOAA/PMEL TMAP FERRET v6.2 Linux(g77) 2.4.21-32 - 05/06/09 14-May-09 15:44 yes? show symbols ! several symbols are set at startup. ... FERRET_VERSION = "6.2" FERRET_PLATFORM = "Linux(g77) 2.4.21-32" SESSION_DATE = "14-May-09" SESSION_TIME = "15:44" DELTA_CPU = "0.01" CLOCK_SECS = "2.62" CURRENT_DATE = "14-May-09" CURRENT_TIME = "15:52:17" FERRET_MEMORY = "25.6" yes? USE mydata.nc yes? SHADE/K=1 temp[L=@ave] yes? SHOW SYM DELTA_CPU, CLOCK_SECS DELTA_CPU = "0.18" CLOCK_SECS = "2.89" yes? REPEAT/K=1:10 shade temp[L=@ave] ! DELTA_CPU since the evaluation just above on the SHOW SYM. yes? LET time_ten_plots = ($DELTA_CPU) !-> DEFINE VARIABLE time_ten_plots = 0.88 ! This command evaluates the CPU time since the last ! evaluation, which was just above. yes? sh sym DELTA_CPU DELTA_CPU = "0" ! To get elapsed time for a particular piece of calculation, ! set a variable or symbol containing one evaluation of CLOCK_SECS ! and subtract that from a later evaluation of CLOCK_SECS. yes? let secs_0 = ($clock_secs) yes? repeat/k=1:10 (shade/pal=rnb2 temp[L=@max]) yes? let elapsed_clock_time = `($clock_secs) - secs_0` ! SESSION_DATE and SESSION_TIME are fixed for the entire session, ! CURRENT_DATE and CURRENT_TIME update when they are evaluated. yes? SH SYM session_date, current_date, session_time, current_time SESSION_DATE = "14-May-09" SESSION_TIME = "15:52" CURRENT_DATE = "14-May-09" CURRENT_DATE = "15:52:20"