[G]radient-based [REC]ognition of Spatial Patterns in Environmental Data
Provides algorithms for detection of spatial patterns from oceanographic data using image processing methods based on Gradient Recognition.
Get the development version from github:
# install.packages("devtools")
# devtools::install_github("LuisLauM/grec")
install.packages("grec", repos = c('https://luislaum.r-universe.dev', 'https://cloud.r-project.org'))
Or install the CRAN version
install.packages("grec")
Next, we show an example of the use of getGradients function:
require(grec)
data(sst)
exampleSSTData <- list(x = sst$longitude,
y = sst$latitude,
z = sst$sst[,,1])
data(chl)
exampleChlData <- list(x = chl$longitude,
y = chl$latitude,
z = chl$chlorophyll[,,1])
# Simple application (over a XYZ list)
out_sst <- getGradients(x = exampleSSTData)
out_chl <- getGradients(x = exampleChlData)
# External transformation for chl data
out_chl$z <- log10(out_chl$z)
par(mfrow = c(2, 2), mar = rep(0, 4), oma = rep(0, 4))
image(exampleSSTData, col = colPalette, axes = FALSE)
mtext(text = "Original SST", side = 3, line = -2, adj = 0.99, cex = 1.2)
image(out_sst, col = colPalette, axes = FALSE)
mtext(text = "SST gradient", side = 3, line = -2, adj = 0.99, cex = 1.2)
image(exampleChlData, col = colPalette, axes = FALSE)
mtext(text = "Original Chlorophyll", side = 3, line = -2, adj = 0.99, cex = 1.2)
image(out_chl, col = colPalette, axes = FALSE)
mtext(text = "Chlorophyll gradient\n(log scale)", side = 3, line = -4, adj = 0.99,
cex = 1.2)
getGradients method for SpatRaster class inputs.getGradients method for SpatRaster class inputs.detectFronts function to getGradients. However, for backwards compatibility, detectFronts will still be available until v2.0.0.getGradients: Agenbag-1 and Agenbag-2.ConvolNormalization = FALSE by default now in detectFronts function.SpatRast (from terra package) objects.array objects.ConvolNormalization argument is now set as FALSE by default in detectFronts function.ConvolNormalization argument and enable normalization of convolutions as default.finalSmooth and control arguments detectFronts were deleted.extraParams function were deleted. Now, available advanced arguments will be showed in help.detectFronts were updated.detectFronts function has the method argument, using by default the Belkin & O'Reilly (2009) algorithm.grecExData).detectFronts algorithm works internally.fromDetection to detectFronts.detectFronts function.thresholds argument has been replaced by qLimits. Check help of detectFronts function for details.detectFronts function, the final smooth application is optional now, controling by finalSmooth argument.detectFronts is a method for classes: matrix, array and RasterLayer.