1

When i'm running my MODIS Download R script on my Windows, i'll get this error :

############################
Remote connection failed! Re-try: 49 
Getting file from: LPDAAC 
############################

After this, the script crashes because it tried to do gdalinfo on an inexisting image. I'm just doing getHdf function on LPDAAC servers using my EarthExplorer Username and Password. I'll get this error on 3 different Windows PC, my personnal computer, university computer and a friend pc so on three different networks. My code runs perfectly on my Mac, do you have any idea ?

MODISoptions(gdalPath = gdalPath, MODISserverOrder = "LPDAAC")

#We have to log in into lpdaac servers using NASAs ID and password
lpdaacLogin(server = "LPDAAC")

image <- getHdf(product = "MOD09GA", begin = toString(currentDate), end = toString(currentDate), extent = c(longMin, longMax, latMin, latMax))

Here is my ModisOptions() :

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

 STORAGE:
 _______________
 localArcPath : C:/Users/Romain/AppData/Local/Temp/RtmpGUSr8w/MODIS_ARC/ 
 outDirPath   : 
 C:/Users/Romain/AppData/Local/Temp/RtmpGUSr8w/MODIS_ARC/PROCESSED/ 


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


 PROCESSING:
 _______________
 GDAL           : GDAL 2.2.4, released 2018/03/19 
 MRT            : Not available. Use 'MODIS:::checkTools('MRT')' for more 
 information! 
 pixelSize      : asIn 
 outProj        : asIn 
 resamplingType : NN 
 dataFormat     : GTiff 

Note : i choosed LPDAAC because LAADS FTP servers are down since the 20 april 2018.

  • Try out the MODIStsp package for downloading and pre-processing MODIS data (github.com/lbusett/MODIStsp). Definitely the most robust package I have work with for this kind of task. – Kamo May 19 '18 at 14:28
1

The MODIS package received a comprehensive update (starting with version 1.1.3) which

  • covers the deprecation of LAADS FTP and its migration to HTTPS
  • and fixes known download issues related to the automated download from LP DAAC and the newly introduced NSIDC (MODIS snow and ice products) servers.

See NEWS for a detailed change log. Using an arbitrary date range and tile index together with MODIS_1.1.3, your code now works as expected.

library(MODIS)

# set MODIS options
MODISoptions(MODISserverOrder = c("LAADS", "LPDAAC"), quiet = FALSE)

# download data
image <- getHdf(product = "MOD09GA"
                , begin = "2018.09.01", end = "2018.09.02"
                , tileH = 21, tileV = 8) # or use 'extent' here
image
# $`MOD09GA.006`
# [1] "../MODIS_ARC/MODIS/MOD09GA.006/2018.09.03/MOD09GA.A2018246.h21v08.006.2018248032823.hdf"
# [2] "../MODIS_ARC/MODIS/MOD09GA.006/2018.09.04/MOD09GA.A2018247.h21v08.006.2018249033342.hdf"

Some additional remarks:

  • LAADS does not require Earthdata login credentials, yet (as of 2018-09-12). When working with LP DAAC or NSIDC instead, make sure to run EarthdataLogin() (replacement function for lpdaacLogin(), which is now deprecated) before calling getHdf() or runGdal().
  • Your current target folder for file download is tempdir(), which is the default setting; this directory will be deleted after your current R session has ended, and hence, all files therein will be lost. Run MODISoptions(localArcPath = "some/data/path") in order to make downloaded .hdf files permanently available.
  • See my answer to Download MODIS/MCD19A2 AOD product with R for some additional input.

Your Answer

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

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