cloud_mask
applies pre-generated annual cloud masks to appropriate input
rasters and replaces values with -99.
Arguments
- irast
Character file path to directory of input rasters, most commonly, those created by
link{general_mask}
and stored at `veg_dens_mskd/`.- imask
Character file path to directory of cloud raster masks to apply. Commonly something like "raster_masks/cloud_masks".
- ext
Character representation of the file extension of the input rasters. Defaults to ".tif" as this is the preferred file type.
Value
Any cloud masking will carried out to affected input rasters and these will be written to `veg_dens_mskd_cld/`. cloud masked areas will have a -99 value.
Details
The function applies a pre-generated mask to a single raster. These masks are often for things like cloud and shadow but could include something like a fire scar that could throw out the conversion to vegetation products. These circumstances are pertinent to one time step only, so the masks used here will be matched to the correct input by a year in the file name.
This function is designed to sort through a complete time series of input rasters and work out which need masking based on the presence of masks in a separate directory.
The function will compare any newly masked rasters to the raster of the year before in order to clean up masked areas that might extend over water for example. Masked areas in the product have a value of -99 and this step ensures that previously "NA" masked areas don't now have a -99 value.
Masking of the very first input raster of a time series is handled without this step as there is no prior image to compare to. Any input raster with no requirement for masking is renamed and copied to the output directory.
It is vital that all input rasters and masks have the same extents, CRS
and cell size and this is most easily achieved if the masks have been
generated using link{make_mask}
.
Author
Bart Huntley, bart.huntley@dbca.wa.gov.au