varNDWI | R Documentation |
varNDWI
Calculate the normalized difference water index (NDWI) from
the green and near-infrared (NIR) bands.
varNDWI(green, nir)
green |
a |
nir |
a |
The normalized difference water index (NDWI) is a ratio between the green
and near-infrared bands of the spectrum that was developed to detect open
water areas and minimize the influence of the soil and vegetation variations
\insertCitemcfeeters1996useRGISTools. This function is used within
ls7FolderToVar
, ls8FolderToVar
,
modFolderToVar
and senFolderToVar
.
A NDWI image in raster
format.
mcfeeters1996useRGISTools
# 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 green and NIR bands img.mod.green <- raster(files.mod[4]) img.mod.nir <- raster(files.mod[2]) # calculate the NDWI image img.mod.ndwi <- varNDWI(img.mod.green,img.mod.nir) # plot the image spplot(img.mod.ndwi,col.regions=rev(rainbow(20)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.