Description Usage Arguments Value Note Author(s)
s2_mask Applies a cloud mask to a Sentinel-2 product. Since raster functions are used to perform computations, output files are physical rasters (no output VRT is allowed).
s2_perc_masked computes the percentage of cloud-masked surface. The function is similar to s2_mask, but it returns percentages instead of masked rasters.
1 2 3 4 5 6 7 8 | s2_mask(infiles, maskfiles, mask_type = "cloud_medium_proba",
smooth = 20, buffer = 10, max_mask = 80, outdir = "./masked",
tmpdir = NA, rmtmp = TRUE, save_binary_mask = FALSE, format = NA,
subdirs = NA, compress = "DEFLATE", parallel = FALSE,
overwrite = FALSE, .log_message = NA, .log_output = NA)
s2_perc_masked(infiles, maskfiles, mask_type = "cloud_medium_proba",
tmpdir = NA, rmtmp = TRUE, parallel = FALSE)
|
infiles |
A vector of input filenames. Input files are paths of products already converted from SAFE format to a format managed by GDAL (use s2_translate to do it); their names must be in the theia2r naming convention (safe_shortname). |
maskfiles |
A vector of filenames from which to take the
information about cloud coverage (for now, only SCL products
have been implemented). It is not necessary that |
mask_type |
(optional) Character vector which determines the type of mask to be applied. Accepted values are:
|
smooth |
(optional) Numerical (positive): should the mask be smoothed=the size (in the unit of
|
buffer |
(optional) Numerical (positive or negative): the size of the
buffer (in the unit of |
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 |
outdir |
(optional) Full name of the output directory where
the files should be created (default: "current directory"masked"
subdir of current directory).
|
tmpdir |
(optional) Path where intermediate files (VRT) will be created. Default is a temporary directory. |
rmtmp |
(optional) Logical: should temporary files be removed? (Default: TRUE). This parameter takes effect only if the output files are not VRT (in this case temporary files cannot be deleted, because rasters of source bands are included within them). |
save_binary_mask |
(optional) Logical: should binary masks be exported?
Binary mask are intermediate rasters used to apply the cloud mask:
pixel values can be 1 (no cloud mask), 0 (cloud mask) or NA (original NA
value, i.e. because input rasters had been clipped on the extent polygons).
If FALSE (default) they are not exported; if TRUE, they are exported
as MSK prod type (so saved within |
format |
(optional) Format of the output file (in a format recognised by GDAL). Default is the same format of input images (or "GTiff" in case of VRT input images). |
subdirs |
(optional) Logical: if TRUE, different indices are
placed in separated |
compress |
(optional) In the case a GTiff format is present, the compression indicated with this parameter is used. |
parallel |
(optional) Logical: if TRUE, masking is conducted using parallel
processing, to speed-up the computation for large rasters.
The number of cores is automatically determined; specifying it is also
possible (e.g. |
overwrite |
(optional) Logical value: should existing output files be overwritten? (default: FALSE) |
.log_message |
(optional) Internal parameter
(it is used when the function is called by |
.log_output |
(optional) Internal parameter
(it is used when the function is called by |
s2_mask returns a vector with the names of the created products. An attribute "toomasked" contains the paths of the outputs which were not created cause to the high percentage of cloud coverage.
s2_perc_masked returns a names vector with the percentages of masked surtfaces.
License: GPL 3.0
Luigi Ranghetti, phD (2017) ranghetti.l@irea.cnr.it
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.