sen2r (version 1.2.1)

s2_order: Order S2 products.

Description

The function orders S2 products from Long Term Archive (https://scihub.copernicus.eu/userguide/LongTermArchive).

Usage

s2_order(s2_prodlist = NULL, export_prodlist = TRUE, delay = 5,
  apihub = NA)

Arguments

s2_prodlist

Named character: list of the products to be ordered, in the format safelist (see '>safelist). Alternatively, it can be the path of a JSON file exported by a previous execution of s2_order, in case the user wants, for any reason, to resubmit the order.

export_prodlist

Logical or character: if TRUE (default), the list of ordered products is saved in a JSON text file, so to be easily retrievable at a later stage with safe_is_online or s2_download; if FALSE, no output files are generated. It is also possible to pass the path of an existing folder in which the JSON file will be saved (otherwise, a default path is used).

delay

Numeric: time frame (in seconds) to leave between two consecutive orders. Default is 5 seconds: use a higher value if you encountered errors (i.e. not all the products were correctly ordered).

apihub

Path of the "apihub.txt" file containing credentials of SciHub account. If NA (default), the default location inside the package will be used.

Value

A named vector, containing the selection of s2_prodlist elements which were ordered. Moreover, the vector includes the following attributes:

  • "available" with the elements of s2_prodlist which were already available for download,

  • "notordered" with the elements of s2_prodlist which were not ordered for any reasons,

  • "path" (only if argument export_prodlist is not FALSE) with the path of the json file in which the list of the ordered products was saved.

Examples

Run this code
# NOT RUN {
# Generate the lists of products
pos <- sf::st_sfc(sf::st_point(c(-57.8815,-51.6954)), crs = 4326)
time_window <- as.Date(c("2018-02-21", "2018-03-20"))
list_safe <- s2_list(spatial_extent = pos, time_interval = time_window)
print(list_safe)
# (at the time the documentation was written, this list was containing 5
# archives already available online and 2 stored in the Long Term Archive)

# Order the products
ordered_prods <- s2_order(list_safe)

# Check in a second time if the product was made available
(order_path <- attr(ordered_prods, "path"))
safe_is_online(order_path)
# }

Run the code above in your browser using DataCamp Workspace