The function is a wrapper to perform the entire
processing chain to find, download and pre-process Sentinel-2
data. Input is a set of parameters that can be passed with a
list or file (parameter param_list
) or singularly (see the
descriptions of all the other parameters).
sto(param_list = NULL, gui = NA, preprocess = NA, s2_levels = NA, sel_sensor = NA, online = NA, overwrite_safe = NA, rm_safe = NA, step_atmcorr = NA, timewindow = NA, timeperiod = NA, extent = NA, extent_name = NA, s2tiles_selected = NA, s2orbits_selected = NA, list_prods = NA, list_indices = NA, index_source = NA, mask_type = NA, max_mask = NA, clip_on_extent = NA, extent_as_mask = NA, reference_path = NA, res = NA, res_s2 = NA, unit = NA, proj = NA, resampling = NA, resampling_scl = NA, outformat = NA, index_datatype = NA, compression = NA, overwrite = NA, path_l1c = NA, path_l2a = NA, path_tiles = NA, path_merged = NA, path_out = NA, path_indices = NA, path_subdirs = NA, thumbnails = TRUE, use_python = TRUE)
param_list | (optional) List of input parameters:
it can be both an R list or the path of a JSON file.
If some parameters are passed both as elements of |
---|---|
gui | (optional) Logical: if TRUE, function |
preprocess | (optional) Logical: TRUE (default) to perform also preprocessing steps, FALSE not to (do only find, download and atmospheric correction). |
s2_levels | (optional) Character vector of length 1 or 2, with
Sentinel-2 levels required for processing steps or as output.
This parameter is used only if |
sel_sensor | (optional) Character vector of length 1 or 2, with Sentinel-2 sensors to be used. Accepted values: "s2a" and "s2b"; default: c("s2a","s2b"). |
online | (optional) Logical: TRUE (default) to search for available products on SciHub (and download if needed); FALSE to work only with already downloaded SAFE products. |
overwrite_safe | (optional) Logical: TRUE to overwrite existing products with products found online or manually corrected, FALSE (default) to skip download and atmospheric correction for products already existing. |
rm_safe | (optional) Character: should SAFE products be deleted after preprocessing? "yes" means to delete all SAFE; "no" (default) not to delete; "l1c" to delete only Level-1C products. |
step_atmcorr | (optional) Character vector to determine how to obtain Level-2A SAFE products:
|
timewindow | (optional) Temporal window for querying: Date object of length 1 (single day) or 2 (time window). Default is NA in online mode (meaning that no filters are used, and all found images are processed); in online mode, default is to process last 90 days. Only in offline mode, it is possible to pass NA not to filter by sensing time. |
timeperiod | (optional) Character:
|
extent | (optional) Spatial extent on which to clip products (it can be both the path of a vector file or a geoJSON). Default is NA for offline mode (meaning no extent: all found tiles are entirely used); in online mode, a sample extent is used as default. |
extent_name | (optional) Name of the area set as extent, to be used in the output file names. Default is to leave it blank. The name is an alphanumeric string which cannot contain points nor underscores, and that cannot be a five-length string with the same structure of a tile ID (two numeric and three uppercase character values). |
s2tiles_selected | (optional) Character vector with the Sentinel-2 tiles to be considered (default is NA, meaning all the tiles). |
s2orbits_selected | (optional) Character vector with the Sentinel-2 orbits to be considered (still to be implemented; for now, all the accepted values are listed). |
list_prods | (optional) Character vector with the values of the products to be processed (accepted values: "TOA", "BOA", "SCL", "TCI"). Default is "BOA". |
list_indices | (optional) Character vector with the values of the spectral indices to be computed. Default is no one (NA). |
index_source | (optional) Character value: if "BOA" (default), indices are computed from BOA values; if "TOA", non corrected reflectances are instead used (be careful to use this setting!). |
mask_type | (optional) Character value which determines the categories
in the Surface Classification Map to be masked (see |
max_mask | (optional) Numeric value (range 0 to 100), which represents
the maximum percentage of allowed masked surface (by clouds or any other
type of mask chosen with argument |
clip_on_extent | (optional) Logical: if TRUE (default), output products and indices are clipped to the selected extent (and resampled/reprojected); if FALSE, the geometry and extension of the tiles is maintained. |
extent_as_mask | (optional) Logical: if TRUE, pixel values outside
the |
reference_path | (optional) Path of the raster file to be used as a reference grid. If NA (default), no reference is used. |
res | (optional) Numerifc vector of length 2 with the x-y resolution for output products. Default: c(10,10). NA means that the resolution is keeped as native. |
res_s2 | (optional) Character value corresponding to the native Sentinel-2 resolution to be used. Accepted values are "10m" (default), "20m" and "60m". |
unit | (optional) Character value corresponding to the unit of measure with which to interpret the resolution (for now, only "Meter" - the default value - is supported). |
proj | (optional) Character string with the pro4string of the output resolution. default value (NA) means not to reproject. |
resampling | (optional) Resampling method (one of the values supported
by |
resampling_scl | (optional) Resampling method for categorical products (for now, only SCL): one among "near" (default) and "mode". |
outformat | (optional) Format of the output file (in a format recognised by GDAL). Default is "GTiff". |
index_datatype | (optional) Numeric datatype of the ouptut spectral indices (see s2_calcindices. |
compression | (optional) In the case GTiff is chosen as output format, the compression indicated with this parameter is used (default is "DEFLATE"). |
overwrite | (optional) Logical value: should existing output files be overwritten? (default: FALSE). |
path_l1c | (optional) Path of the directory in which Level-1C SAFE products are searched and/or downloaded. If not provided (default), a temporary directory is used. |
path_l2a | (optional) Path of the directory in which Level-2A SAFE products are searched, downloaded and/or generated. If not provided (default), a temporary directory is used. |
path_tiles | (optional) Path of the directory in which Sentinel-2
tiles (as generated by s2_translate) are searched and/or generated.
If not provided (default), a temporary directory is used, and files
are generated as virtual rasters; otherwise, they are generated in
the format specified with |
path_merged | (optional) Path of the directory in which Sentinel-2
tiles merged by orbit (as generated by s2_merge) are searched and/or
generated.
If not provided (default), a temporary directory is used, and files
are generated as virtual rasters; otherwise, they are generated in
the format specified with |
path_out | (optional) Path of the directory in which Sentinel-2 output products are searched and/or generated. If not provided (default), a temporary directory is used. |
path_indices | (optional) Path of the directory in which files of
spectral indices are searched and/or generated.
If not provided (default), |
path_subdirs | (optional) Logical: if TRUE (default), a directory
for each output product or spectral index is generated within
|
thumbnails | (optional) Logical: if TRUE (default), a thumbnail is added for each product created. Thumbnails are JPEG or PNG georeferenced small images (width or height of 1024 pixels) with default colour palettes (for more details, see the help window in the GUI). They are placed in a subdirectory of the products names "thumbnails". If FALSE, they are not created. |
use_python | (optional) Logical: if TRUE (default), the presence of python in the system is checked before running the function; if FALSE, this is skipped. Setting this to FALSE can bge useful on systems with problems with python, when [sto)] is intended to be used only for processing existing SAFE files (python is required in any case to download SAFE). [sto)]: R:sto) |
A vector with the paths of the files which were created (excluded the temporary files); NULL otherwise.