-1

Is there a way to calculate mean annual NDVI and mean annual EVI from the time series MODIS images (2000 - 2016). I have gridded data downloaded to the local drive. Planning to use R for this work.

  • 1
    I don't think any answer beyond "yes, compute the mean for the data within each year" is going to be useful to you specifically unless you tell us more about the data you've downloaded - like the filenames, formats, etc etc etc. Have you read them into rasters or raster stacks? – Spacedman May 23 '17 at 6:49
4

As described in a previous thread, the most accurate way to create temporal composites from raw 16-day MODIS vegetation indices (VI) layers is to make use of the accompanying 'composite_day_of_the_year' (DOY) scientific data sets. Since the last image from a particular year (eg 2015) might already contain some pixels from the following year (eg 2016), such an approach ensures that only valid pixels (ie actually originating from 2015) are included in the calculation.

The creation of yearly value composites has been made available through MODIS_1.1.0. Simply install the package and have a look at the 'Examples' section in ?temporalComposite. The function requires you to specify VI and DOY layers as either 'character' file names or 'Raster*' objects. Starting from data download and extraction), the creation of yearly NDVI (and similarly EVI) mean value composites would go as follows:

# devtools::install_github("MatMatt/MODIS", ref = "develop")
library(MODIS)
library(mapview)

## download and extract sample data
frc <- as(subset(franconia, district == "Mittelfranken"), "Spatial")
tfs <- runGdal("MOD13A1", begin = "2015001", end = "2016366", extent = frc,
            job = "temporalComposite", SDSstring = "100000000010")

## separate ndvi and doy layers
ndvi <- sapply(tfs[[1]], "[[", 1)
cdoy <- sapply(tfs[[1]], "[[", 2)

## create yearly mean value composites
ymvc <- temporalComposite(ndvi, cdoy, interval = "year", fun = mean)

spplot

  • devtools::install_github("MatMatt/MODIS", ref = "mapedit") fails with: Installation failed: 404: Not Found – R.M. Jan 25 '18 at 14:23
  • @R.M. Thanks for pointing this out, I've edited the answer accordingly. – fdetsch Jan 25 '18 at 14:29
1

Using the raster package, if you already have a RasterBrick or RasterStack with time written to the z dimension (see setZ), you can simply use zApply.

library(raster)
library(lubridate)

zApply(b, by = year, fun = mean)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.