Learn R Programming

RGISTools (version 0.9.7)

varMSAVI2: Calculate the modified soil-adjusted vegetation index (MSAVI2)

Description

varMSAVI2 computes the modified soil-adjusted vegetation index 2 (MSAVI2) from the near-infrared (NIR) and red bands.

Usage

varMSAVI2(red, nir)

Arguments

red

a raster with the red band of the capture.

nir

a raster with the NIR band of the capture.

Value

A MSAVI2 image in raster format.

Details

The modified soil adjusted vegetation index 2 (MSAVI2) is a vegetation indicator that removes the effect from background variations qi1994modifiedRGISTools. This function is used within ls7FolderToVar, ls8FolderToVar, modFolderToVar and senFolderToVar.

References

qi1994modifiedRGISTools

Examples

Run this code
# NOT RUN {
# path to the cropped and cutted MODIS images for the region of Navarre
img.dir <- system.file("ExNavarreVar", package = "RGISTools")
# list all the tif files
img.files <- list.files(img.dir, pattern="\\.tif$", recursive = TRUE, full.names = TRUE)
# print the MOD09 bands
getRGISToolsOpt("MOD09BANDS")
# select the red and NIR bands
red <- raster(img.files[1])
nir <- raster(img.files[2])
# calculate the MSAVI2 image
msavi2 <- varMSAVI2(red, nir)
# plot the image
spplot(msavi2,col.regions=rev(topo.colors(20)))
# }

Run the code above in your browser using DataLab