Performs a moving window correlation between two rasters
Usage
rasterCorrelation(x, y, s = 3, type = "pearson")
Value
A terra SpatRaster class object
Arguments
x
A terra SpatRaster class object for x
y
A terra SpatRasterclass object for y
s
Scale of window. Can be a single value, two
values for uneven window or a custom matrix.
Must be odd number (eg., s=3, for 3x3 window or
s=c(3,5) for 3 x 5 window)
type
Type of output, options are: "pearson", "spearman",
"covariance"
# \donttest{library(terra)
r <- rast(system.file("ex/logo.tif", package="terra"))
x <- r[[1]]
y <- r[[3]]
r.cor <- rasterCorrelation(x, y, s = 5, type = "spearman")
plot(r.cor)
# }