# \donttest{
library(terra)
r <- rast(nrows=500, ncols=500, xmin=571823, xmax=616763,
ymin=4423540, ymax=4453690)
crs(r) <- "epsg:9001"
r[] <- runif(ncell(r), 1000, 2500)
# Positive values so, can apply any transformation
for( i in c("norm", "rstd", "std", "stretch", "nl", "slog", "sr")) {
print( raster.transformation(r, trans = i) )
}
# Negative values so, can't transform using "nl", "slog" or "sr"
r[] <- runif(ncell(r), -1, 1)
for( i in c("norm", "rstd", "std", "stretch", "nl", "slog", "sr")) {
try( print( raster.transformation(r, trans = i) ) )
}
# }
Run the code above in your browser using DataLab