compute_s2_paths is an internal function (to be used within sen2r()) which computes the names of the required output image files (see details). The function was split from sen2r() because this code is called twice (and to shorten the main function).

list_sen2r_paths is a wrapper of sen2r(), which runs sen2r() until compute_s2_paths() is called, returning the same list. It is a simple way to call compute_s2_paths() with the same arguments if sen2r().

compute_s2_paths(
  pm,
  s2_list_l1c,
  s2_list_l2a,
  tmpdir,
  list_prods,
  force_tiles = FALSE,
  check_tmp = TRUE,
  ignorelist
)

list_sen2r_paths(
  param_list = NULL,
  gui = NA,
  preprocess = TRUE,
  s2_levels = c("l1c", "l2a"),
  sel_sensor = c("s2a", "s2b"),
  online = TRUE,
  apihub = NA,
  downloader = "builtin",
  overwrite_safe = FALSE,
  rm_safe = "no",
  step_atmcorr = "auto",
  max_cloud_safe = 100,
  timewindow = NA,
  timeperiod = "full",
  extent = NA,
  extent_name = "sen2r",
  s2tiles_selected = NA,
  s2orbits_selected = NA,
  list_prods = c("BOA"),
  list_rgb = NA,
  list_indices = NA,
  index_source = "BOA",
  rgb_ranges = NA,
  mask_type = NA,
  max_mask = 100,
  mask_smooth = 0,
  mask_buffer = 0,
  clip_on_extent = TRUE,
  extent_as_mask = FALSE,
  reference_path = NA,
  res = NA,
  res_s2 = "10m",
  unit = "Meter",
  proj = NA,
  resampling = "near",
  resampling_scl = "near",
  outformat = "GTiff",
  rgb_outformat = "GTiff",
  index_datatype = "Int16",
  compression = "DEFLATE",
  rgb_compression = "90",
  overwrite = FALSE,
  path_l1c = NA,
  path_l2a = NA,
  path_tiles = NA,
  path_merged = NA,
  path_out = NA,
  path_rgb = NA,
  path_indices = NA,
  path_subdirs = TRUE,
  thumbnails = TRUE,
  parallel = TRUE,
  processing_order = "by_step",
  use_python = TRUE,
  tmpdir = NA,
  rmtmp = TRUE,
  log = NA
)

Arguments

pm

List of input parameters.

s2_list_l1c

Names and paths of input SAFE level-1C products.

s2_list_l2a

Names and paths of input SAFE level-2A products.

tmpdir

Path of the temporary directory.

list_prods

Character vector with the values of the products to be processed (accepted values: "TOA", "BOA", "SCL", "TCI", "AOT", "WVP", "CLD", "SNW", "SZA", "OZA", "SAA", "OAA").

force_tiles

(optional) Logical: passed to safe_shortname() (default: FALSE).

check_tmp

(optional) Logical: if TRUE (default), temporary files are also searched when exi names are computed; if FALSE, only non temporary files are searched.

ignorelist

List of output files to be ignored (generated by read_ignorelist()).

param_list

sen2r argument (refer to sen2r() documentation).

gui

sen2r argument (refer to sen2r() documentation).

preprocess

sen2r argument (refer to sen2r() documentation).

s2_levels

sen2r argument (refer to sen2r() documentation).

sel_sensor

sen2r argument (refer to sen2r() documentation).

online

sen2r argument (refer to sen2r() documentation).

apihub

sen2r argument (refer to sen2r() documentation).

downloader

sen2r argument (refer to sen2r() documentation).

overwrite_safe

sen2r argument (refer to sen2r() documentation).

rm_safe

sen2r argument (refer to sen2r() documentation).

step_atmcorr

sen2r argument (refer to sen2r() documentation).

max_cloud_safe

sen2r argument (refer to sen2r() documentation).

timewindow

sen2r argument (refer to sen2r() documentation).

timeperiod

sen2r argument (refer to sen2r() documentation).

extent

sen2r argument (refer to sen2r() documentation).

extent_name

sen2r argument (refer to sen2r() documentation).

s2tiles_selected

sen2r argument (refer to sen2r() documentation).

s2orbits_selected

sen2r argument (refer to sen2r() documentation).

list_rgb

sen2r argument (refer to sen2r() documentation).

list_indices

sen2r argument (refer to sen2r() documentation).

index_source

sen2r argument (refer to sen2r() documentation).

rgb_ranges

sen2r argument (refer to sen2r() documentation).

mask_type

sen2r argument (refer to sen2r() documentation).

max_mask

sen2r argument (refer to sen2r() documentation).

mask_smooth

sen2r argument (refer to sen2r() documentation).

mask_buffer

sen2r argument (refer to sen2r() documentation).

clip_on_extent

sen2r argument (refer to sen2r() documentation).

extent_as_mask

sen2r argument (refer to sen2r() documentation).

reference_path

sen2r argument (refer to sen2r() documentation).

res

sen2r argument (refer to sen2r() documentation).

res_s2

sen2r argument (refer to sen2r() documentation).

unit

sen2r argument (refer to sen2r() documentation).

proj

sen2r argument (refer to sen2r() documentation).

resampling

sen2r argument (refer to sen2r() documentation).

resampling_scl

sen2r argument (refer to sen2r() documentation).

outformat

sen2r argument (refer to sen2r() documentation).

rgb_outformat

sen2r argument (refer to sen2r() documentation).

index_datatype

sen2r argument (refer to sen2r() documentation).

compression

sen2r argument (refer to sen2r() documentation).

rgb_compression

sen2r argument (refer to sen2r() documentation).

overwrite

sen2r argument (refer to sen2r() documentation).

path_l1c

sen2r argument (refer to sen2r() documentation).

path_l2a

sen2r argument (refer to sen2r() documentation).

path_tiles

sen2r argument (refer to sen2r() documentation).

path_merged

sen2r argument (refer to sen2r() documentation).

path_out

sen2r argument (refer to sen2r() documentation).

path_rgb

sen2r argument (refer to sen2r() documentation).

path_indices

sen2r argument (refer to sen2r() documentation).

path_subdirs

sen2r argument (refer to sen2r() documentation).

thumbnails

sen2r argument (refer to sen2r() documentation).

parallel

sen2r argument (refer to sen2r() documentation).

processing_order

sen2r argument (refer to sen2r() documentation).

use_python

sen2r argument (refer to sen2r() documentation).

rmtmp

sen2r argument (refer to sen2r() documentation).

log

sen2r argument (refer to sen2r() documentation).

Value

A nested list:

  • first elements are exi, exp, req and new;

  • second elements deal with the processing step: tiles, merged, warped, warped_nomsk, rgb, masked and indices;

  • third elements are related to output products.

Details

compute_s2_paths is structured in the following way:

  1. Retrieve the file names expected to be present at the end of the processing chain (element exp) and already existing (exi);

  2. Compute the file names expected to be created (elements req and new, see below) (this operation is done in reverse order).

    Meaning of the elements exi, exp, req and new (here and for all the script), which are defined foe each processing step:

    • exi: full names of the files already existing before launching the processing chain;

    • exp: full names of the files expected to be present at the end of the processing chain (already existing or not);

    • req: names of the files required by the step;

    • new: names of the required files not existing yet (expected to be created).

With overwrite=TRUE, all these vectors are equal because all is overwritten.

Note

License: GPL 3.0

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. doi:10.1016/j.cageo.2020.104473 , URL: https://sen2r.ranghetti.info/.

Author

Luigi Ranghetti, phD (2019)