Learn R Programming

RGISTools (version 1.0.2)

varSAVI: Calculates the soil-adjusted vegetation index (SAVI)

Description

varSAVI Calculate the soil-adjusted vegetation index (SAVI) from the red and near-infrared (NIR) bands.

Usage

varSAVI(red, nir, L = 0.5, scfun = function(r) {
    r
})

Arguments

red

a raster with the red band of the capture.

nir

a raster with the NIR band of the capture.

L

a constant to remove soil background effect. A value of 0.5 is recommended in the literature.

scfun

a function to re-scale the original pixel values into reflectance (0-1).

Value

A SAVI image in raster format.

Details

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.

References

huete1988soilRGISTools

Examples

Run this code
# 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