Approximate field values at given Lat-Lon co-ordinates.
point.interp.Rd
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.
Usage
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)
Arguments
- infield
A
geofield
object. Or ageodomain
if you are only interested in initialising the weights.- domain
A geodomain or geofield object. The
.init
routines may be called with only a domain specification, as the weights do not depend on the field values. If a geofield is provided, the domain attribute is taken.- 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
point.[method].init
routines. If provided, the weights are not re-calculated. For interpolation of many fields, it is often faster to initialise once and use these weights.- 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
force=TRUE
, the output is set toNA
. The default is to avoid this and revert to using all 4 points for the interpolation.- 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.
Value
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.
Details
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.