libmf.gex - Mike Fiorino`s Collection of GrADS Extensions



NAME

libmf.gex - Mike Fiorino`s Collection of GrADS Extensions


SYNOPSIS

GrADS Commands

tcprop EXPR LON LAT RADIUS - Properties relative to lon/lat

mfhilo EXPR [METHOD[,OPTIONS] - Find max/min or H/L in 2D field

GrADS Functions:

smth2d(EXPR[,N,nu1,...,nuN]) - Shuman smoother/de-smoother

uv2trw(U,V,[OPT],[LON,LAT]) - Find radial/tangential velocity


DESCRIPTION

This library implements Mike Fiorino`s collection GrADS extensions, including his classic regrid2 regridding function as an extension now called re2, smth2d for applying the Shuman smoother-desmother and computing radial/tangential velocities relative to a lat/lon point. Commands are also provided to find H/L of a 2D field and to calculate properties of a tropical cyclone (TC).

These functions were initially developed as classic User Defined Function (UDFs) in GrADS v1.x. These extensions were later implemented as dynamic linked extensions in GrADS v1.10.


COMMANDS PROVIDED

tcprop EXPR LON LAT RADIUS BEARING

This command computes the EXPR properties relative to a point located at LON,LAT, typically a tropical cyclone. The parameters are returned to the calling GrADS script via script variable result.

Sample output:

 tcprop for expr: psl Latc:   16.80  Lonc:  129.70  Radinf:   200 [nm] Bearing:    60  Hemi1:  60-240 Hemi2: 240-420
 MAXCntRadGrad:  1.249e-02  minCntRadGrad:  8.694e-03  MeanCntRadGrad:  1.063e-02 [units: (out-ctr)/nm]
 MeanFieldInsideRadinf:     100573 
 Hemi1:         60-240  Hemi2:        240-420
 MeanHemi1:     100572  MeanHemi2:     100573 
 QuadNE:     60-150  QuadSE:    150-240  QuadSW:    240-330  QuadNW:    330-420
 MeanNE:     100598  MeanSE:     100545  MeanSW:     100548  MeanNW:     100597

EXPR - a valid GrADS expression

LON,LAT - longitude/latitude of the center

RADIUS - distance in nm away from LON,LAT to calculate properties

BEARING - direction (0-360 deg) to calculate mean of the field within RADIUS in four quadrants and two hemispheres, e.g., of a TC is heading towards the West (270 deg), then MeanHemi1 will be the right hemisphere (North or right of track) and MeanHemi2 the left (South or left of the motion). The quadrants are defined NE,SE,SW,NW relative to BEARING (0 deg or North)

mfhilo EXPR [METHOD[,OPTIONS]

This command finds maximun/minimum values in a 2-D lat/lon field, returning the location and value between grid points via the GrADS script variable result.

EXPR is a GrADS valid expression

METHOD - can be either CL or GR

For method CL -- Contour-Level based from NCEP -- the OPTIONS are

MaXMin - specify L for lows only, H for highs only; A|B for both (case insensitive)

RADIUS - radius in nm, default is 120, bigger radius leads to finding fewer H/L

CINTINF - contour interval between max and nearby point; smaller contour interval leads to finding more negative extrema.

For method GR -- GRid-based written by Mike Firoino -- the OPTIONS are

MaXMin - specify L for lows only, H for highs only; A|B for both (case insensitive)

SORTby - d distance from either center of grid or a specified lat/lon; m order by mag/value at extrema; g by gradient; l by laplacian

PCNTILE - set percentile (0-100) of top N points sorted by gradient

LATC - set the latitude for distance [nm] calculations

LONC - set the longitude (deg E) for distance [nm] calculations

sExample + output:

 vt=hcurl(u,v)*1e5
 mfhilo vt gr b d 30 16.8 129.7

output in script variable result:

 mfhilo GR method N: 7  maxmin: 0  pcntile:     30  latc:  16.80 lonc:  129.70
 H    16.86  129.90  M:    20.3321  G:  100.0  L:  100.0  D:   12.22  GV:     2.2897  LV:    4.82068 
 H    17.03  127.69  M:    10.4799  G:   38.7  L:   28.8  D:  115.96  GV:    0.88574  LV:    1.38745 
 L    20.56  129.96  M:    -5.2466  G:  100.0  L:  100.0  D:  226.19  GV:    1.09352  LV:    4.55874 
 L    17.94  125.36  M:  -0.435871  G:   43.6  L:   23.0  D:  257.63  GV:    0.47636  LV:    1.04821 
 L    18.10  134.23  M: 0.00436844  G:   60.2  L:   25.6  D:  270.80  GV:   0.658458  LV:    1.16751 
 L    16.06  124.95  M:  -0.726843  G:   26.8  L:   32.2  D:  276.80  GV:   0.293564  LV:    1.46846 
 L    14.40  134.67  M:   -5.43262  G:   88.4  L:   41.8  D:  321.18  GV:   0.966466  LV:    1.90383 
 
for the first output line (in grads script: sublin(result,2)):
 H                     -- type of extrema High or Low
 16.86                 -- latitude
 129.90                -- longitude
 M:    20.3321         -- magnitude
 G:  100.0             -- percentile of gradient
 L:  100.0             -- percentile of laplacian
 D:   12.22            -- great-circle distance [nm] away from latc (16.8) and lonc (129.7)
 GV:     2.2897        -- value of gradient in grid units (dx=i+1-i = 1)
 LV:    4.82068        -- value of laplacian in grid units

For method TM -- Tim Marchok, GFDL barnes-analysis scheme to locate extrema between grid points -- the OPTIONS are

LATC - first-guess latitude

LONC - first-guess longitude (deg E)

RADINF - search radiusm [nm]

ICTYPE - 0 -> cparm='nothing special'; 1 -> cparm='vmag' (special wind speed reatment); 2 -> cparm='zeta' (special vorticity treatment)

Example + Output:

 mfhilo vt tm 16.8 129.7
 mfhilo TM method for expr: vt  Radinf:   250 [nm] ictype: 0 (0=> cparm=''nothing special', 1=> cparm='vmag'; 2=> cparm='zeta'
 GuessLon:  129.70  GuessLat:   16.80
 FinalLon:  129.90  FinalLat:   16.85  FinalVal:     17.665  FinalValBesselIntrp:    20.3253


FUNCTIONS PROVIDED

smth2d(EXPR[,N,nu1,...,nuN])

This function smooths a 2D field according to the Shuman (1957, MWR 357-361) smoother-desmoother algorithm; defaults N=1 nu1=0.5 nu2=-0.5 (light). For exampe, for a 3 passes, heavy filter enter

      ga-> d smth2d(psl,3,0.5)

EXPR is a GrADS valid expression

N - number of fiter passes

ni1,...nuN - smoothing coefficients

uv2trw(U,V,[OPT],[LON,LAT])

This function returns the tangential (OPT=1, default) or radial (OPT=-1) velocity relative to a fixed LON,LAT. If no LON,LAT is provided, then the center of the grid is assumed the fixed point. For example,

      ga-> d uv2trw(ua,va,-1)

displays the radial velocity, while

      ga-> d uv2trw(ua,va)

displays the tangential velocity.


SEE ALSO


AUTHOR

Michael Fiorino (mfiorino@gmail.com)


COPYRIGHT

Copyright (C) 2009 Michael Fiorino

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 libmf.gex - Mike Fiorino`s Collection of GrADS Extensions