interpp: Pointwise interpolate irregular gridded data

View source: R/interp.R

interppR Documentation

Pointwise interpolate irregular gridded data

Description

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.

Usage

interpp(x, y = NULL, z, xo, yo = NULL, linear = TRUE,
  extrap = FALSE, duplicate = "error", dupfun = NULL,
  deltri = "shull")

Arguments

x

vector of x-coordinates of data points or a SpatialPointsDataFrame object. Missing values are not accepted.

y

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.

z

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).

xo

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.

yo

vector of y-coordinates of points at which to evaluate the interpolating function.

If operating on SpatialPointsDataFrames this is left as NULL

linear

logical – indicating wether linear or spline interpolation should be used.

extrap

logical flag: should extrapolation be used outside of the convex hull determined by the data points? Not possible for linear interpolation.

duplicate

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.

dupfun

this function is applied to duplicate points if duplicate="user"

deltri

triangulation method used, this argument will later be moved into a control set together with others related to the spline interpolation!

Value

a list with 3 components:

x, y

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.

z

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".

Note

This is only a call wrapper meant for backward compatibility, see interp for more details!

Author(s)

Albrecht Gebhardt <albrecht.gebhardt@aau.at>, Roger Bivand <roger.bivand@nhh.no>

References

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.

See Also

interp

Examples

### 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)
    }

interp documentation built on May 29, 2024, 8:03 a.m.