The function downloads S2 products. Input filenames must be elements obtained with s2_list function (each element must be a URL, and the name the product name).
s2_download(
s2_prodlist = NULL,
downloader = "builtin",
apihub = NA,
service = NA,
tile = NULL,
outdir = ".",
order_lta = TRUE,
abort = TRUE,
overwrite = FALSE
)
Named character: list of the products to be downloaded,
in the format safelist
(see safelist).
Alternatively, it can be the path of a JSON file exported by s2_order.
Executable to use to download products (default: "builtin"). Alternatives are "builtin" or "aria2" (this requires aria2c to be installed).
Path of the apihub.txt
file containing credentials
of SciHub account.
If NA (default), the default location inside the package will be used.
Character: it can be "dhus"
or "apihub"
, in which cases
the required service is forced instead that the one present in the URLs
passed through argument s2_prodlist
.
If NA (default), the service present in the URLs is maintained.
Deprecated argument
(optional) Full name of the existing output directory where the files should be created (default: current directory).
Logical: if TRUE (default), products which are not available for direct download are ordered from the Long Term Archive; if FALSE, they are simply skipped.
Logical parameter: if TRUE (default), the function aborts in case of errors during downloads; if FALSE, a warning is shown and download of subsequent products continues.
Logical value: should existing output archives be overwritten? (default: FALSE)
Vector character with the list ot the output products (being downloaded or already existing).
License: GPL 3.0
L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. doi:10.1016/j.cageo.2020.104473 , URL: https://sen2r.ranghetti.info/.
if (FALSE) {
single_s2 <- paste0("gs://gcp-public-data-sentinel-2/L2/tiles/32/T/NR/",
"S2B_MSIL2A_20200804T101559_N0214_R065_T32TNR_20200804T145113.SAFE/")
names(single_s2) <- "S2B_MSIL2A_20200804T101559_N0214_R065_T32TNR_20200804T145113.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())
file.info(file.path(tempdir(),names(single_s2)))
}