Compares values between two rasters based on a given distance measure.
Arguments
- x
An object of class SpatRaster (terra)
- y
An object of class SpatRaster (terra)
- dist_fun
Distance measure used. This function uses the
philentropy::distancefunction (runphilentropy::getDistMethods()to find possible distance measures),proxy::distin the background. It is also possible to use"dtw"(dynamic time warping)- ...
Additional arguments for
philentropy::dist_one_one,proxy::dist, ordtwclust::dtw_basic. Whendist_fun = "dtw"is used,ndimshould be set to specify how many dimension the input raster time-series has.
Examples
library(terra)
library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.2, PROJ 8.2.1; sf_use_s2() is TRUE
ta = rast(system.file("raster/ta_scaled.tif", package = "spquery"))
pr = rast(system.file("raster/pr_scaled.tif", package = "spquery"))
re = spq_compare(ta, pr, dist_fun = "jensen-shannon")
plot(re)