View source: R/modDownSearch.R
modDownSearch | R Documentation |
modDownSearch
searches and downloads MODIS images concerning a particular
location and time interval from the ‘EarthData’ repository. Images are
saved as GTiff files in the AppRoot
directory.
modDownSearch( product, username, password, AppRoot, collection = 6, nattempts = 5, verbose = FALSE, extract.tif = FALSE, ... )
product |
a |
username |
NASA's ‘EarthData’ username. |
password |
NASA's ‘EarthData’ password. |
AppRoot |
the directory to save the outcoming time series. |
collection |
MODIS collection, by default 6. |
nattempts |
the number of attempts to download an image in case it becomes corrupted. |
verbose |
logical argument. If |
extract.tif |
logical argument. If |
... |
arguments for nested functions:
|
modDownSearch
searches via
NASA’s Common Metadata Repository
and downloads the imagert from the
‘EarthData’ web service
to download the imagery. The catalogue of MODIS products can be found
here.
The catalogue shows detailed information about the products and their short
names. By the time ‘RGISTools’ is released, NASA carries out the maintenance
of its website on Wednesdays, which may cause an error when connecting to
their server. You can get your ‘EarthData’ credentials
here.
this function does not return anything. It saves the imagery as
'tar.gz’ (and GTiff files) in a folder called 'raw’ ('tif’) in the
AppRoot
directory.
## Not run: # load a spatial polygon object of Navarre data(ex.navarre) wdir <- file.path(tempdir(),"Path_for_downloading_folder") print(src) modDownSearch(product = "MOD09GA", startDate = as.Date("01-01-2018", "%d-%m-%Y"), endDate = as.Date("03-01-2018", "%d-%m-%Y"), username = "username", password = "password", AppRoot = wdir, extract.tif = TRUE, collection = 6, extent = ex.navarre) wdir.mod.tif <- file.path(wdir,"Modis","MOD09GA","tif") files.mod <- list.files(wdir.mod.tif, pattern = "\\.tif$", full.names = TRUE, recursive = TRUE)[c(16,19,18)] img.mod <- stack(files.mod) qrange <- c(0.001, 0.999) img.mod.rgb <- varRGB(img.mod[[1]], img.mod[[2]], img.mod[[3]], qrange) plotRGB(img.mod.rgb) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.