Mask the reference grid by a spatial vector layer

mask_grid(grid, mask, predicate = sf::st_intersects)

Arguments

grid

The reference grid as object of class stars.

mask

Object of class sf or sfc to use as mask.

predicate

Geometric binary predicate to use for masking. See sf::geos_binary_pred.

Value

The updated grid as object of class stars. The updated grid has the same dimensions as the original grid, but pixel values are set to NA if the specified spatial relation (as described by predicate) between that pixel and the mask is evaluated to FALSE.