Skip to contents
groveR logo
groveR logo

Purpose

Clouds are the bane of remote sensing studies. They obscure the reflectance values of the end members we are interested in and if not dealt with will skew results. When mosaicking multiple satellite scenes together, inevitably there will be the odd year when including some cloud or haze is unavoidable.

groveR has a two step process for dealing with clouds:

  • Digitised clouds are converted to masks with the appropriate extents and pixel size for your data using make_mask().
  • Clouds are then accounted for in the correct annual mosaic using cloud_mask() which encodes the spatial location so that they can either be omitted from the analysis entirely or form part of a fuzzy classification where a probable classification based on the prior year’s data is constructed.

Use the make_mask() function

The user first familiarises themselves with the original mosaics, identifies cloud or smoke haze, digitises a polygon around them and saves the result as a shapefile. The shapefile must have an attribute column called “year” which is populated with the 4 digit year that the cloud was observed in. One shapefile can contain the digitised boundaries of all clouds identified through the entire time series of mosaics. The test data includes an example located at vectors/cloud_vectors.shp.

# The general form of the function is (NOTE the default parameters)
# make_mask(ivect, refimage, attribname = "year", loc ="raster_masks/cloud_masks")

# We only need to assign the first 2 parameters as the defaults are fine
ivect <- "vectors/cloud_vectors.shp"
refimage <- "veg_dens/lgcsmp_lsat_vdens_2011.tif"

# Run the function
make_mask(ivect, refimage)
  • ivect - input file path to cloud shapefile.
  • refimage - file path to any raster that has been created during processing thus far. The format of the raster is used as a template to create the cloud masks.

What’s going to happen?

One cloud mask for each unique year found in the attribute column of the cloud shapefile will be written to raster_masks/cloud_masks/.

Use the cloud_mask() function

Next we apply the cloud masks we just made to the appropriate vegetation density annual rasters.

# The general form of the function is (NOTE the default parameters)
# cloud_mask(irast, imask, ext = ".tif")

# We only need to assign the first 2 parameters as the defaults are fine
irast <- "veg_dens_mskd"
imask <- "raster_masks/cloud_masks"

# Run the function
cloud_mask(irast, imask)
  • irast - input masked veg density rasters directory.
  • imask - input cloud masks raster directory.

What’s going to happen now?

Any annual previously masked veg density rasters that had cloud will be encoded with a -99 where clouds were and written to the veg_dens_mskd_cld/. All non-cloudy previously masked veg density rasters will be copied over to the same directory and renamed.