Bin Guan's GrADS Script Library Version 2014.06
Copyright (c) 2004-2014, Bin Guan

Fully compatible with GrADS Version 2.1.a1 for Linux.

Analysis
Graphics
I/O
Ancillary
astudt.gs
ltrend.gs rms.gs yrmask.gs new colorbar.gs legend.gs vector.gs ppp.gs parsestr.gsf
deseason.gs
monmask.gs
studt.gs
drawbox.gs plot.gs
save.gs qdims.gsf
fcorr.gs
norm.gs tave.gs
drawline.gs shadcon.gs


hist.gs
one2one.gs taylor_calc.gs
drawmark.gs subplot.gs


lanczos.gs
rmean.gs tlag.gs

drawstr.gs taylor.gs



Script
Description and Usage (Notation: <>: required arguments; [<>]: optional arguments.)
Download All
astudt.gs
  Two-tailed Student t-test.

  Usage: astudt <dof> <p> [<t>]
     <dof>: degree of freedom.
     <p>: probability.
     <t>: t-statistic. Default=astudtout.

  Dependencies: studt.gs
colorbar.gs
  Draw a color bar.

  Usage: colorbar [left|right|bottom|top[<offset>] [<scalefactor>]]
         <offset>: offset to default location.
         <scalefactor>: scale factor. Default=1.

  Example 1: colorbar right+0.2
             Place the color bar to the right of the panel and shift to the right by 0.2 from the default location.

  Example 2: colorbar bottom-0.3 0.9
             Place the color bar below the panel, shift downward by 0.3 from the default location, and re-size by a factor of 0.9.
deseason.gs
  Calculate climatological seasonal cycle and anomalies.

  USAGE 1: deseason -v <var1> [<var2>...] [-a <anom1> [<anom2>...]] [-l <limit_start> <limit_end>] [-n <num_Fourier>] [-u <undef>] [-o <file>] [-p <path>]
  USAGE 2: deseason -v <var1> [<var2>...] -c <clim1> [<clim2>...] [-l <limit_start> <limit_end>] [-n <num_Fourier>] [-u <undef>] [-o <file>] [-p <path>]
    <var>: input field. Can be any GrADS expression.
    <anom>: anomaly. Default=<var>.
    <clim>: climatology.
    <limit_start> <limit_end>: climatology is calculated using data over the period of <limit_start> to <limit_end> only. Specified in world coordinate, such as MMMYYYY.
    <num_Fourier>: if unset, climatology is defined as long-term mean seasonal cycle; if set, climatology is further smoothed using first <num_Fourier> Fourier harmonics
                   (i.e., annual, biannual, triannual, etc.) plus mean. (Smoothing is recommended if the number of years is not sufficiently large.)
    <undef>: undef value for .dat and .ctl. Value from default file is used if unset.
    <file>: common name for output .dat and .ctl files. If set, no variable is defined, only file output.
    <path>: path to output files. Do NOT include trailing "/". Current path is used if unset.

  NOTE: regular and 365-day calendars are supported and automatically handled. For regular calendar, a repeating 365.2425-day climatology is defined and linearly
  interpolated to calendar days when needed.

  EXAMPLE 1: calculate SST climatology and save to variable "sstclim" (no file output).
    deseason -v sst -c sstclim

  EXAMPLE 2: as example 1 except save to files "sstclim.ctl" and "sstclim.dat" (no variable is defined).
    deseason -v sst -c sstclim -o sstclim

  EXAMPLE 3: as example 1 except climatology is further smoothed using first 4 Fourier harmonics (i.e., annual, biannual, triannual, and quarterly) plus mean.
    deseason -v sst -c sstclim -n 4

  EXAMPLE 4: calculate SST anomaly and save to variable "sstanom" (no file output).
    deseason -v sst -a sstanom

  DEPENDENCIES: qdims.gsf parsestr.gsf
drawbox.gs

Example Plot: 1
  Draw an unfilled "box" under any map projection.

  Usage: drawbox <lon1> <lon2> <lat1> <lat2>
     <lon1>: Beginning longitude.
     <lon2>: Ending longitude. Must be >= <lon1>.
     <lat1>: Beginning latitude.
     <lat2>: Ending latitude. Must be >= <lat1>.
drawline.gs

Example Plot: 1
  Draw lines in specified locations.

  Usage: drawline Lon|Lat|Lev|Val|Time <coordinate> [<coordinate>...] [Lon|Lat|Lev|Val|Time <coordinate> [<coordinate>...]] ...
    <coordinate>: world coordinate conforming to GrADS convention. E.g., time should be specified as HH:MMZDDMMMYYYY, MMMYYYY, etc.

  Example 1: drawline Lon 180 Lat 0
             Draw international date line and equator.

  Example 2: drawline Val -1 0 1
             Draw lines with value -1, 0 and 1.

  Note: Proper capitalization MUST be used for key words Lon, Lat, Lev, Val and Time.
drawmark.gs
  Draw marks at grid points with mark size (i.e., area) proportional to the magnitude of data.

  Usage: drawmark <var> <mark> <color> <size> [<magnitude> [<append> [<text>]]]]
     <var>: variable name.
     <mark>: mark type.
     <color>: mark color.
     <size>: mark size.
     <magnitude>: magnitude of <var> corresponding to <size>. If =0 then all marks will have the same size of <size>. Default=0.
     <append>: 0 (default) or 1. Set to 1 if appending to an existing plot. (Run "legend.gs" only once after all data are plotted.)
     <text>: Text to be shown in the legend (see "legend.gs"). Text beginning with a minus sign or containing spaces must be double quoted.

  Note: <var> must be on a grid consistent with the default file. If not, use "set dfile" to change the default file.

  Dependencies: qdims.gsf

  See also: legend.gs
drawstr.gs

Example Plot: 1
  Label a plot.

  USAGE 1: drawstr -t <text1> [<text2>...] [-p <position1> [<position2>...]] [-c <color1> [<color2>...]] [-z <size1> [<size2>...]]
           [-k <thickness1> [<thickness2>...]] [-b <background1> [<background2>...]] [-xo <xoffset1> [<xoffset2>...]] [-yo <yoffset1> [<yoffset2>...]]
  USAGE 2: drawstr -T <TEXT1> [<TEXT2>...] [-p <position1> [<position2>...]] [-c <color1> [<color2>...]] [-z <size1> [<size2>...]]
           [-k <thickness1> [<thickness2>...]] [-xo <xoffset1> [<xoffset2>...]] [-yo <yoffset1> [<yoffset2>...]]
    <text>|<TEXT>: panel labels | column titles. Text beginning with a minus sign or containing spaces must be double quoted.
    <position>: position of text. For <text>, refer to schematic below. For <TEXT>, use panel index to specify the location. Default="1 2 3...".
    <color>: color of text. Default=1.
    <size>: size of text. Default=current setting for <text>. Default=0.18 for <TEXT>.
    <thickness>: thickness of text.
    <background>: background color of text. Applicable to text inside plotting area only.
    <xoffset>: horizontal offset to default position. Default=0.
    <yoffset>: vertical offset to default position. Default=0.

                  <TEXT>

    1                  2                  3
    ------------------------------------------
    |11                                12|
    |                                        |
    |                                        |
  9|            Plot Area             |10
    |                                        |
    |                                        |
    |4                                    5|
    ------------------------------------------
               7       6       8       

  NOTE: The "-T" and "-t" options cannot be used together.

  EXAMPLE 1 (add axis labels):
    drawstr -p 6 9 -t Longitude Latitude

  EXAMPLE 2 (add column titles for a 3 rows by 2 columns plot):
    subplot 6 1
    ...
    subplot 6 6
    ...
    drawstr -p 1 4 -T "Title A" "Title B"

  Dependencies: parsestr.gsf
fcorr.gs
  Point-by-point temporal correlations between two fields.

  Usage: fcorr <input1> <input2> [<output>]
     <input1>: Input field 1.
     <input2>: Input field 2.
     <output>: Output field. Default="fcorrout".

  Dependencies: qdims.gsf
hist.gs
Histogram.

USAGE: hist t|xy <input> <output> <left_edge> <right_edge> <bin_size>
  t|xy: statistics are calculated over the selected dimension(s).
  <input>: input field (can have horizontal dimensions; NO vertical dimension).
  <output>: histogram.
  <left_edge>: left edge.
  <right_edge>: right edge.
  <bin_size>: bin size.

EXAMPLE 1: histogram over time.
  set time Jan1901 Dec2000
  hist t precip preciphist -2 2 0.25
  set time Jan1901
  set lev -2 2
  set xyrev on
  display preciphist

EXAMPLE 2: histogram over space.
  set lon 0 360
  set lat -90 90
  hist xy precip preciphist -2 2 0.25
  set lon 0
  set lat 0
  set lev -2 2
  set xyrev on
  display preciphist

DEPENDENCIES: qdims.gsf
lanczos.gs
  Lanczos filter along the time dimension.

  Usage: lanczos -v <var1> [<var2>...] [-n <name1> [<name2>...]] [-c <period1> [<period2>]] [-w <num_weight>] [-u <undef>] [-o <file>] [-p <path>]
     <var>: input variable. Can be any GrADS expression with NO missing values.
     <name>: name for output variable. Same as <var> if unset.
     <period>: cutoff period(s) (specified in # of time steps); one argument for lowpass filtering, two arguments (order of the arguments does not matter) for bandpass filtering.
     <num_weight>: # of weights on each side (a total of 2*<num_weight>+1 weights will be used). Default=<period>
     <undef>: undef value for .dat and .ctl. Default=the value found in ctlinfo.
     <file>: common name for output .dat and .ctl pair. If set, no variable is defined, only file output.
     <path>: path to output files. Do NOT include trailing "/". Default=current path.

  Dependencies: parsestr.gsf qdims.gsf
legend.gs

Example Plot: 1
  Draw a legend.

  Usage: legend [-orient v|h] [-xo <xoffset>] [-yo <yoffset>] [-scale <scalefactor>]
     -orient h: use for horizontal oriention. Default is vertical.
     <xoffset>: Horizontal offset to default position (i.e., top-left). Default=0.
     <yoffset>: Vertical offset to default position (i.e., top-left). Default=0.
     <scalefactor>: scale factor for line length and space. Default=1.

  Dependencies: parsestr.gsf

  See also: drawmark.gs plot.gs taylor.gs vector.gs
ltrend.gs   Linear trend over time (least-squares fitting).

  Usage: ltrend <input> [<output> [<slope> [<rmse>]]]
    <input>: input field. Can be any GrADS expression.
    <output>: output field, i.e., the fitted trend. Default=<input>.
    <slope>: slope of the fitted trend, i.e., change of <input> per time step.
    <rmse>: root mean square error.

  Dependencies: qdims.gsf
monmask.gs

Replaces:
tmskt.gs
  Generate mask for calendar months.

  Usage: monmask <start> <end> <mask>
     <start> <end>: specify range of calendar month(s) NOT to mask out.
     <mask>: mask (ones over <start> to <end> inclusive, missing values elsewhere).

  Note: works for any time grid/calendar.

  Example 1: monmask 12 2 winmask
           A new variable winmask will be defined with ones over December, January, and February, and missing values over other months.

  Example 2: monmask 6 8 summask
           A new variable summask will be defined with ones over June, July, and August, and missing values over other months.

  Example 3: monmask 7 7 julmask
           A new variable julmask will be defined with ones over July and missing values over other months.

  Dependencies: qdims.gsf
norm.gs
  Normalization of a time series.

  Usage: norm <input> [<output> [<mean> [<std> [<base_period_start> [<base_period_end>]]]]]
     <input>: input time series.
     <output>: output time series. Defalts to <input>.
     <mean>: sample mean.
     <std>: sample standard deviation.
     <base_period_start>: Normalization is over the period of <base_period_start> to <base_period_end>. Specified in world coordinate, e.g., Jan1960.
     <base_period_end>: Normalization is over the period of <base_period_start> to <base_period_end>. Specified in world coordinate, e.g., Dec1990.

  Dependencies: qdims.gsf
one2one.gs
  One-two-one smoothing of a time series.

  USAGE: one2one <input> [<output> [<iterations> [<option>]]]
     <input>: input field.
     <output>: output field. Default=<input>.
               If <output> = DISPLAY, only a graph will be displayed.
     <iterations>: number of iterations. Default=1.
                   If <iterations> <=0, no smoothing will be performed.
     <option>: set to "interannual" to smooth over the same calendar months/seasons."

  Dependencies: qdims.gsf
parseopt.gsf
  Ancillary script
parsestr.gsf
  Ancillary script
plot.gs
  Draw a line graph.

  Usage: plot -v <var1> [<var2>...] [-r <range_from> <range_to>] [-m <mark1> [<mark2>...]] [-z <size1> [<size2>...]] [-s <style1> [<style2>...]] [-c <color1> [<color2>...]] [-k <thick1> [<thick2>...]] [-t <text1> [<text2>...]] [-append 1]
     <var>: variable to be plotted.
     <range_from>, <range_to>: set the axis limit. Default=the minimum and maximum values.
     <mark>: Default="2 3 4...", i.e., open circle, closed circle, open square, closed square, and so on.
     <size>: Mark size. Default=0.11,
     <style>: Default=current GrADS setting.
     <color>: Default="1 2 3...", i.e., foreground color, red, green, dark blue, and so on.
     <thick>: Default=current GrADS setting.
     <text>: Text to be shown in the legend (use "legend.gs"). Text beginning with a minus sign or containing spaces must be double quoted.
     -append 1: use if appending to an existing plot. (Run "legend.gs" only once after all data are plotted.)

  Dependencies: parsestr.gsf qdims.gsf

  See also: legend.gs
ppp.gs
  Produce properly-cropped image files.

  Usage: ppp <outfile> [<format1>] [<format2>]...
    <outfile>: full path of output file. Do NOT include the filename extension (e.g., use mypath/myfile, instead of mypath/myfile.eps).
    <format>: eps (default), pdf, or png.
qdims.gsf
  Ancillary script
rmean.gs
  Running mean of a time series.

  USAGE 1: rmean <input> <window> [<output>]

           Calculate running mean using the given length of window and assign result to <output>.

  USAGE 2: rmean <input> <start> <end> [<output>]

           Calculate running mean using the window specified by <start> and <end>, and assign
           result to <output>.

           If not specified, <output> defaults to <input>.
           If <output> = DISPLAY, the result is displayed and not defined in a variable.

  EXAMPLE 1: rmean sst 4 sst4trmn
             Successively averages the field sst over 4 time steps t-2, t-1, t, t+1 and
             defines the  result as sst4trmn.

  EXAMPLE 2: rmean sst -2 1 DISPLAY
             Successively averages the field sst over 4 time steps t-2, t-1, t, t+1 and
             displays the  result.
rms.gs
Root mean squares.

USAGE: rms t|xy <input> <rms>
  t|xy: statistics are calculated over the selected dimension(s).
  <input>: input field.
  <rms>: root mean squares.

DEPENDENCIES: qdims.gsf
save.gs
  Save data in GrADS (.dat and .ctl) or netCDF (.nc) format.

  USAGE 1: save -v <var1> [<var2>...] [-n <name1> [<name2>...]] [-d <description1> [<description2>]] [-u <undef>] [-o <file>] [-p <path>]
  USAGE 2: save -v <var> -f netCDF [-d <description>] [-u <undef>] [-o <file>] [-p <path>]
     <var>: variable to be saved. Can be any GrADS expression if [-f netCDF] is not in use; must be a defined variable otherwise.
     -f netCDF: save in netCDF format. Only one DEFINED variable can be saved when this option is in use.
     <name>: name for a variable in saved .ctl file. Original name will be used if unset.
     <description>: description (long name) for a variable.
     <undef>: undef value for .dat and .ctl. Default=the value found in ctlinfo.
     <file>: name of output file(s). Do NOT include the filename extension. Default=saveout.
     <path>: path to saved file(s). Do NOT include trailing "/". Default=current path.

  Dependencies: parsestr.gsf qdims.gsf
shadcon.gs
  Plot a 2-D graph using shading and/or contours.

  USAGE: shadcon <colormap>[+<offset>][,<ccolor>] <var> <cint> [<blackout> [<blackout2> [<varmin> <varmax> [grfill]]]]
     <colormap>: Available color maps: lightdarkgrey, blue2red, brown2green.
     <offset>: offset for colormap.
     <ccolor>: contour color.
     <var>: variable to be plotted.
     <cint>: shading/contour interval.
     <blackout>: values between -<blackout>*<cint> to <blackout>*<cint> will NOT be shaded.
                 All values will be shaded if <blackout>=0. No values will be shaded if <blackout>=inf. Default=1.
     <blackout2>: values between -<blackout>*<cint> to <blackout>*<cint> will NOT be contoured.
                  All values will be shaded if <blackout>=0. No values will be shaded if <blackout>=inf. Default=<blackout>.
     <varmin> <varmax>: if given by numerical values, specify range of data to be mapped with distinctive colors; if given by strings, return actual range of data. <varmin> will be ignored if <varmax> is not specified. Default=actual range of data.
     grfill: use grfill instead of shaded for shading.

  EXAMPLE 1: shadcon blue2red sst 0.1
             This will plot the variable sst using a blue-to-red color map, with a shading/contouring interval/shreshold of 0.1.

  EXAMPLE 2: shadcon blue2red sst 0.1 1 inf
             As EXAMPLE 1, except without contours.

  EXAMPLE 3: shadcon blue2red sst 0.1 inf 1
             As EXAMPLE 1, except without shading.

  EXAMPLE 4: shadcon blue2red sst 0.1 1 1 -0.2 0.5
             As EXAMPLE 1, except only values between -0.2 and 0.5 will be mapped with distinctive colors.

  EXAMPLE 5: shadcon blue2red sst 0.1 1 inf null null grfill
             As EXAMPLE 2, except using grfill for shading.
studt.gs
  Two-tailed Student t-test.

  Usage: studt <dof> <t> [<p>]
         <dof>: degree of freedom.
         <t>: t-statistic.
         <p>: probability. Default=studtout.
subplot.gs

Example Plot: 1 2 3
  Prepare for a multi-panel plot.

  USAGE: subplot <ntot> <idx> [<ncol>] [-tall 0|1] [-tight 0|1] [-xtight 0|1] [-ytight 0|1] [-scale <scalefactor>] [-xy <xyratio>]
         [-xs <xspacing>] [-ys <yspacing>] [-xp <xpadding>] [-yp <ypadding>] [-hleft 0|1] [-yleft 0|1]
    <ntot>: total number of panels to be plotted; no preset limit. Do NOT have to be # of rows times # of columns; will be rounded up to that value.
    <idx>: index of panel, numbered from top to bottom, then left to right. In each column/row, panels with smaller <idx> MUST be plotted earlier.
    <ncol>: number of columns; no preset limit. Default=2 (even if <ntot>=1).
    -tall 1: fit page height.
    -tight 1: leave no spaces between panels.
    -xtight 1: leave no horizontal spaces between panels.
    -ytight 1: leave no vertical spaces between panels.
    <scalefactor>: scale factor. Default=1.
    <xyratio>: aspect ratio of the plotting area. Default=1. An optimal value will be calculated for map projections.
    <xspacing>: horizontal spacing in addition to default value.
    <yspacing>: vertical spacing in addition to default value.
    <xpadding>: horizontal padding in addition to default value.
    <ypadding>: vertical padding in addition to default value.
    -hleft 1: set panel height the same as the immediate left panel.
    -yleft 1: align panel top to the immediate left panel.

  NOTE: 1. Spacing refers to blank space between virtual pages; can be any value.
        2. Padding refers to space between virtual page boundaries and plotting area; cannot be negative values.
        3. For best result, set desired dimensions before running this script.

  EXAMPLE 1 (2 rows by 2 columns):
    set lon 120 300
    set lat -25 25
    set t 1
    subplot 4 1
    display sst
    ...
    set t 4
    subplot 4 4
    display sst

  EXAMPLE 2 (3 rows by 1 column and no vertical spaces between panels):
    set lon 120 300
    set lat -25 25
    set t 1
    subplot 3 1 1 -ytight 1
    display sst
    ...
    set t 3
    subplot 3 3 1 -ytight 1
    display sst

  Dependencies: parsestr.gsf qdims.gsf
tave.gs

Replaces:
day2mon.gs
day2pen.gs
mon2ssn.gs
mon2yr.gs
ssn2yr.gs
subday2day.gs
Time averaging (create lower resolution time series from higher resolution time series; e.g., daily to monthly).

USAGE: tave <step> -v <var1> [<var2>...] [-n <name1> [<name2>...]] [-re <nx> <lon_start> <dlon> <ny> <lat_start> <dlat>] [-u <undef>] [-sum 1] [-o <file>] [-p <path>]
  <step>: time step for averaging. MUST be specified in world coordinate, e.g., 6hr, 5dy, 3mo, 1yr, etc.
  <var>: input variable. Can be any GrADS expression.
  <name>: name for output variable. Same as <var> if unset.
  <nx> <lon_start> <dlon> <ny> <lat_start> <dlat>: arguments for horizontal regridding. Box averaging is used when regridding to coarser grid. Bilinear interpolation is used when regridding to finer grid.
  <undef>: undef value for .dat and .ctl. Default=the value found in ctlinfo.
  -sum 1: summing instead of averaging.
  <file>: common name for output .dat and .ctl pair. If set, no variable is defined, only file output.
  <path>: path to output files. Do NOT include trailing "/". Default=current path.

NOTE: averaging starts at the first time step of the current dimension, and ends at/before the last time step of the current dimension.
      E.g., if input is 6-hourly, time is set to 06Z01JAN2000-18Z31JAN2000, and <step>=1dy, then averaging starts at 06Z01JAN2000, and ends at 00Z31JAN2000.

EXAMPLE 1: create weekly mean SST from daily mean SST and save to a new variable "sstweek".
  set time 01JAN2000 31DEC2010
  tave 7dy -v sst -n sstweek

EXAMPLE 2: as example 1 but with horizontal regridding.
  set time 01JAN2000 31DEC2010
  tave 7dy -re 144 0 2.5 73 -90 2.5 -v sst -n sstweek

EXAMPLE 3: create monthly precipitation amount from hourly precipitation amount and save to new files "precipmon.ctl" and "precipmon.dat".
  set time 00Z01JAN2000 23Z31DEC2010
  tave 1mo -v precip -sum 1 -o precipmon

DEPENDENCIES: parsestr.gsf qdims.gsf
taylor.gs

Example Plot: 1 2
Draw a Taylor diagram.

USAGE: taylor -s <STD1> [<STD2>...] -r <CORR1> [<CORR2>...] [-i <file>] [-rows <row_start>] [-rowe <row_end>]
       [-cols <column_STD>] [-colr <column_CORR>] [-colT <column_TEXT>] [-l <limit>] [-m <mark1> [<mark2>...]]
       [-z <size1> [<size2>...]] [-c <color1> [<color2>...]] [-t <text1> [<text2>...]] [-T <TEXT1> [<TEXT2>...]]
       [-levs <level1> [<level2>...]] [-levr <level1> [<level2>...]] [-levc <color>] [-append 1]
  <STD>: standard deviation.
  <CORR>: correlation.
  <file>: input file containing standard deviations (in one column) and correlations (in another column). Non-numeric values are treated as missing value flags.
    <row_start>: first row to read. Default=1.
    <row_end>: last row to read. Default=number of rows in <file>.
    <column_STD>: which column contains standard deviations. Default=1.
    <column_CORR>: which column contains correlations. Default=2.
    <column_TEXT>: which column contains text to be shown in the legend (use "legend.gs").
  <limit>: limit of x/y axis. Default=2.5. A quarter circle is drawn if positive; a half circle is drawn if negative.
  <mark>: default="2 3 4...", i.e., open circle, closed circle, open square, closed square, and so on.
  <size>: mark size. Default=0.11,
  <color>: default="1 2 3...", i.e., foreground color, red, green, dark blue, and so on.
  <text>: text to be shown above each mark. Text beginning with a minus sign or containing spaces must be double quoted.
  <TEXT>: text to be shown in the legend (use "legend.gs"). Text beginning with a minus sign or containing spaces must be double quoted.
  <level>: contour levels to be drawn for <STD> and/or <CORR>. Contour level 1 is drawn by default for standard deviation.
  <color>: line color for <STD> and/or <CORR> contours. Default=1.
  -append 1: use if appending to an existing plot. (Run "legend.gs" only once after all data are plotted.)

EXAMPLE 1:
  subplot 1 1 1 -xy 1
  taylor -s 0.8 1.25 -r 0.8 0.9 -t A B -T "Model A" "Model B" -c 2 -m 2
  drawstr -p 6 9 corr -t "Standard Deviation" "Standard Deviation" Correlation
  legend

EXAMPLE 2:
  subplot 1 1 1 -xy 2
  taylor -s 0.8 1.25 -r -0.8 -0.9 -l -2.5 -t 1 2 -T "Model A" "Model B" -c 4 -m 3
  drawstr -p 6 corr -t "Standard Deviation" Correlation
  legend

EXAMPLE 3: input given by a text file "myinput.txt", where 1st column contains standard deviations, and 2nd column correlations.
  subplot 1 1 1 -xy 1
  taylor -i myinput.txt -T "Model A" "Model B" -c 2 -m 2
  drawstr -p 6 9 corr -t "Standard Deviation" "Standard Deviation" Correlation
  legend

DEPENDENCIES: parsestr.gsf qdims.gsf

SEE ALSO: legend.gs
taylor_calc.gs
Calculate statistics used in Taylor diagram.

USAGE: taylor_calc xyt|xy|t|xt|zt|xz <obs> <sim> <stdrat> [<corr> [<normbias>]]
  xyt|xy|t|xt|zt|xz: statistics are calculated over the selected dimension(s).
  <obs>: observation.
  <sim>: simulation.
  <stdrat>: STD ratio.
  <corr>: correlation.
  <normbias>: bias normalized by STD of <obs>.

DEPENDENCIES: qdims.gsf
tlag.gs

Replaces:
lagregr.gs
lagcorr.gs
Lag regression/correlation/composite.

USAGE: tlag regr|corr|comp <input1> <input2> <output> [<lag_start> [<lag_end>]]
  regr|corr|comp: regr for regression, corr for correlation, comp for composite.
  <input1>: Independent variable, or mask for compositing (mask>=0 where conditions are met). Can be any GrADS expression. Can have a vertical dimension. Cannot have horizontal dimensions.
  <input2>: Dependent variable. Can be any GrADS expression. Can have vertical and horizontal dimensions.
  <output>: Output variable. E.g., "set t 0" and then <output>(t-3) will be lag regression/correlation/composite when <input2> leads <input1> by 3 time steps (<input2> is shifted forward by 3 time steps for this calculation).
  <lag_start>: Beginning lag. E.g., <lag1>=-3 for <input2> leading <input1> by 3 time steps. Default=0.
  <lag_end>: Ending lag. E.g., <lag2>=3 for <input2> lagging <input2> by 3 time steps. Default=0.

NOTE 1: <input2> must be on a grid consistent with the default file. If not, use "set dfile" to change the default file.

NOTE 2: "set t 0" and use <output>(t+number) to get the value at lag(number), or "set t <lag1> <lag2>" to get values at all lags.

EXAMPLE 1: calculate and display auto-correlation function of Nino3.4 index.
  tlag corr nino34 nino34 out -24 24
  set t -24 24
  display out

EXAMPLE 2: calculate and display lag regression between Nino3.4 index and global precipitation.
  tlag regr nino34 precip out -12 12
  set t 0
  subplot 8 1
  display out(t-12)
  subplot 8 2
  display out(t-8)
  subplot 8 3
  display out(t-4)
  ...
  subplot 8 7
  display out(t+12)

DEPENDENCIES: qdims.gsf
vector.gs
  Draw a vector graph.

  Usage: vector <expression1> <expression2> <length> <magnitude> [<color> [<thickness>]]
     <expression1>: expression 1.
     <expression2>: expression 2.
     <length>: reference length of arrow.
     <magnitude>: reference magnitude of arrow.
     <color>: arrow color. Default=1.
     <thickness>: arrow thickness. Default=4.

  See also: legend.gs
yrmask.gs
  Generate mask for calendar years.

  USAGE: yrmask <yr1> [<yr2>...] <mask> [<year>]
    <yr>: calendar year NOT to mask out.
    <mask>: mask. Ones over unmasked years, missing values elsewhere.
    <year>: calendar year where <mask> = 1.

  NOTE: any time grid or calendar is supported.

  EXAMPLE: define a variable "posIODnoENSO" with ones over 1961, 1967, and 1983, and missing values over other years.
    yrmask 1961 1967 1983 posIODnoENSO

  DEPENDENCIES: qdims.gsf