The function orders S2 products from Long Term Archive.
s2_order( s2_prodlist = NULL, export_prodlist = TRUE, delay = 0.5, apihub = NA, service = NA, reorder = TRUE )
s2_prodlist | Named character: list of the products to be ordered,
in the format |
---|---|
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 0.5 seconds: use a higher value if you encountered errors (i.e. not all the products were correctly ordered). |
apihub | Path of the |
service | Character: it can be |
reorder | Logical: If TRUE, and a json file exported by s2_order
is passed as argument to the function, try to order again also
the |
A named vector, containing the subset 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 products (ordered, available
and not ordered) was saved (if export_prodlist = TRUE
).
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: http://sen2r.ranghetti.info/.
Luigi Ranghetti, phD (2019) luigi@ranghetti.info
Lorenzo Busetto, phD (2020)
# \donttest{ # Generate the lists of products pos <- sf::st_sfc(sf::st_point(c(-57.8815,-51.6954)), crs = 4326) time_window <- as.Date(c("2019-10-21", "2019-11-20")) list_safe <- s2_list(spatial_extent = pos, time_interval = time_window)#>#> A named vector with 9 SAFE archives. #> S2A_MSIL2A_20191022T133641_N0213_R038_T21FVC_20191023T155120.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('d76c8a00-3b7f-45a2-b359-fc363c388a94')/$value" #> S2B_MSIL2A_20191027T133639_N0213_R038_T21FVC_20191027T150854.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('03cb6cbc-e858-4e40-ae37-d1872c957762')/$value" #> S2B_MSIL2A_20191030T134639_N0213_R081_T21FVC_20191030T152504.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('ed6aeeb1-f721-4aed-9a85-b37708f7149d')/$value" #> S2A_MSIL2A_20191101T133641_N0213_R038_T21FVC_20191101T150755.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('a52c1f7b-aa21-4055-9541-95aa2ec28bdb')/$value" #> S2B_MSIL2A_20191106T133639_N0213_R038_T21FVC_20191106T150814.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('091bc063-4978-4b28-8664-c5189d71e64b')/$value" #> ...with 4 more elements. #> The following attributes are included: mission, level, id_tile, id_orbit, sensing_datetime, ingestion_datetime, clouds, footprint, uuid, online.# (at the time the documentation was updated, this list was containing 6 # archives already available online and 3 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"))#> [1] "/home/lranghetti/.sen2r/lta_orders/lta_20210304_093252.json"#>#> S2A_MSIL2A_20191101T133641_N0213_R038_T21FVC_20191101T150755.SAFE #> TRUE #> S2B_MSIL2A_20191106T133639_N0213_R038_T21FVC_20191106T150814.SAFE #> TRUE #> S2B_MSIL2A_20191109T134639_N0213_R081_T21FVC_20191109T152703.SAFE #> TRUE #> S2A_MSIL2A_20191111T133641_N0213_R038_T21FVC_20191111T150452.SAFE #> TRUE #> S2B_MSIL2A_20191116T133639_N0213_R038_T21FVC_20191116T145355.SAFE #> TRUE #> S2B_MSIL2A_20191119T134639_N0213_R081_T21FVC_20191119T152133.SAFE #> TRUE #> S2A_MSIL2A_20191022T133641_N0213_R038_T21FVC_20191023T155120.SAFE #> FALSE #> S2B_MSIL2A_20191027T133639_N0213_R038_T21FVC_20191027T150854.SAFE #> FALSE #> S2B_MSIL2A_20191030T134639_N0213_R081_T21FVC_20191030T152504.SAFE #> FALSE# }