The function uses Sen2Cor to manually correct L1C products. Standalone version of sen2cor (version 2.8.0 or 2.5.5) is used.

sen2cor(l1c_prodlist = NULL, l1c_dir = NULL, outdir = NULL,
  proc_dir = NA, tmpdir = NA, rmtmp = TRUE, tiles = NULL,
  parallel = FALSE, overwrite = FALSE, .log_message = NA,
  .log_output = NA)



List of L1C product names to be corrected. They can be both product names with full/relative path or only names of SAFE products (in this case, also l1c_dir argument must be provided). SAFE products must be unzipped. Note that, at this stage, all products must be in the same directory (this will be fixed).


Full or relative path of input L1C products. If NULL (default), l1c_prodlist must already be a vector of full paths.


Directory where output L2A products will be placed. If NULL (default), each product is left in the parent directory of l1c_prodlist.


(optional) Directory where processing is applied. If NA (default), processing is done in l1c_dir and output L2A product is then moved to outdir, unless l1c_dir is a subdirectory of a SAMBA mountpoint under Linux: in this case, L1C input products are copied in a temporary directory (specified with argument tmpdir), processing is done there and then L2A is moved to outdir. This is required under Linux systems when l1c_dir is a subdirectory of a unit mounted with SAMBA, otherwise Sen2Cor would produce empty L2A products.


(optional) Path where processing is performed if a temporary working directory is required (see argument proc_dir). Be sure tmpdir not to be a SAMBA mountpoint under Linux. Default is a temporary directory. If tmpdir is a non-empty folder, a random subdirectory will be used.


(optional) Logical: should temporary files be removed? (Default: TRUE)


Vector of Sentinel-2 Tile strings (5-length character) to be processed (default: process all the tiles found in the input L1C products).


(optional) Logical: if TRUE, Sen2Cor instances are launched in parallel using multiple cores; if FALSE (default), they are launched in series on a single core. The number of cores is automatically determined; specifying it is also possible (e.g. parallel = 4).


Logical value: should existing output L2A products be overwritten? (default: FALSE)


(optional) Internal parameter (it is used when the function is called by sen2r()).


(optional) Internal parameter (it is used when the function is called by sen2r()).


Vector character with the list ot the output products (being corrected or already existing)


License: GPL 3.0


if (FALSE) { pos <- st_sfc(st_point(c(12.0, 44.8)), crs=st_crs(4326)) time_window <- as.Date(c("2017-05-01","2017-07-30")) example_s2_list <- s2_list(spatial_extent=pos, tile="32TQQ", time_interval=time_window) s2_download(example_s2_list, outdir=tempdir()) sen2cor(names(example_s2_list)[1], l1c_dir=tempdir(), outdir=tempdir()) }