[GIS] How to process MODIS ndvi data using QGIS/GRASS/R

grassmodisndviqgisr

I have MODIS ndvi data (MODIS_Grid_16 days NDVI) from the iberian peninsula (3 tiles), from February of 2000 to August of 2012 (really big data). I want to know how to deal with this kind of files.
My final goal is to extract the ndvi value to points with a associated date, i.e., I have sequencial dated points and I want to know the value of ndvi to that date point.)

How do I (automatically) merge the 3 tiles that compose the iberian peninsula for each 16-days (2000-2012)?
(I think if I use R to identify each filename and use gdal merge, it might work, but maybe there's a simplier way)

How do I create a time series from it and extract the values associated?

Best Answer

You can use the "stack" or "brick" function(s) in the raster package to create a single raster object of your NDVI time-series. The names of each NDVI file will be retained in the object and the rasters will be held out-of-memory, making it memory safe.

You can then retrieve the raster values, associated with a point feature, across the series using the "extract" function. Here is a mock example:

require(raster)
require(rgdal)
require(sp)

setwd("C:/data")

# Read points
  pts <- readOGR(getwd(), "MyPoints")

# Create raster stack using wildcard in list.files
ndvi.files <- list.files(getwd, pattern="img$", full.names=FALSE)
  ndvi <- stack(ndvi.files)

# Extract point values and merge with sp point object 
pts@data <- data.frame(pts@data, extract(ndvi, pts) )
  str(pts@data)

After you have the ndvi values extracted, you could apply the date functionality in R to the names of the ndvi file names (retained in extract) associated with each column. In this way you can write functions to analyze the time-series. Also, keep in mind that you can apply functions to the raster stack itself using the "overlay" function.

Related Question