Boltzmann entropy (also called configurational entropy) has beenrecently adopted to analyze entropy of landscape gradients (Gao etal. (2017, 2018, 2019)). The goal ofbelg is to providean efficient C++ implementation of this method in R. It also extend theoriginal idea by allowing calculations on data with missing values(Nowosad and Gao (2020)).
You can install the released version of belg fromCRAN with:
install.packages("belg")And the development version fromGitHub with:
# install.packages("remotes")remotes::install_github("r-spatialecology/belg")As an example, we use two rasters -land_gradient1representing a complex landscape andland_gradient2representing a simple landscape:
library(raster)library(belg)land_gradient1=raster(system.file("raster/land_gradient1.tif",package ="belg"))land_gradient2=raster(system.file("raster/land_gradient2.tif",package ="belg"))plot(stack(land_gradient1, land_gradient2))
The main function in this package,get_boltzmann(),calculates the Boltzmann entropy of a landscape gradient:
get_boltzmann(land_gradient1)#> [1] 188772.5get_boltzmann(land_gradient2)#> [1] 121875.2This function accepts aSpatRaster,stars,RasterLayer,RasterStack,RasterBrick,matrix, orarrayobject as an input. It allows for calculation of the relative (therelative argument equal toTRUE) and absoluteBoltzmann entropy of a landscape gradient. As a default, it uses alogarithm of base 10 (log10), howeverlog andlog2 are also available options for thebaseargument.
get_boltzmann(land_gradient1,base ="log")#> [1] 434664.7get_boltzmann(land_gradient1,relative =TRUE)#> [1] 137645.4get_boltzmann(land_gradient1,base ="log2",relative =TRUE)#> [1] 457248.1Two methods of calculating the Boltzmann entropy of a landscapegradient are available:"hierarchy" (default) for thehierarchy-based method (Gao et al., 2017) or"aggregation"for the aggregation-based method (Gao et al., 2019). Theaggregation-based method requires that the number of rows and columns inthe input data must be a multiple of 2.
get_boltzmann(land_gradient1,method ="aggregation")#> [1] 188772.5get_boltzmann(land_gradient1,relative =TRUE,method ="aggregation")#> [1] 137645.4More examples can be find athttps://github.com/Nowosad/belg-examples.