sen2r (version 1.2.1)

s2_list: 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", apihub = NA, max_cloud = 100,
  availability = "ignore", 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

apihub

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

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 (see https://scihub.copernicus.eu/userguide/LongTermArchive) 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).

output_type

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

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.

Examples

Run this code
# 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
safe_getMetadata(example_s2_list, "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
safe_getMetadata(example_s2_list, "sensing_datetime")
# }

Run the code above in your browser using DataLab