Learn R Programming

RGISTools (version 0.9.7)

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 reflex vegetation vigour and it is closed 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
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 NDVI image
ndvi <- varNDVI(red,nir)
# plot the image
spplot(ndvi,col.regions=rev(terrain.colors(20)))
# }

Run the code above in your browser using DataLab