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 "apihub.txt" file containing credentials of SciHub account. If NA (default), the default location inside the package will be used. |
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/.
# \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("2018-02-21", "2018-03-20")) list_safe <- s2_list(spatial_extent = pos, time_interval = time_window) print(list_safe)#> A named vector with 7 SAFE archives. #> S2B_MSIL1C_20180224T133629_N0206_R038_T21FVC_20180224T194845.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('c88086ac-8087-4adb-866e-baeffec5eb68')/$value" #> S2B_MSIL1C_20180227T134629_N0206_R081_T21FVC_20180227T200327.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('fa8cba66-7b8b-45aa-9038-9521d7658bad')/$value" #> S2A_MSIL1C_20180301T133641_N0206_R038_T21FVC_20180301T145524.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('d9a50ba4-8213-421e-92da-e5a487766dc2')/$value" #> S2B_MSIL1C_20180306T133629_N0206_R038_T21FVC_20180306T183210.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('5ae358f2-8589-493b-bb6d-09df04ec0ff9')/$value" #> S2A_MSIL1C_20180311T133641_N0206_R038_T21FVC_20180311T163528.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('266e369c-9ab5-486e-83b3-7180b6956616')/$value" #> ...with 2 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 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"))#> [1] "/home/lranghetti/.sen2r/lta_orders/lta_20200530_093323.json"safe_is_online(order_path)#>#> S2B_MSIL1C_20180227T134629_N0206_R081_T21FVC_20180227T200327.SAFE #> TRUE #> S2B_MSIL1C_20180224T133629_N0206_R038_T21FVC_20180224T194845.SAFE #> FALSE #> S2A_MSIL1C_20180301T133641_N0206_R038_T21FVC_20180301T145524.SAFE #> FALSE #> S2B_MSIL1C_20180306T133629_N0206_R038_T21FVC_20180306T183210.SAFE #> FALSE #> S2A_MSIL1C_20180311T133641_N0206_R038_T21FVC_20180311T163528.SAFE #> FALSE #> S2A_MSIL1C_20180314T134631_N0206_R081_T21FVC_20180314T150724.SAFE #> FALSE #> S2B_MSIL1C_20180316T133639_N0206_R038_T21FVC_20180316T145348.SAFE #> FALSE# }