# 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