R/rasterEntropy.R

rasterEntropy.Rd

Shannon entropy is calculated for each pixel based on it's layer values. To be used with categorical / integer valued rasters.

rasterEntropy(img, ...)

SpatRaster

additional arguments passed to writeRaster

SpatRaster "entropy"

Entropy is calculated as -sum(p log(p)); p being the class frequency per pixel.

re <- rasterEntropy(rlogo) ggR(re, geom_raster = TRUE)