varSAVI
Calculate the soil-adjusted vegetation index (SAVI) from the
red and near-infrared (NIR) bands.
varSAVI(red, nir, L = 0.5, scfun = function(r) {
r
})
a raster
with the red band of the capture.
a raster
with the NIR band of the capture.
a constant to remove soil background effect. A value of 0.5 is recommended in the literature.
a function to re-scale the original pixel values into reflectance (0-1).
A SAVI image in raster
format.
The soil adjusted vegetation index (SAVI) is an indicator engineered to remove
the influence of the soil background effect huete1988soilRGISTools.
This function is used within ls7FolderToVar
,
ls8FolderToVar
, modFolderToVar
and
senFolderToVar
.
huete1988soilRGISTools
# NOT RUN {
# path to the cropped and cutted MODIS images for the region of Navarre
wdir <- system.file("ExNavarreVar", package = "RGISTools")
# list all the tif files
files.mod <- list.files(wdir, pattern="\\.tif$", recursive = TRUE, full.names = TRUE)
# print the MOD09 bands
getRGISToolsOpt("MOD09BANDS")
# select the red and NIR bands
img.mod.red <- raster(files.mod[1])
img.mod.nir <- raster(files.mod[2])
# calculate the SAVI image
img.mod.savi <- varSAVI(img.mod.red,img.mod.nir,scfun=getRGISToolsOpt("MOD09SCL"))
# plot the image
spplot(img.mod.savi,col.regions=rev(topo.colors(20)))
# }
Run the code above in your browser using DataLab