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)
gt_RasterLayer
object.gt_RasterLayer
object.numeric
The value in mask
that indicates the cells of x
that should become missing data values. Defaults to NA
.numeric
The value that masked out values in x
should becomes.
Defaults to NA
.gt_RasterLayer
object.
This function is similar to mask
, except that masked values in x
are always set to missing data values.
## 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) ## ---------------------------------------------