0

I am trying to download "MOD13A3" MODIS image using R script (http://r-gis.net/?q=ModisDownload) but each time it's ending in error. How to make it work ?

=================================================================================
setwd("D:/MODIS_Download_R")  
source('ModisDownload.R')  
library(raster)  
library(RCurl)  
modisProducts()  
x="MOD13A3"  
ModisDownload(x=x,h=c(25,26),v=c(06,06),dates=c('2013.01.01','2013.12.31'))

==================================================================================

Error in .modisHTTP(x, v = version) :
the http address does not exist! Version may be incorrect OR Server is down!

==================================================================================

I have kept ModisDownload.R, ModisLP and Rcurl in the same working directory.

17
  • The script as downloaded from r-gis works fine for me, with the parameters that you have provided. The LPDAAC servers, where the data is downloaded from, are at times a big sluggish, and a connection loss may lead to errors not accounted for in the script - this is pure guessing, as the script is functional for me and the error message that you indicate is not something that I have seen happen. Apr 28, 2015 at 11:39
  • Am I missing any library, or some other required R packages here ? I can only see the list of MODIS products, after that its end up into error. I have been doing this since last 2 days, so server problem is unlikely to happen. There is something wrong with the code or my approach.
    – dsbisht
    Apr 28, 2015 at 11:52
  • Libraries required are: raster, sp, bitops & RCurl all of which should be installed and loaded in the usual R way. Apr 28, 2015 at 12:11
  • > library(sp) > library(bitops) > library(raster) > library(RCurl) > library(rgdal) > setwd('D:/MODIS_Download_R') > source('ModisDownload.R') > modisProducts() Do you find any mistake here ?
    – dsbisht
    Apr 28, 2015 at 12:20
  • None, assuming that you have the 'ModisDownload.R' and 'ModisLP.RData' in the 'D:/MODIS_Download_R'-folder. Apr 28, 2015 at 12:23

2 Answers 2

1

Try the most recent ModisDownload() function from the rts package. Its last version allows for the needed NASA authentication prior to search and download. It also allows you to mosaic and to reproject the raw .hdr files downloaded (for the latter, you need to install the Modis Download Tool from NASA - link) to generate, say, a geotiff of all your tiles together. Try

devtools::install_github('babaknaimi/rts')  # must install the latest one
library(rts)

setNASAauth("yourNASAlogin", "yourNASApassword", update = T) # authenticates at NASA's server
> username and password are successfully updated...!

Then to download the required images:

ModisDownload(x='MOD13A3',h=c(25,26),v=c(06,06),dates=c('2013.01.01','2013.12.31'), mosaic=F, proj=F)
0

You need to check whether you can access FTP files from your institute server or not? I also faced similar problem, and found it was because of restriction in FTP accessing.

1
  • Yes, I too had this problem because of ftp restriction. I could resolve it after requesting the IT staff.
    – dsbisht
    Mar 27, 2016 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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