使用runGdal下载MODIS图像时出错

时间:2018-09-07 10:28:28

标签: r gdal

所有人〜

我在R中徒劳尝试下载我感兴趣的地方的MODIS图像,但是,我总是遇到相同的错误。有人可以帮我吗?

预先感谢〜

代码如下:

> product <- "MOD13Q1"
> h = 26
> v = 4
> getT <- getTile(tileH = 26, tileV = 4)
> runGdal(job = "NDVI", product = product, begin = dates2$beginDOY, end = dates2$endDOY, extent = getT)
No collection specified, getting the newest for MOD13Q1 
########################
outProj          =  asIn 
pixelSize        =  asIn 
resamplingType   =  near 
Output Directory =  D:/NDVI_Processed//Dali 
########################
Downloading structure on 'LAADS' for: MOD13Q1.006
Downloading structure from 'LAADS'-server! Try: 1 
Downloading structure of '0' from 'LAADS'-server.                        

Error in if (FtpDayDirs[1] == FALSE) { : 
  missing value where TRUE/FALSE needed

在发生此错误之前,我花了一些时间解决rgdal问题,并通过安装OSGeo4W并指定了rgdal库来解决了该问题。这是我的sessionInfo:

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 
[2] LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

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

other attached packages:
[1] MODIS_1.1.2   raster_2.6-7  mapdata_2.3.0 maps_3.3.0    rgdal_1.3-4  
[6] sp_1.3-1     

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18    compiler_3.5.1  later_0.7.3     nloptr_1.0.4   
 [5] bitops_1.0-6    class_7.3-14    tools_3.5.1     digest_0.6.16  
 [9] memoise_1.1.0   lattice_0.20-35 shiny_1.1.0     DBI_1.0.0      
[13] parallel_3.5.1  spData_0.2.9.3  e1071_1.7-0     withr_2.1.1    
[17] rgeos_0.3-28    devtools_1.13.6 classInt_0.2-3  mapedit_0.3.2  
[21] grid_3.5.1      sf_0.6-3        R6_2.2.2        ptw_1.9-13     
[25] XML_3.98-1.16   foreign_0.8-70  magrittr_1.5    units_0.6-0    
[29] promises_1.0.1  htmltools_0.3.6 maptools_0.9-3  mime_0.5       
[33] xtable_1.8-3    httpuv_1.4.5    RCurl_1.95-4.11

而且,我的MODIS选项

> MODISoptions()

STORAGE:
_______________
localArcPath : D:/NDVI/ 
outDirPath   : D:/NDVI_Processed/ 


DOWNLOAD:
_______________
MODISserverOrder : LAADS, LPDAAC 
dlmethod         : auto 
stubbornness     : high 
wait             : 0.5 
quiet            : FALSE 


PROCESSING:
_______________
GDAL           : GDAL 2.2.4, released 2018/03/19 
MRT            : Version 4.1 (March 2011) 
pixelSize      : asIn 
outProj        : asIn 
resamplingType : NN 
dataFormat     : GTiff 

1 个答案:

答案 0 :(得分:1)

请使用CRAN提供的 MODIS_1.1.3 (或更高版本)再试一次吗?该软件包收到了全面的更新,特别解决了与从LAADS和LP DAAC下载数据有关的问题(后者需要规范Earthdata登录凭据)。使用此软件包版本,您的代码可以在我的计算机上流畅运行。

library(MODIS)

getT = getTile(tileH = 26, tileV = 4)
tfs = runGdal(job = "NDVI", product = "MOD13Q1", begin = "2000.02.18", end = "2000.03.10", extent = getT)
tfs
# $`MOD13Q1.006`
# $`MOD13Q1.006`$`2000-02-18`
# [1] ".../MODIS_ARC/PROCES~1/NDVI/MOD13Q1.A2000049.250m_16_days_NDVI.tif"                     
# [2] ".../MODIS_ARC/PROCES~1/NDVI/MOD13Q1.A2000049.250m_16_days_EVI.tif"                      
# (etc.)       
# 
# $`MOD13Q1.006`$`2000-03-05`
# [1] ".../MODIS_ARC/PROCES~1/NDVI/MOD13Q1.A2000065.250m_16_days_NDVI.tif"                     
# [2] ".../MODIS_ARC/PROCES~1/NDVI/MOD13Q1.A2000065.250m_16_days_EVI.tif"                      
# (etc.)

也请查看我对以下SO问题的回答

,其中包括可能与您相关的更多详细信息(为避免重复,此处特意省略)。