
rcm2points
Interpolates data on a curvilinear grid (i.e. RCM, WRF, NARR) to an unstructured grid.
Prototype
function rcm2points ( lat2d [*][*] : numeric, lon2d [*][*] : numeric, fi : numeric, lat [*] : numeric, lon [*] : numeric, opt : integer ) return_val : numeric
Arguments
lat2dA two-dimensional array that specifies the latitude locations of fi. The latitudes should proceed from south-to-north.
lon2dA two-dimensional array that specifies the longitude locations of fi. The longitudes should proceed from west-to-east.
fiA multi-dimensional array to be interpolated. The rightmost two dimensions (latitude, longitude) are the dimensions to be interpolated.
latA one-dimensional array that specifies the latitude coordinates of the output locations.
lonA one-dimensional array that specifies the longitude coordinates of the output locations.
optopt=0 or 1 means use an inverse distance weight interpolation.
opt=2 means use a bilinear interpolation.
Return value
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.
Description
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.
For more robust regridding, see the ESMF regridding examples, which show how to regrid data from and to rectilinear, curvilinear, or unstructured grids. Available in version 6.1.0 and later.
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.
Use the rcm2points_Wrap function if metadata retention is desired. The interface is identical.
See Also
rcm2points_Wrap, rgrid2rcm, rcm2rgrid, linint2_points, linint2_points_Wrap, ESMF_regrid
Examples
Example 1
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) ; Use rcm2points_Wrap if metadata retention is desired ; xDen = rcm2points_Wrap (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.