interpolateRaster {voluModel}R Documentation

Interpolate patchily sampled rasters

Description

Uses thin plate spline regression from fields package to interpolate missing two-dimensional raster values.

Usage

interpolateRaster(inputRaster, fast = FALSE, ...)

Arguments

inputRaster

An object of class SpatRaster

fast

A logical operator. Setting to TRUE triggers use of fastTps instead of Tps.

...

For any additional arguments passed to Tps or fastTps

Details

Missing data values from original raster are replaced with interpolated values. User has the option of choosing fastTps to speed calculation, but be advised that this is only an approximation of a true thin plate spline.

Value

An object of class raster

See Also

Tps, fastTps

Examples


library(terra)
library(fields)
# Create sample raster
r <- rast(ncol=50, nrow=50)
values(r) <- 1:2500

# Introduce a "hole"
values(r)[c(117:127, 167:177, 500:550)] <- NA
plot(r)

# Patch hole with interpolateRaster
interpolatedRaster <- interpolateRaster(r)
plot(interpolatedRaster)
fastInterp <- interpolateRaster(r, fast = TRUE, aRange = 3.0)
plot(fastInterp)



[Package voluModel version 0.2.1 Index]