r - Does anyone know how to download TRMM 3B42 time series data? -


i'm trying download trmm 3b42 3-hour binary data given time span nasa ftp server.

there excellent code made florian detsch download daily product (here link: https://github.com/environmentalinformatics-marburg/rsenal/blob/master/r/downloadtrmm.r) included in github-only rsenal package. unfortunately not working 3-hour data.

i changed code:

downloadtrmm <- function(begin, end, dsn = ".", format = "%y-%m-%d.%h") {    ## transform 'begin' , 'end' 'date' object if necessary   if (!class(begin) == "date")     begin <- as.date(begin, format = format)    if (!class(end) == "date")     end <- as.date(end, format = format)    ## trmm ftp server   ch_url <-"ftp://disc2.nascom.nasa.gov/data/trmm/gridded/3b42_v7/"    ## loop on daily sequence   ls_fls_out <- lapply(seq(begin, end, 1), function(i) {      # year , julian day (name of corresponding folder)     tmp_ch_yr <- strftime(i, format = "%y%m")     #tmp_ch_dy <- strftime(i, format = "%j")      # trmm date format     tmp_dt <- strftime(i+1, format = "%y%m%d.%h")      # list files available on server     tmp_ch_url <- paste(ch_url, tmp_ch_yr, "", sep = "/")      tmp_ch_fls <- tmp_ch_fls_out <- character(2l)     (j in 1:2) {       tmp_ch_fls[j] <- paste0("3b42.", tmp_dt, "z.7.precipitation",                                ifelse(j == 1, ".bin"))        tmp_ch_fls[j] <- paste(tmp_ch_url, tmp_ch_fls[j], sep = "/")       tmp_ch_fls_out[j] <- paste(dsn, basename(tmp_ch_fls[j]), sep = "/")        download.file(tmp_ch_fls[j], tmp_ch_fls_out[j], mode = "wb")     }      # return data frame *.bin , *.xml filenames     tmp_id_xml <- grep("xml", tmp_ch_fls_out)     data.frame(bin = tmp_ch_fls_out[-tmp_id_xml],                 xml = tmp_ch_fls_out[tmp_id_xml],                 stringsasfactors = false)    })    ## join , return names of processed files   ch_fls_out <- do.call("rbind",ls_fls_out)   return(ch_fls_out) }  getwd()  setwd("c:/users/joaoreis/documents/bases_geograficas/trmm_3h/")  fls_trmm <- downloadtrmm(begin = "2008-01-01.00", end = "2008-01-05.00") fls_trmm 

but following error:

trying url 'ftp://disc2.nascom.nasa.gov/data/trmm/gridded/3b42_v7//200801//3b42.20080102.00z.7.precipitation.bin' error in download.file(tmp_ch_fls[j], tmp_ch_fls_out[j], mode = "wb") : cannot open url 'ftp://disc2.nascom.nasa.gov/data/trmm/gridded/3b42_v7//200801//3b42.20080102.00z.7.precipitation.bin' in addition: warning message: in download.file(tmp_ch_fls[j], tmp_ch_fls_out[j], mode = "wb") : internetopenurl failed: '' called from: download.file(tmp_ch_fls[j], tmp_ch_fls_out[j], mode = "wb")

does know how fix using r?

thanks!

as of commit 909f98a, have enabled automated retrieval of 3-hourly data ftp://disc3.nascom.nasa.gov/data/s4pa/trmm_l3. make sure have latest version of rsenal installed using

devtools::install_github("environmentalinformatics-marburg/rsenal") 

and have @ examples in ?downloadtrmm. now, function supports both character (requires 'format' argument passed on strptime) , posixlt input. example,

downloadtrmm(begin = "2015-01-01 12:00", end = "2015-01-03 12:00",               type = "3-hourly", format = "%y-%m-%d %h:%m") 

to download 3-hourly data 1-3 january 2015 (noon noon) should work fine.

note in contrast ftp server mentioned, data comes in .hdf format , rasterize method has not been implemented far, meaning have deal container files yourself. i'll try figure out more convenient regarding automated rasterization of data.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -