Skip to contents

Set mask band of a VRT collection

Usage

vrt_set_maskfun(
  x,
  mask_band,
  mask_values,
  build_mask_pixfun,
  set_mask_pixfun,
  drop_mask_band,
  cache_dir
)

# S3 method for class 'vrt_block'
vrt_set_maskfun(
  x,
  mask_band,
  mask_values,
  build_mask_pixfun = vrtility::build_intmask(),
  set_mask_pixfun = vrtility::set_mask_numpy(),
  drop_mask_band = TRUE,
  cache_dir = getOption("vrt.cache")
)

# S3 method for class 'vrt_collection'
vrt_set_maskfun(
  x,
  mask_band,
  mask_values,
  build_mask_pixfun = vrtility::build_intmask(),
  set_mask_pixfun = vrtility::set_mask_numpy(),
  drop_mask_band = TRUE,
  cache_dir = getOption("vrt.cache")
)

Arguments

x

A VRT collection

mask_band

The name of the mask band

mask_values

A numeric vector of integer or bit values to be masked.

build_mask_pixfun

A character string of the Python code to build the mask. Provided functions include build_intmask() and build_bitmask(). See details.

set_mask_pixfun

A character string of the Python code to set the mask. Provided functions include set_mask_numpy(). See details.

drop_mask_band

Logical. If TRUE, the mask band will be removed from the VRT block.

cache_dir

A character string of the directory to use for temporary files. In general this should be left alone. main purpose is to manage cache location when running asyncronously with mirai.

Value

A VRT block with the mask band set.

A VRT collection with the mask band set.

Details

The build_mask_pixfun function is used to build the mask band. Where the mask band is a true bitmask and bit-wise operations are required, the build_bitmask() function should be used. For integer-based masking, where the mask band is provided as a single band with integer values, the build_intmask() function should be used.

The set_mask_pixfun function is used to apply the mask to the other bands. In general set_mask_numpy() should be used, although a custom function can be provided.