Learn R Programming

RGISTools (version 1.0.2)

varNDVI: Calculate the normalized difference vegetation index (NDVI)

Description

varNDVI computes the normalized difference vegetation index (NDVI) from the red an near-infrared (NIR) bands.

Usage

varNDVI(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 NDVI image in raster format.

Details

The normalized difference vegetation index (NDVI) is the most widely used index for monitoring vegetation dynamics. The NDVI reflects the vegetation vigour and it is closely related to the amount of photosynthetically active radiation absorbed rouse1972monitoringRGISTools. This function is used within ls7FolderToVar, ls8FolderToVar, modFolderToVar and senFolderToVar.

References

rouse1972monitoringRGISTools

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 NDVI image
img.mod.ndvi <- varNDVI(img.mod.red,img.mod.nir)
# plot the image
spplot(img.mod.ndvi,col.regions=rev(terrain.colors(20)))
# }

Run the code above in your browser using DataLab