The function retrieves the list of available Sentinel-2 products basing on search criteria. It makes use of s2download python function only to retrieve the list of files, without downloading and correcting them.

s2_list(spatial_extent = NULL, tile = NULL, orbit = NULL,
  time_interval = NULL, time_period = "full", level = "auto",
  ignore_ingestion_time = TRUE, apihub = NA, max_cloud = 100)

Arguments

spatial_extent

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

tile

Single Sentinel-2 Tile string (5-length character)

orbit

Single Sentinel-2 orbit number

time_interval

a temporal vector (class POSIXct or Date) 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

ignore_ingestion_time

(optional) Logical: if TRUE (default), the research is performed basing only on the sensing date and time (the time in which the image was acquired), ignoring the ingestion date and time (the time the image was ingested). If FALSE, products with the ingestion time specified with time_interval are first of all filtered, and them the research is performed on the sensing time among them. ignore_ingestion_time = TRUE ensures to perform a complete research, but it is slower; setting it to FALSE speeds up, although some products could be ignored (but generally the ingestion date is the same of the sensing date).

apihub

Path of the "apihub.txt" file containing credentials of scihub account. If NA (default) the default credentials (username "user", password "user") will be used.

max_cloud

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

Value

A vector of available products (being each element an URL, and its name the product name).

Note

License: GPL 3.0

Examples

# NOT RUN {
pos <- sf::st_sfc(sf::st_point(c(9.85,45.81)), crs = 4326)
time_window <- as.Date(c("2016-05-01", "2017-07-30"))

# Full-period list
example_s2_list <- s2_list(
  spatial_extent = pos,
  tile = "32TNR",
  time_interval = time_window,
  orbit = "065"
)
print(example_s2_list)
# Print the dates of the retrieved products
as.vector(sort(sapply(names(example_s2_list), function(x) {
  strftime(safe_getMetadata(x,"nameinfo")$sensing_datetime)
})))

# Seasonal-period list
example_s2_list <- s2_list(
  spatial_extent = pos,
  tile = "32TNR",
  time_interval = time_window,
  time_period = "seasonal"
)
print(example_s2_list)
# Print the dates of the retrieved products
as.vector(sort(sapply(names(example_s2_list), function(x) {
  strftime(safe_getMetadata(x,"nameinfo")$sensing_datetime)
})))
# }