1

I'm new to using MODIS data, and have been trying to set up a a way to use the HDF files produced by MODIS on R. I had trouble with gdal (could only download the package through system dialog), and MODIS (had to install directly from tar.gz saved to desktop) packages, but now have run into a problem I can't quite get past. I've been trying to use the MODIS package in R, as directed by the tutorial: https://conservationecology.wordpress.com/2014/08/11/bulk-downloading-and-analysing-modis-data-in-r/

The code so far is as follows:

library(MODIS)
library(rgdal)
dates <- as.POSIXct( as.Date(c("01/05/2014", "31/05/2014"), format = "%d/%m/%Y"))
dates2 <- transDate(dates[1], dates[2]) 
h = "21"
v = "09"
product <- "MOD13Q1"
runGdal(product = product, begin = dates2$beginDOY, end = dates2$endDOY, tileH = h, tileV = v,)

on running the last line I get the error

########################
outProj          =  asIn 
pixelSize        =  asIn 
resamplingType   =  near 
Output directory =  /Users/Mapes/MODIS_ARC/PROCESSED/MOD13Q1.006_20160403221952  (no 'job' name specified, generated (date/time based))
########################
sh: gdalinfo: command not found
Error in system(paste("gdalinfo ", HdfName, sep = ""), intern = TRUE) : 
error in running command

so that when trying the next command:

vi <- preStack(path="/Users/Mapes/MODIS_ARC/PROCESSED/MOD13Q1.005_20140810192530/", pattern="*_EVI.tif$")

the error:

No files found!

appears.

Checking MODIS:::checkTools("GDAL") only shows

Checking availabillity of GDAL:
OK, GDAL 1.11.4, released 2016/01/25 found!

and MODSOptions() outputs:

To install all required and suggested packages run:
setRepositories() # activate CRAN, R-forge, and Omegahat and then: 
install.packages(c(' ptw '),dependencies=TRUE)

'MRT_HOME' not set/found! MRT is NOT enabled! See: 'https://lpdaac.usgs.gov/tools/modis_reprojection_tool'

STORAGE:
_______________
localArcPath : /Users/Mapes/MODIS_ARC 
outDirPath   : /Users/Mapes/MODIS_ARC/PROCESSED 


DOWNLOAD:
_______________
MODISserverOrder : LPDAAC, LAADS 
dlmethod         : auto 
stubbornness     : high 


PROCESSING:
_______________
GDAL           : GDAL 1.11.4, released 2016/01/25 
MRT            : Not available. Use 'MODIS:::checkTools('MRT')' for more information! 
pixelSize      : asIn 
outProj        : asIn 
resamplingType : NN 
dataFormat     : GTiff 


DEPENDENCIES:
_______________


> 

Is there something I'm missing? I'm still not quite sure why the runGdal command is not properly processing the HDF file into the processed images, or why the gdalinfo command is not found.

  • Indeed, this seems to be related with Mac OS. I tested it on R version 3.2.4 Revised (2016-03-16 r70336), Platform: x86_64-pc-linux-gnu (64-bit), Running under: Ubuntu 14.04.4 LTS and everything works as expected. Could you please include the output of sessionInfo? – fdetsch Apr 4 '16 at 7:42
  • @fdetsch Sure thing, here is the session info: > sessionInfo() R version 3.2.4 (2016-03-10) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.11.3 (El Capitan) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_3.2.4 – Andy Apr 4 '16 at 16:21

Your Answer

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

Browse other questions tagged or ask your own question.