[R-sig-Geo] ModisDownload

Babak Naimi naimi at itc.nl
Sat Oct 29 02:36:04 CEST 2011


Dear Thiago,

I checked your command, and it works fine. As Steve said, your RCurl might be old. However, I changed that line based on Matteo's suggestion,  to avoid the server connection error, and new version is uploaded on the website.

Best wishes,
Babak

-----Original Message-----
From: Thiago Veloso [mailto:thi_veloso at yahoo.com.br] 
Sent: Friday, October 28, 2011 2:43 PM
To: 'r-sig-geo at r-project.org'; Babak Naimi
Subject: Re: [R-sig-Geo] ModisDownload

  Dear Barak,

  If you are also accepting suggestions about errors, please let me share my experience with your script. I have received an error which appears to be related to a argument of package RCurl. Below, please take a look at my attempt to use your script:

> setwd("/Users/thiago/Downloads/MODIS/images/")
> source("/Users/thiago/Downloads/MODIS/ModisDownload.R")
> GPP <- "ftp://e4ftl01.cr.usgs.gov/MODIS_Composites/MOLT/MOD17A2.005/"
> MRT <- "/Applications/MRT/bin/"
> library(RCurl)
Loading required package: bitops
> library(raster)
Loading required package: sp
raster version 1.9-32 (24-October-2011)
> ModisDownload(FTP=GPP,h=c(10,14),v=c(7,14),dates=c("2010.01.01","2010.12.31"),mosaic=F,proj=F)
Error in download.file(url = paste(FTP, "/", dirs[i], "/", ModisName,  : 
  cannot open URL 'ftp://e4ftl01.cr.usgs.gov/MODIS_Composites/MOLT/MOD17A2.005//2010.01.01/-rw-r--r--  1 90  395831 Feb  4  2010 MOD17A2.A2010001.h10v07.005.2010035143552.hdf'
In addition: Warning message:
In mapCurlOptNames(names(.els), asNames = TRUE) :
  Unrecognized CURL options: ftplistonly

  Looking at the script, this line seems to be the source of the error:

  getlist <- strsplit(getURL(paste(FTP,"/",dirs[i], "/", sep=""), .opts=curlOptions(ftplistonly=TRUE)), "\r*\n")[[1]]

  And checking the arguments of curlOptions, "ftplistonly" doesn't appear to be available:

  > listCurlOptions()
  [1] "autoreferer"                "buffersize"                 "cainfo"                     "capath"                    
  [5] "closepolicy"                "connect.only"               "connecttimeout"             "connecttimeout.ms"         
  [9] "conv.from.network.function" "conv.from.utf8.function"    "conv.to.network.function"   "cookie"                    
 [13] "cookiefile"                 "cookiejar"                  "cookielist"                 "cookiesession"             
 [17] "crlf"                       "customrequest"              "debugdata"                  "debugfunction"             
 [21] "dns.cache.timeout"          "dns.use.global.cache"       "egdsocket"                  "encoding"                  
 [25] "errorbuffer"                "failonerror"                "file"                       "filetime"                  
 [29] "followlocation"             "forbid.reuse"               "fresh.connect"              "ftp.account"               
 [33] "ftp.alternative.to.user"    "ftp.create.missing.dirs"    "ftp.filemethod"             "ftp.response.timeout"      
 [37] "ftp.skip.pasv.ip"           "ftp.ssl.ccc"                "ftp.use.eprt"               "ftp.use.epsv"              
 [41] "ftpport"                    "ftpsslauth"                 "header"                     "headerdata"                
 [45] "headerfunction"             "http.content.decoding"      "http.transfer.decoding"     "http.version"              
 [49] "http200aliases"             "httpauth"                   "httpget"                    "httpheader"                
 [53] "httppost"                   "httpproxytunnel"            "ignore.content.length"      "infile"                    
 [57] "infilesize"                 "infilesize.large"           "interface"                  "ioctldata"                 
 [61] "ioctlfunction"              "ipresolve"                  "localport"                  "localportrange"            
 [65] "low.speed.limit"            "low.speed.time"             "max.recv.speed.large"       "max.send.speed.large"      
 [69] "maxconnects"                "maxfilesize"                "maxfilesize.large"          "maxredirs"                 
 [73] "netrc"                      "netrc.file"                 "nobody"                     "noprogress"                
 [77] "nosignal"                   "port"                       "post"                       "postfields"                
 [81] "postfieldsize"              "postfieldsize.large"        "postquote"                  "prequote"                  
 [85] "private"                    "progressdata"               "progressfunction"           "proxy"                     
 [89] "proxyauth"                  "proxyport"                  "proxytype"                  "proxyuserpwd"              
 [93] "put"                        "quote"                      "random.file"                "range"                     
 [97] "readdata"                   "readfunction"               "referer"                    "resume.from"               
[101] "resume.from.large"          "share"                      "sockoptdata"                "sockoptfunction"           
[105] "ssh.auth.types"             "ssh.private.keyfile"        "ssh.public.keyfile"         "ssl.cipher.list"           
[109] "ssl.ctx.data"               "ssl.ctx.function"           "ssl.sessionid.cache"        "ssl.verifyhost"            
[113] "ssl.verifypeer"             "sslcert"                    "sslcerttype"                "sslengine"                 
[117] "sslengine.default"          "sslkey"                     "sslkeytype"                 "sslversion"                
[121] "stderr"                     "tcp.nodelay"                "telnetoptions"              "timecondition"             
[125] "timeout"                    "timeout.ms"                 "timevalue"                  "transfertext"              
[129] "unrestricted.auth"          "upload"                     "url"                        "useragent"                 
[133] "userpwd"                    "verbose"                    "writedata"                  "writefunction"             
[137] "writeheader"                "writeinfo"                 

  As usual, output of sessionInfo:

> sessionInfo()
R version 2.13.2 (2011-09-30)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] raster_1.9-32  sp_0.9-91      RCurl_1.6-10   bitops_1.0-4.1

loaded via a namespace (and not attached):
[1] grid_2.13.2     lattice_0.19-33

  Any tips?

  Thank you and best wishes,

  Thiago.  

--- On Mon, 24/10/11, Babak Naimi <naimi at itc.nl> wrote:

> From: Babak Naimi <naimi at itc.nl>
> Subject: [R-sig-Geo] ModisDownload
> To: "'r-sig-geo at r-project.org'" <r-sig-geo at r-project.org>
> Date: Monday, 24 October, 2011, 13:06
> Dear list,
> 
> This might be interesting for you. I implemented an R
> function to automate download, mosaic, and projecting of
> MODIS images. In the following link you will find the
> instruction and details on how to use this function:
> http://r-gis.net/?q=ModisDownload
> 
> Thanks Tom Hengel, as his script on http://spatial-analyst.net made the main core of the
> ModisDownload function.
> 
> Best regards,
> 
> Babak Naimi
> PhD Candidate, Natural Resources Department,
> Faculty of Geo-Information Science and Earth Observations
> (ITC), University of Twente, 
> P.O. Box 217, 7500 AE Enschede, The Netherlands
> Tel: +31 53 4874212
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 


More information about the R-sig-Geo mailing list