CofA=B

Converts a variable A to a variable B using a table B(C) and linear interpolation. Out of range values beyond half a grid step are NaN

A B [ C ... ] CofA=B

Arguments
labeltypedescription
A variable Variable to be converted
B variable Variable to be converted
C grid set
Returns
C' variable Converted variable using table B(C) and linear interpolation Out of range values beyond half a grid step are NaN


Description

CofA=B accepts two variables (A and B) as input and converts variable A values to values expressed in terms of variable B based upon a table of corresponding values (B(C)) in variable B and linear interpolation between the points specified in the table. Out-of-range values beyond half a grid step are assigned NaN values.

Example

In the following example the input variable A is CAMS-OPI gridded monthly precipitation, which depends upon longitude (X), latitude (Y), and months (T) from Jan 1979 to Dec 2000. Input variable B is gridded observed monthly precipitation, which depends upon grids X and Y (which match with X and Y from variable A) and months (T) specified from Jan 1969 to Dec 1998. The purpose of this particular script is to use a specific 30-year set of precipitation values (variable B) to calculate precipitation percentiles by month of year and then express precipitation values from the shorter time series (variable A) in terms of the percentiles from variable B's climatology at each (X,Y) grid point.

Here, the time grid for variable B is split into a grid of 12 months per year (T) and a grid of 30 years (T2) from 1969 to 1998. The function "replacebypercentile" is applied to the T2 grid of years in variable B, with the result that the T2 grid is replaced by a new grid named "percentile" that has points at 0.0, 0.33, 0.5, 0.67, and 1, containing the precipitation values that correspond to those percentiles in the 30-year climatology for each month of the year at each (X,Y) grid point.

Based upon the correspondence between percentile and precipitation values in variable B function (the table B(C)) "[percentile]CofA=B-bounded" then converts the time series of monthly precipitation values in variable A to percentiles by month of year using linear interpolation between the percentile points specified in the "percentile" grid in variable B. Any precipitation values in variable A that fall outside the range of precipitation values that correspond to percentiles between 0 and 1 in variable B will be assigned missing values (NaN).

SOURCES .NOAA .NCEP .CPC .CAMS_OPI .v0208 .mean .prcp
T (Jan 1979) (Dec 2000) RANGE

SOURCES .IRI .FD .Seasonal_Forecast .Observations .monthly .prcp

T (Jan 1969) (Dec 1998) RANGE

T 12 splitstreamgrid

[T2]0.0 0.33 0.5 0.67 1. 0.5 replacebypercentile

[percentile]CofA=B

Live Example Link


See also

Table Lookup: BofA=C BofA=C-bounded CofA=B-bounded toS