interpol: Interpolate from source to target locations

Description Usage Arguments Details Value

View source: R/mesh.R

Description

Interpolates values from source to target location using inverse distance weighting (IDW) of nearest neighbours.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
interpol(trg, src, ...)

## S3 method for class 'SpatialPoints'
interpol(trg, src, ..., z, n = 5, output = "sp")

## S3 method for class 'matrix'
interpol(trg, src, ..., n = 5, output = "numeric")

## S3 method for class 'data.frame'
interpol(trg, src, ..., n = 5, output = "data.frame")

## S3 method for class 't2d_tin'
interpol(trg, src, ..., n = 5, output = "numeric")

Arguments

trg

The target locations. Either: a matrix or data.frame with x and y coordinates; an object of class SpatialPoints; an object of class t2d_tin.

src

The source locations. Either: a matrix with x and y coordinates (argument z as to be provided); a data.frame with x and y coordinates and the variable of interest ("z"); an object of class SpatialPointsDataFrame, raster, or stars (only the first attribute is taken).

...

Further arguments passed to idw.

z

If src is a matrix: numeric vector of values at src locations to be interpolated to trg locations.

n

The number of nearest neighbours used for interpolation (default is 5).

output

The type of output: numeric, sp, or data.frame (see below).

Details

Function calls idw. You can pass further arguments to that function, e.g. idp to influence the distance-based weighting of neighbours (default is 2).

Value

output = "numeric": a vector of values interpolated to trg locations.

output = "data.frame": a data.frame with x and y coordinates of trg location and interpolated values ("z").

output = "sp": an object of class SpatialPointsDataFrame with the interpolated values at trg locations.


tpilz/telemac documentation built on Feb. 10, 2022, 2:12 p.m.