For my PhD, I have been downloading MODIS MOD13Q1 v006 product from 2001 to 2015 using the bulk download method. At this time, I had reference data covering this period and used TIMESAT to derive LSP for comparison with the validation data.

Two years later, I wanted to update my MODIS database to build longer time series. I was curious about the recently published R package MODIS and decided trying this one for my task. Since the OS on my computer was recently updated, I was still missing data packages like MRT and GDAL. Anyway, MODIS data is downloading while I am busy installing missing software.

Here is my code:

# Install and load MODIS R package
install.packages("MODIS")
library("MODIS", lib.loc="~/R/win-library/3.4")

# Set target folder for downloaded MODIS HDF files and MODIS data server
MODISoptions(localArcPath = "D:/04_MODIS/MODIS_rawdata/MOD13Q1_h18v03_h18v04_2016-2017_C6/",
             MODISserverOrder = c("LAADS", "LPDAAC"))

# download data from server
getHdf(product="MOD13Q1", begin = "2016001", tileH=18, tileV=3, checkIntegrity = FALSE) 

 

By running getHdf(…, checkIntegrity = FALSE), you can avoid the Error in !out[a] : invalid argument type.

Thanks to the MODIS developer team for making life so easy!

%d bloggers like this: