point.interp | R Documentation |
Approximate field values for given Lat-Lon co-ordinates. Either by interpolation or by taking the closest grid point value. The .init
routines allow to calculate the interpolation weights only once. The routines for different methods don't have to be called explicitely. In principle, you should only call point.interp
and point.interp.init
and specify a method.
point.interp(infield, lon, lat, method="bilin", mask=NULL, pointmask=NULL, force=FALSE, weights=NULL)
point.interp.init(domain=.Last.domain(), lon, lat, method="bilin", mask=NULL, pointmask=NULL, force=FALSE)
point.index(domain=.Last.domain(), lon, lat, clip=TRUE)
point.closest(infield, lon, lat, mask=NULL, pointmask=NULL, force=FALSE, weights=NULL)
point.closest.init(domain=.Last.domain(), lon, lat, mask=NULL, pointmask=NULL, force=FALSE)
point.bilin(infield, lon, lat, mask=NULL, pointmask=NULL, force=FALSE, weights=NULL)
point.bilin.init(domain=.Last.domain(), lon, lat, mask=NULL, pointmask=NULL, force=FALSE)
point.bicubic(infield, lon, lat, weights=NULL)
point.bicubic.init(domain=.Last.domain(), lon, lat)
infield |
A |
domain |
A geodomain or geofield object. The |
lon |
A vector of longitues. |
lat |
A vector of latitudes (same length as lon). |
method |
Can be "bilin", "bicubic" or "closest". |
weights |
These weights are the result of the |
mask |
A matrix of the same domain, indicating which points should be masked from the interpolation. Usually a land/sea mask. Maks is not supported for bicubic interpolation. |
pointmask |
An optional vector that can be used in combination with the mask if some of the points are actually meant to be interpolated from masked points (e.g. temperature at sea). Default is a vector with constant value 1 for all points. |
force |
When using a mask, it is possible that all 4 points are masked out. If |
clip |
If TRUE, fractional indices that are lower than 0.5 or higher than gridsize+0.5 are set to NA. If FALSE, points outside the domain will still get an interpolated value. |
point.bilin
etc. are called by the main routine point.interp
, depending on the chosen method. You don't really have to call them explicitely.
point.interp()
returns a vector containing the interpolated values for the given co-ordinates. point.index
returns the (fractional) matrix indices, which may be of interest. point.interp.init()
returns a list with interpolation weights that can be used to speed up future calls.
regrid
## Not run:
w1 <- point.interp.init(lon, lat, domain=.Last.domain(), method="bilin")
f1 <- point.interp(lon, lat, infield, weights=w1, method="bilin")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.