lsEspaDownloadOrders: Downloads the images that have been pre-processed by ESPA

Description Usage Arguments Details Value Examples

View source: R/lsEspaDownloadOrders.R

Description

lsEspaDownloadOrders downloads a set of images processed by the EROS Centre Science Processing Architecture (ESPA) through its application programming interface (API).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
lsEspaDownloadOrders(
  orders,
  AppRoot,
  username = NULL,
  password = NULL,
  c.handle = NULL,
  verbose = FALSE,
  overwrite = FALSE,
  n.attempts = 5,
  untar = FALSE,
  ...
)

Arguments

orders

a list of the requested images as returned by lsEspaGetOrderImages.

AppRoot

the download directory.

username

USGS's ‘EarthExplorer’ username.

password

USGS's ‘EarthExplorer’ password.

c.handle

a curl handler created with the package 'curl' to stablish a connection with a preset password and username. This argument is mandatory if username and password are not defined.

verbose

logical argument. If TRUE, the function prints the running steps and warnings.

overwrite

logical argument. If TRUE, overwrites the existing images with the same name.

n.attempts

the number of attempts to download an image in case it becomes corrupted files.

untar

logical argument. If TRUE, untars the downloaded images.

...

argument for nested functions

Details

This function is part of a group of functions used to pre-process Landsat level-1 images. The pre-processing is carried out by ESPA on demand. lsEspaDownloadOrders downloads the images whose processing was completed according to lsEspaUpdateOrders. The function downloads and saves the imagery under the AppRoot directory. The function automatically creates two folders, called "raw" and "untar", to save the compressed and decompressed images respectively. The imagery is only decompressed when untar = TRUE.

Value

this function does not return anything. It saves the imagery as 'tar.gz’ (and GTiff files) in a folder called 'raw’ ('untar’) in the AppRoot directory.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## Not run: 
wdir <- file.path(tempdir(),"Path_for_downloading_folder")
print(wdir)
# search Landsat-7 level-1
sres <- ls7Search(startDate = as.Date("01-01-2017", "%d-%m-%Y"),
                  endDate = as.Date("15-01-2017", "%d-%m-%Y"),
                  lonlat = c(-1.64323, 42.81687),
                  AppRoot = wdir)
# request to ESPA the prepocessing of level-1 images to get the surface reflectance
order <- lsEspaOrderImages(search.res = sres,
                           username = "username", 
                           password = "password", 
                           product = 'sr',
                           verbose = FALSE)
# get an ID for our request
orders <- lsEspaGetOrderImages(username = "username", 
                               password = "password")
# follow up the status of the request
orders <- lsEspaUpdateOrders(orders = orders,
                             username = "username", 
                             password = "password")
# saving directory
wdir.ls7.ESPA <- file.path(wdir,"Landsat7","ESPA")
dir.create(wdir.ls7.ESPA, recursive = TRUE)
# download when status says: complete
lsEspaDownloadOrders(orders = orders,
                     username = "username", 
                     password = "password",
                     untar = TRUE,
                     AppRoot = wdir.ls7.ESPA)

## End(Not run)

RGISTools documentation built on July 2, 2020, 3:58 a.m.