datarank

Ranks data over a selected independent variable(s)

var [ grids ... ] datarank

Arguments
labeltypedescription
var variable data to be ranked
grids grid set grid(s) (i.e., independent variables) over which data is to be ranked
Returns
rankvar variable same as var except values of rankvar are the ranks of corresponding values of var; rankvar is dependent on the same grids as var

Description

datarank converts the n values along the grid(s) of an input variable to integer ranks from 1 to n along the specified grid(s) in the data set, with 1 corresponding to the largest input value and n corresponding to the smallest value.

Example

SOURCES .NOAA .NCDC .ERSST .version2 .SST
X (-170) (-120) RANGE
Y (-5) (5) RANGE
T (Jan 1971) (Dec 2000) RANGE
[X Y]average
T 12 splitstreamgrid
[T2]datarank


In this example, monthly sea surface temperature values from the ERSST data set are selected from 1971 to 2000 and spatially averaged over the Nino 3.4 region in the equatorial Pacific to produce a single monthly time series for the region. The "T 12 splitstreamgrid" command splits the monthly time grid into two component grids -- "T", which is a 12-point periodic grid that indexes the months of the year, and "T2", which is a 30-point grid that indexes the years 1971 to 2000. [T2] datarank converts the SST values to ranks along the "T2" grid of years. As a result, for each month of the year, SST values from 1971 to 2000 are ranked from largest (1) to smallest (30).

Live Example Link


See also

Statistical Functions: correlate distrib1D integrateddistrib1D medianover normalizeddistrib1D percentileover rankcorrelate replacebypercentile rmsaover rmsover seasonalfreqGT seasonalfreqLT seasonalmeandailyvalueGT seasonalnonoverlapDSfreq seasonalnonoverlapWSfreq seastotAvgFill seastotZeroFill standardize width96