MODIS (version 1.0.0)

getHdf: Create or Update Local Subset of Online MODIS Data Pool

Description

Create or update a local user-defined subset of the global MODIS grid data archive. Based on user-specific parameters the function checks in the local archive for available data and downloads missing data from the online MODIS data pool. When run in a schedule job, the function manage the continuous update of the local MODIS data archive.

Usage

# S4 method for character
getHdf(product, HdfName, begin = NULL, end = NULL,
  tileH = NULL, tileV = NULL, extent = NULL, collection = NULL,
  wait = 0.5, checkIntegrity = TRUE, forceDownload = TRUE, ...)

# S4 method for missing getHdf(HdfName, wait = 0.5, checkIntegrity = TRUE, ...)

Arguments

product

character. MODIS grid product to be downloaded, see getProduct. Use dot notation to address Terra and Aqua products (e.g. M.D13Q1).

HdfName

character vector or list. Full HDF file name(s) to download a small set of files. If specified, other file-related parameters (i.e., begin, end, collection, etc.) are ignored.

begin

character. Begin date of MODIS time series, see transDate for formatting.

end

character. End date, compatible with future dates for continuous updates via scheduled jobs.

tileH

numeric or character. Horizontal tile number(s), see getTile.

tileV

numeric or character. Vertical tile number(s), see tileH.

extent

See Details in getTile.

collection

character or integer. Desired MODIS product collection, see MODIS pages or getCollection for more information.

wait

numeric. Inserts a break (in seconds) after every internal call to download.file or getURL, which reduces the chance of FTP connection errors that frequently occur after many requests.

checkIntegrity

logical. If TRUE (default), the size of each downloaded file is checked. In case of inconsistencies, the function tries to re-download broken files.

forceDownload

logical. If TRUE (default), try to download data irrespective of whether online information could be retrieved via MODIS:::getStruc or not.

...

Arguments found in MODISoptions, sections 'STORAGE' and 'DOWNLOAD'.

Value

An invisible vector of downloaded data and paths.

References

MODIS data is obtained through the online Data Pool at the NASA Land Processes Distributed Active Archive Center (LP DAAC), USGS/Earth Resources Observation and Science (EROS) Center, Sioux Falls, South Dakota https://lpdaac.usgs.gov/get_data.

Examples

Run this code

# One or more specific file (no regular erpression allowed here)
a <- getHdf(HdfName = c("MYD11A1.A2009001.h18v04.006.2015363221538.hdf", 
                        "MYD11A1.A2009009.h18v04.006.2015364055036.hdf", 
                        "MYD11A1.A2009017.h18v04.006.2015364115403.hdf"))
a

# Get all MODIS Terra and Aqua M*D11A1 data from 1 December 2016 up to today
# (can be ran in a sceduled job for daily archive update)
b1 <- getHdf(product = "M.D11A1", begin = "2016.12.01", 
             tileH = 18:19, tileV = 4) 
b1               

# Same tiles with a 'list' extent
Austria <- list(xmax = 17.47, xmin = 9.2, ymin = 46.12, ymax = 49.3)
b2 <- getHdf(product = "M.D11A1", begin = "2016336", extent = Austria)
b2

# Using country boarders from 'mapdata' package
c <- getHdf(product = "M.D11A1", begin = "2016306", end = "2016335",
            extent = "Luxembourg")
c             
       
# Interactive selection of spatial extent, see getTile()
d <- getHdf(product = "M.D11A1", begin = "2016306", end = "2016307")
d


Run the code above in your browser using DataLab