grad_terra: Gradient of terra raster using bilinear interpolation

View source: R/raster_gradient.R

grad_terraR Documentation

Gradient of terra raster using bilinear interpolation

Description

Gradient of terra raster using bilinear interpolation

Usage

grad_terra(rast = NULL, pts, xgrid = NULL, ygrid = NULL, zmat = NULL)

Arguments

rast

SpatRast object

pts

Matrix with two columns (one for each coordinate)

xgrid

Grid of x values (if rast not provided)

ygrid

Grid of y values (if rast not provided)

zmat

Matrix of raster values (if rast not provided)

Details

The gradient has a closed form solution if bilinear interpolation is used, as described in Appendix C of Michelot (2019, PhD thesis). https://etheses.whiterose.ac.uk/23688/

Value

Matrix with same dimensions as pts, where the first column gives the gradient along the first dimension, and the second column along the second dimension.


TheoMichelot/utilTM documentation built on April 14, 2025, 12:52 p.m.