# 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 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)))
# }
Run the code above in your browser using DataLab