safelist
is a format thought to manage lists of SAFE
Sentinel.2 archives.
It is a named character in which names are SAFE codes
(e.g. S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE
),
and values are URLs used to retrieve them from ESA API Hub (e.g.
https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value
).
Some attributes may be included, basically information retrieved by
function s2_list containing product metadata.
Moreover, the attribute online
(retrieved by function safe_is_online
may contain logical values (TRUE for products available for download,
FALSE for products stored in the Long Term Archive).
The class can be generated as an output of function s2_list, or converting
named characters (with the same structures), data.frames or data.tables
(including the columns name
and url
) using as (see examples).
Objects of class safelist
can be converted to named character, data.frames
or data.tables (see examples). The conversion to data.frame / data.table is
useful for reading hidden attributes.
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{ pos <- sf::st_sfc(sf::st_point(c(9.85,45.81)), crs = 4326) time_window <- as.Date(c("2017-05-01", "2017-05-31")) ## Create an object of class safelist list_safe <- s2_list(spatial_extent = pos, time_interval = time_window) list_safe#> A named vector with 3 SAFE archives. #> S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value" #> S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value" #> S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value" #> The following attributes are included: mission, level, id_tile, id_orbit, sensing_datetime, ingestion_datetime, clouds, footprint, uuid, online.class(list_safe)#> [1] "safelist" "character"#> [1] "2017-05-07 10:20:31 UTC" "2017-05-17 10:20:31 UTC" #> [3] "2017-05-27 10:20:31 UTC"## Convert to other classes (s2_char <- as.character(list_safe)) # convert to a simple named character#> S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value" #> S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value" #> S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value"#> name #> 1 S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> 2 S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> 3 S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> url #> 1 https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value #> 2 https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value #> 3 https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value #> mission level id_tile id_orbit sensing_datetime ingestion_datetime #> 1 2A 2Ap 32TNR 065 2017-05-07 10:20:31 2017-05-09 06:30:41 #> 2 2A 2Ap 32TNR 065 2017-05-17 10:20:31 2017-06-08 12:21:23 #> 3 2A 2Ap 32TNR 065 2017-05-27 10:20:31 2017-05-29 08:30:44 #> clouds #> 1 99.999908 #> 2 8.670091 #> 3 6.359588 #> footprint #> 1 POLYGON ((8.999741 46.05357, 10.4189 46.04477, 10.39425 45.05675, 8.999746 45.06526, 8.999741 46.05357, 8.999741 46.05357)) #> 2 POLYGON ((8.999741 46.05357, 10.4189 46.04477, 10.39425 45.05675, 8.999746 45.06526, 8.999741 46.05357, 8.999741 46.05357)) #> 3 POLYGON ((8.999741 46.05357, 10.4189 46.04477, 10.39425 45.05675, 8.999746 45.06526, 8.999741 46.05357)) #> uuid online #> 1 a4a026c0-db7b-4ba8-9b09-53027ab0d7ab NA #> 2 6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f NA #> 3 868b5b3c-92ac-412a-8a04-167008a1f08f NAlibrary(data.table)#> #>#>#> #>#> name #> 1: S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> 2: S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> 3: S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> url #> 1: https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value #> 2: https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value #> 3: https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value #> mission level id_tile id_orbit sensing_datetime ingestion_datetime #> 1: 2A 2Ap 32TNR 065 2017-05-07 10:20:31 2017-05-09 06:30:41 #> 2: 2A 2Ap 32TNR 065 2017-05-17 10:20:31 2017-06-08 12:21:23 #> 3: 2A 2Ap 32TNR 065 2017-05-27 10:20:31 2017-05-29 08:30:44 #> clouds #> 1: 99.999908 #> 2: 8.670091 #> 3: 6.359588 #> footprint #> 1: POLYGON ((8.999741 46.05357, 10.4189 46.04477, 10.39425 45.05675, 8.999746 45.06526, 8.999741 46.05357, 8.999741 46.05357)) #> 2: POLYGON ((8.999741 46.05357, 10.4189 46.04477, 10.39425 45.05675, 8.999746 45.06526, 8.999741 46.05357, 8.999741 46.05357)) #> 3: POLYGON ((8.999741 46.05357, 10.4189 46.04477, 10.39425 45.05675, 8.999746 45.06526, 8.999741 46.05357)) #> uuid online #> 1: a4a026c0-db7b-4ba8-9b09-53027ab0d7ab NA #> 2: 6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f NA #> 3: 868b5b3c-92ac-412a-8a04-167008a1f08f NA#> Simple feature collection with 3 features and 11 fields #> geometry type: POLYGON #> dimension: XY #> bbox: xmin: 8.999741 ymin: 45.05675 xmax: 10.4189 ymax: 46.05357 #> CRS: EPSG:4326 #> name #> 1 S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> 2 S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> 3 S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> url #> 1 https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value #> 2 https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value #> 3 https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value #> mission level id_tile id_orbit sensing_datetime ingestion_datetime #> 1 2A 2Ap 32TNR 065 2017-05-07 10:20:31 2017-05-09 06:30:41 #> 2 2A 2Ap 32TNR 065 2017-05-17 10:20:31 2017-06-08 12:21:23 #> 3 2A 2Ap 32TNR 065 2017-05-27 10:20:31 2017-05-29 08:30:44 #> clouds uuid online #> 1 99.999908 a4a026c0-db7b-4ba8-9b09-53027ab0d7ab NA #> 2 8.670091 6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f NA #> 3 6.359588 868b5b3c-92ac-412a-8a04-167008a1f08f NA #> footprint #> 1 POLYGON ((8.999741 46.05357... #> 2 POLYGON ((8.999741 46.05357... #> 3 POLYGON ((8.999741 46.05357...#> A named vector with 3 SAFE archives. #> S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value" #> S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value" #> S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value"#> A named vector with 3 SAFE archives. #> S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value" #> S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value" #> S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value" #> The following attributes are included: mission, level, id_tile, id_orbit, sensing_datetime, ingestion_datetime, clouds, footprint, uuid, online.#> A named vector with 3 SAFE archives. #> S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value" #> S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value" #> S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value" #> The following attributes are included: mission, level, id_tile, id_orbit, sensing_datetime, ingestion_datetime, clouds, footprint, uuid, online.#> A named vector with 3 SAFE archives. #> S2A_MSIL2A_20170507T102031_N0205_R065_T32TNR_20170507T102319.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('a4a026c0-db7b-4ba8-9b09-53027ab0d7ab')/$value" #> S2A_MSIL2A_20170517T102031_N0205_R065_T32TNR_20170517T102352.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('6b7bb7bb-7598-45ac-9f2c-a3bd9cdc092f')/$value" #> S2A_MSIL2A_20170527T102031_N0205_R065_T32TNR_20170527T102301.SAFE #> "https://scihub.copernicus.eu/apihub/odata/v1/Products('868b5b3c-92ac-412a-8a04-167008a1f08f')/$value" #> The following attributes are included: mission, level, id_tile, id_orbit, sensing_datetime, ingestion_datetime, clouds, uuid, online, footprint.# }