Skip to contents

make_mask takes an input polygon shapefile and converts to a raster mask.

Usage

make_mask(
  ivect,
  refimage,
  attribname = "year",
  loc = "raster_masks/cloud_masks"
)

Arguments

ivect

Character string of the file path and name of the input shapefile.

refimage

Character string of the file path and name of a raster that has the correct extent and cell size for the current analysis, e.g. this could be one of the input rasters for link{veg_dens}.

attribname

Character string of the name of the attribute column in the shapefile that gives the year that the polygon applies to. Defaults to "year".

loc

Character string of the file path to the directory where the output/s should be written. Defaults to"raster_masks/cloud_masks" which works with the suggested project folder structure and workflow.

Value

cloud masks will be written to "raster_masks/cloud_masks" unless 'loc' parameter is changed, as tif files.

Details

Input raster mosaics will inevitably contain the odd cloud or smoke haze that obscures regions of interest. The user should create a polygon shapefile that identifies where the cloud is within the image as this identifies where we have less certainty in our analysis. The user digitises a polygon that surrounds the cloud and ensures that each polygon contains an attribute called 'year' which has a 4 digit representation of the year of the afflicted image.

On running the function it will generate a raster mask for each unique year it finds in the attribute table, formatting them to the exact requirements for use in the link{cloud_mask} function. Correct extents, cell sizes, CRS and mask values are all handled within the function.

Note that it is possible to use this function to create other masks, such as the land mask. To do this follow the instructions and then rename and relocate the product as required.

Author

Bart Huntley, bart.huntley@dbca.wa.gov.au

Examples

if (FALSE) { # \dontrun{
make_mask(ivect = "vectors/cloud_vectors.shp", refimage = "veg_dens/LgCSMP_vdens_2018.tif",
attribname = "year", loc ="raster_masks/cloud_masks")
} # }