smooth_mask: Buffer cloud masks

View source: R/smooth_mask.R

smooth_maskR Documentation

Buffer cloud masks

Description

Internal function (used by s2_mask) which smooths and buffers a 0-1 mask image in order to reduce the roughness of the mask obtained from SCL classification (which is done pixel by pixel). See details.

Usage

smooth_mask(
  inmask,
  tmpdir = tempdir(),
  radius = 250,
  buffer = 250,
  namask = NULL,
  bigtiff = FALSE
)

Arguments

inmask

The path of the input 0-1 mask (where 0 represents the area to be masked, 1 the clean surface).

tmpdir

(optional) Path where intermediate files (VRT) will be created. Default is a temporary directory.

radius

(optional) Numerical (positive): the size (in the unit of inmask, typically metres) to be used as radius for the smoothing (the higher it is, the more smooth the output mask will result).

buffer

(optional) Numerical (positive or negative): the size of the buffer (in the unit of inmask, typically metres) to be applied to the masked area after smoothing it (positive to enlarge, negative to reduce).

namask

(optional) The path of an input 0-1 mask where 0 represents the area of the original file with NA values (which should not be smoothed / buffered). Default (NULL) means that no NA values are present.

bigtiff

(optional) Logical: if TRUE, the creation of a BigTIFF is forced (default is FALSE).

Value

The path of the smoothed mask.

Note

License: GPL 3.0

Author(s)

Luigi Ranghetti, phD (2019)

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2020.104473")}, URL: https://sen2r.ranghetti.info/.


sen2r documentation built on Nov. 10, 2023, 9:08 a.m.