# 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 MSAVI2 image
msavi2 <- varMSAVI2(red, nir)
# plot the image
spplot(msavi2,col.regions=rev(topo.colors(20)))
# }
Run the code above in your browser using DataLab