View source: R/interpolateRaster.R
interpolateRaster | R Documentation |
Uses thin plate spline regression from
fields
package to interpolate missing two-dimensional
raster values.
interpolateRaster(inputRaster, fast = FALSE, ...)
inputRaster |
An object of class |
fast |
A logical operator. Setting to |
... |
For any additional arguments passed to |
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.
An object of class raster
Tps
, fastTps
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.