Interpolates data on a curvilinear grid (i.e. RCM, WRF, NARR) to an unstructured grid.
function rcm2points ( lat2d [*][*] : numeric, lon2d [*][*] : numeric, fi : numeric, lat [*] : numeric, lon [*] : numeric, opt : integer ) return_val : numeric
A two-dimensional array that specifies the latitude locations of fi. The latitudes should proceed from south-to-north.lon2d
A two-dimensional array that specifies the longitude locations of fi. The longitudes should proceed from west-to-east.fi
A multi-dimensional array to be interpolated. The rightmost two dimensions (latitude, longitude) are the dimensions to be interpolated.lat
A one-dimensional array that specifies the latitude coordinates of the output locations.lon
A one-dimensional array that specifies the longitude coordinates of the output locations.opt
opt=0 or 1 means use an inverse distance weight interpolation.
opt=2 means use a bilinear interpolation. (starting with v5.2.1)
A multi-dimensional array of the same size as fi except that the rightmost two dimensions have been replaced by the number of coordinate pairs (lat,lon). Double if fi is double, otherwise float.
Interpolates data on a curvilinear grid, such as those used by the RCM (Regional Climate Model), WRF (Weather Research and Forecasting) and NARR (North American Regional Reanalysis) models/datasets to an unstructured grid. All of these have latitudes that are oriented south-to-north.
A inverse distance squared algorithm is used to perform the interpolation.
Missing values are allowed and no extrapolation is performed.
The algorithm used assumes that all latiudes and longitudes refer to a spherical earth. They do not account for the fact that the earth is an ellipsoid.
Interpolate to two locations near Denver, Colorado:
lonDen = (/-104.867, -102.0/) latDen = (/ 39.75, 38.0/) f = addfile ("some_RCM_file.nc", "r") lat2d = f->xlat ; size = (nlat,nlon) lon2d = f->xlon ; size = (nlat,nlon) x = f->X xDen = rcm2points (lat2d, lon2d, x, lat, lon, 0)
If the input x was of size:
x(nlat,nlon) ==> xDen(2) x(ntim,nlat,nlon) ==> xDen(ntim,2) x(ntim,klev,nlat,nlon) ==> xDen(ntim,klev,2)
If only one coordinate pair was specified by the user, the result would be returned as a scalar.