Mask data in a gt_RasterLayer object using another gt_RasterLayer.

gt_mask(x, mask, maskvalue, updatevalue)

# S4 method for gt_RasterLayer,gt_RasterLayer
gt_mask(x, mask, maskvalue = NA,
  updatevalue = NA)

Arguments

x
gt_RasterLayer object.
mask
gt_RasterLayer object.
...
not used.
maskvalue
numeric The value in mask that indicates the cells of x that should become missing data values. Defaults to NA.
updatevalue
numeric The value that masked out values in x should becomes. Defaults to NA.

Value

gt_RasterLayer object.

Details

This function is similar to mask, except that masked values in x are always set to missing data values.

Examples

## Not run: ------------------------------------ # g <- gt_raster(raster::raster(matrix(c(1:6), ncol=3), # crs=sp::CRS('+init=epsg:4326'), # xmn=0, xmx=3, ymn=2, ymx=10)) # mask <- gt_raster(raster::raster(matrix(c(NA, 1:4, NA), ncol=3), # crs=sp::CRS('+init=epsg:4326'), # xmn=0, xmx=3, ymn=2, ymx=10)) # result <- gt_mask(g, mask) ## ---------------------------------------------