The function checks if the required SAFE archives are available for download, or if they have to be ordered from the Long Term Archive.

safe_is_online(s2_prodlist = NULL, apihub = NA, verbose = TRUE)

Arguments

s2_prodlist

Named character: list of the products to be checked, in the format safelist (see safelist). Alternatively, it can be the path of a JSON file exported by s2_order.

apihub

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

verbose

Logical: if TRUE, provide processing messages summarising how many of the SAFE archives in s2_prodlist are available online.

Value

A logical vector of the same length and names of the SAFE products passed with s2_prodlist, in which each element is TRUE if the corresponding SAFE archive is available for download, FALSE if it is not or NA in case of errors with the SAFE url.

Note

License: GPL 3.0

References

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/.

Author

Luigi Ranghetti, phD (2019)

Lorenzo Busetto, phD (2020)

Examples

# \donttest{
if (is_scihub_configured()) {

# 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)
# (at the time the documentation was written, this list was containing 5
# archives already available online and 2 stored in the Long Term Archive)

# Check for availability
safe_is_online(list_safe)

}
#> Spherical geometry (s2) switched off
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> Spherical geometry (s2) switched on
#> 0 out of 7 products are online.
#> S2B_MSIL1C_20180224T133629_N0206_R038_T21FVC_20180224T194845.SAFE 
#>                                                             FALSE 
#> S2B_MSIL1C_20180227T134629_N0206_R081_T21FVC_20180227T200327.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 
# }