s2_download: Download S2 products.

Description Usage Arguments Note Author(s) Examples

Description

The function downloads a single S2 product. Input filename must be an element obtained with s2_list function (the content must be a URL, and the name the product name).

Usage

1
2
s2_download(s2_prodlist = NULL, downloader = "wget", apihub = NA,
  tile = NULL, outdir = ".")

Arguments

s2_prodlist

List of the products to be downloaded (this must be the output of s2_list function).

downloader

Executable to use to download products (default: "wget").

apihub

Path of the "apihub.txt" file containing credentials of scihub account. If NA (default) the default credentials (username "user", password "user") will be used.

tile

Single Sentinel-2 Tile string (5-length character)

outdir

(optional) Full name of the existing output directory where the files should be created (default: current directory).

Note

License: GPL 3.0

Author(s)

Luigi Ranghetti, phD (2017) ranghetti.l@irea.cnr.it

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
## Not run: 
single_s2 <- paste0("https://scihub.copernicus.eu/apihub/odata/v1/",
  "Products(\'c7142722-42bf-4f93-b8c5-59fd1792c430\')/\\$value")
names(single_s2) <- "S2A_MSIL1C_20170613T101031_N0205_R022_T32TQQ_20170613T101608.SAFE"
# (this is equivalent to:
# single_s2 <- example_s2_list[1]
# where example_s2_list is the output of the example of the
# s2_list() function)

# Download the whole product
s2_download(single_s2, outdir=tempdir())

# Download a specific tile
s2_download(single_s2, tile="32TQQ", outdir=tempdir())
# (for products with compact names, the two above commands produce equivalent
# results: the first one downloads a SAFE archive, while the second one
# downloads single product files)

# Download a serie of products
pos <- st_sfc(st_point(c(12.0, 44.8)), crs=st_crs(4326))
time_window <- as.Date(c("2017-05-01","2017-07-30"))
example_s2_list <- s2_list(spatial_extent=pos, tile="32TQQ", time_interval=time_window)
s2_download(example_s2_list, outdir=tempdir())

## End(Not run)

pobsteta/theia2r documentation built on May 25, 2019, 2:21 p.m.