Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getAOD <- function(user = 'EarthDataUsername' # enter your user name
- ,pw = 'EarthDataPassword' # enter your password
- ,dir = 'OutputDestinationFolder'# enter a path to directory
- ,product = 'MCD19A2' # default product for MAIAC AOD
- ,date = '2018.08.28' # day of interest
- ,tile = 'h09v04' # your tile id (depends on your location)
- ,collection = "006") {
- # parse date and julian date for url building
- Date <- lubridate::ymd(date)
- julianDate <- paste0(lubridate::year(Date)
- ,lubridate::yday(Date))
- # extracts hdf files for a given tile across all observation times
- pattern <- paste0(product, ".A", julianDate, ".", tile, ".", collection, "*.hdf")
- # base url for wget
- url <- paste0("https://e4ftl01.cr.usgs.gov/MOTA/", product, ".", collection, "/", date, "/")
- # call wget from command line
- system(paste0("wget -r -A", pattern, " -L --user=", user
- ," --password=", pw
- ," --directory-prefix=", dir
- ," --load-cookies ~/.cookies --save-cookies ~/.cookies ", url))
- }
- getAOD(user = 'myUserName'
- ,pw = scan("./batteries.dppss", what = "")
- ,dir = "./test")
Add Comment
Please, Sign In to add comment