s2_list: Retrieve list of available S2 products.

View source: R/s2_list.R

s2_listR Documentation

Retrieve list of available S2 products.

Description

The function retrieves the list of available Sentinel-2 products satisfying given search criteria.

Usage

s2_list(
  spatial_extent = NULL,
  tile = NULL,
  orbit = NULL,
  time_interval = c(Sys.Date() - 10, Sys.Date()),
  time_period = "full",
  level = "auto",
  server = "gcloud",
  apihub = NA,
  service = "apihub",
  max_cloud = 100,
  availability,
  tmpdir = NA,
  output_type = "deprecated"
)

Arguments

spatial_extent

A valid spatial object object of class sf, sfc or sfg

tile

⁠string array⁠ Sentinel-2 Tiles to be considered string (5-length character)

orbit

⁠string array⁠ Sentinel-2 orbit numbers to be considered

time_interval

Dates to be considered, as a temporal vector (class POSIXct or Date, or string in YYYY-mm-dd format) of length 1 (specific day) or 2 (time interval).

time_period

(optional) Character:

  • "full" (default) means that all the images included in the time window are considered;

  • "seasonal" means that only the single seasonal periods in the window are used (i.e., with a time window from 2015-06-01 to 2017-08-31, the periods 2015-06-01 to 2015-08-31, 2016-06-01 to 2016-08-31 and 2017-06-01 to 2017-08-31 are considered).

level

Character vector with one of the following: - "auto" (default): check if level-2A is available on SciHub: if so, list it; if not, list the corresponding level-1C product - "L1C": list available level-1C products - "L2A": list available level-2A products

server

(deprecate) Character vector of length 1, with the names of the servers on which SAFE archives are searched. Currently, only "gcloud" (Google Cloud) is supported. Old "scihub" (ESA Sentinel Hub) can no more be used, since November 2023, when the Copernicus Sentinel Data is no longer available and has been replaced by the Copernicus Data Space Ecosystem. See also the section "Details".

apihub

deprecated

service

deprecated

max_cloud

Integer number (0-100) containing the maximum cloud level of the tiles to be listed (default: no filter).

availability

Character argument, determining which products have to be returned:

  • "online" : only archive names already available for download are returned;

  • "lta": only archive names stored in the Long Term Archive are returned;

  • "check": all archive names are returned, checking if they are available or not for download (see "Value" to know how to distinguish each other);

  • "ignore" (default): all archive names are returned, without doing the check (running the function is faster). If not provided, "ignore" is the default value unless server = c("scihub","gcloud") (in which case "check" is used).

tmpdir

(optional) Path where intermediate files (xml) will be created (it is used only if argument server includes "gcloud"). Default is a temporary directory. If tmpdir is a non-empty folder, a random subdirectory will be used.

output_type

Deprecated (use as.data.table to obtain a data.table).

Details

Important: to search and download from Google Cloud, Google Cloud SDK must be installed and configured following the indications in https://cloud.google.com/sdk/docs/install. Notice also that querying Google Cloud can be very slow (while downloading them is generally faster than from SciHub).

Value

An object of class safelist. The attribute online contains logical values: in case availability != "ignore", values are TRUE / FALSE for products available for download / stored in the Long Term Archive; otherwise, values are set to NA.

Note

License: GPL 3.0

Author(s)

Lorenzo Busetto, phD (2019) - Inspired by function getSentinel_query of package getSpatialData by J. Schwalb-Willmann

Luigi Ranghetti, phD (2019)

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2020.104473")}, URL: https://sen2r.ranghetti.info/.

Examples



pos <- sf::st_sfc(sf::st_point(c(9.85,45.81)), crs = 4326)
time_window <- as.Date(c("2020-08-01", "2020-08-11"))

# Full-period list
if (is_gcloud_configured()) {
  example_s2_list <- s2_list(
    spatial_extent = pos,
    tile = "32TNR",
    time_interval = time_window,
    orbit = "065"
  )
} else {
  example_s2_list <- as(character(), "safelist")
}
print(example_s2_list)
# Print the dates of the retrieved products
safe_getMetadata(example_s2_list, "sensing_datetime")

# Seasonal-period list
if (is_gcloud_configured()) {
  example_s2_list <- s2_list(
    spatial_extent = pos,
    tile = "32TNR",
    time_interval = time_window,
    time_period = "seasonal"
  )
} else {
  example_s2_list <- as(character(), "safelist")
}
print(example_s2_list)
# Print the dates of the retrieved products
safe_getMetadata(example_s2_list, "sensing_datetime")



ranghetti/fidolasen documentation built on March 27, 2024, 9:37 p.m.