I am having problems with ModisDownload recently that I have not had when using it so far. I dowloaded, reprojected and mosaiced modis images about two months ago successfully, despite some errors during downloading, which I assumed were due to the NASA servers, reported sluggish at times.
However, for the last week it is not working in a new way... I get no errors during downloading, but the .hdf files downloaded all are size 520 bytes, which is clearly wrong. MRT is then unable to open the .hdf files downloaded to reproject, leading to an error.
I have not changed anything to my configuration or my internet connection (from home, so no institution limitations on ftp access), and tried updating packages already. Has anybody been experiencing the same error recently? Has something changed?
The code I have been using is below and is straightforward. I decomposed the historic download in loops because ModisDownload downloads first before reprojecting and mosaicing. I wanted avoid restarting from scratch every time there would be a downloading error. I tried with a product name rather than the full http address, but I get the same error.
setwd(paste0("/media/olivier/olivier_ext/gedata_current/jde_coffee/MODIS/",state.nm,"/raw_data"))
FTP <- "http://e4ftl01.cr.usgs.gov/MOLT/MOD13Q1.005/"
years <- c(2015:2006)
start <- c("01.01","07.01")
end <- c("06.30","12.31")
for (i in 1:length(years)) {
for (j in 1:length(start)) {
ModisDownload(x=FTP,h=c(13,14),v=c(10,11),dates=c(paste0(years[i],".",start[j]),paste0(years[i],".",end[j])),
mosaic=T,MRTpath='/home/olivier/MRT/bin', #'C:/modis_MRT/bin'
UL=c(state_ex@xmin,state_ex@ymax),LR=c(state_ex@xmax,state_ex@ymin),
bands_subset="1 1 1 1 1 1 1 0 0 0 1 0",
proj=T,proj_type="GEO",proj_params="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",datum="WGS84",pixel_size=0.002259948,
delete=T)
}
}
I am right now switching to downloading by hand and then using reprojectHDF and mosaicHDF, but it is quite inconvenient for regular upadtes with new MODIS images.
Answer
The problem was related to the new policy by NASA that an authentication is needed for any download from their data portals. The ModisDownload function in the rts package is now updated, and supports the new changes. Follow the help page of the function in the new version of the rts package, to see how you can set your username and password on your machine using setNASAauth function (only first time), and then use the ModisDownload function to download the images as before.
No comments:
Post a Comment