This function implements bivariate interpolation onto a set of points for irregularly spaced input data.
This function is meant for backward compatibility to package
akima, please use interp with its output
argument set to "points" now. Especially newer options to the underlying
algorithm are only available there.
interpp(x, y = NULL, z, xo, yo = NULL, linear = TRUE,
extrap = FALSE, duplicate = "error", dupfun = NULL,
deltri = "shull")a list with 3 components:
If output="grid":
vectors of \(x\)- and \(y\)-coordinates of output grid, the same
as the input
argument xo, or yo, if present. Otherwise, their
default, a vector 40 points evenly spaced over the range of the
input x and y.
If output="points": vectors of \(x\)- and \(y\)-coordinates of
output points as given by xo and yo.
If output="grid":
matrix of fitted \(z\)-values. The value z[i,j] is computed
at the point \((xo[i], yo[j])\). z has
dimensions length(xo) times length(yo).
If output="points": a vector with the calculated z values for
the output points as given by xo and yo.
If the input was a SpatialPointsDataFrame a
SpatialPixelssDataFrame is returned for output="grid"
and a SpatialPointsDataFrame for output="points".
vector of x-coordinates of data points or a
SpatialPointsDataFrame object.
Missing values are not accepted.
vector of y-coordinates of data points. Missing values are not accepted.
If left as NULL indicates that x should be a
SpatialPointsDataFrame and z names the variable of
interest in this dataframe.
vector of z-coordinates of data points or a character variable
naming the variable of interest in the
SpatialPointsDataFrame x.
Missing values are not accepted.
x, y, and z must be the same length
(execpt if x is a SpatialPointsDataFrame) and may
contain no fewer than four points. The points of x and y
cannot be collinear, i.e, they cannot fall on the same line (two vectors
x and y such that y = ax + b for some a,
b will not be accepted).
vector of x-coordinates of points at which to evaluate the interpolating
function. If x is a SpatialPointsDataFrame this has
also to be a SpatialPointsDataFrame.
vector of y-coordinates of points at which to evaluate the interpolating function.
If operating on SpatialPointsDataFrames this is left as NULL
logical -- indicating wether linear or spline interpolation should be used.
logical flag: should extrapolation be used outside of the convex hull determined by the data points? Not possible for linear interpolation.
indicates how to handle duplicate data points. Possible values are
"error" - produces an error message, "strip" - remove
duplicate z values, "mean","median","user" -
calculate mean , median or user defined function of duplicate z
values.
this function is applied to duplicate points if duplicate="user"
triangulation method used, this argument will later be moved into a control set together with others related to the spline interpolation!
Albrecht Gebhardt <albrecht.gebhardt@aau.at>, Roger Bivand <roger.bivand@nhh.no>
Moebius, A. F. (1827) Der barymetrische Calcul. Verlag v. Johann Ambrosius Barth, Leipzig, https://books.google.at/books?id=eFPluv_UqFEC&hl=de&pg=PR1#v=onepage&q&f=false
Franke, R., (1979). A critical comparison of some methods for interpolation of scattered data. Tech. Rep. NPS-53-79-003, Dept. of Mathematics, Naval Postgraduate School, Monterey, Calif.
interp
### Use all datasets from Franke, 1979:
### calculate z at shifted original locations.
data(franke)
for(i in 1:5)
for(j in 1:3){
FR <- franke.data(i,j,franke)
IL <- with(FR, interpp(x,y,z,x+0.1,y+0.1,linear=TRUE))
str(IL)
}
Run the code above in your browser using DataLab