This exercise will examine cloud masks using r.

This file shows not only cloud cover, but cloud shadow and water in the image.

Next, we’ll evaluate our data using NA values in place of cloud and shadow values.

cloud_mask_189[cloud_mask_189 > 0] <- NA
plot(cloud_mask_189,
     main="New raster mask",
     col=c("green"),
     legend=F,
     axes=F,
     box=F)
par(xpd=T) # force legend to plot outside of the plot extent
legend(x = cloud_mask_189@extent@xmax, cloud_mask_189@extent@ymax,
       c("Not masked", "Masked"),
       fill=c("green", "white"),
       bty="n")

Next the mask is applied to all bands in the data:

all_landsat_bands_mask <- mask(all_landsat_bands_st, mask = cloud_mask_189)
par(col.axis="white", col.lab="white", tck=0)
plotRGB(all_landsat_bands_mask,
        r=4, g=3, b=2,
        stretch="lin",
        main="RGB image - clouds removed from image",
        axes=T)
box(col="white")

It appears this image has a large proportion of the study area with NA values. The next step is to search for other imagery for this region with the same quality, in the timeframe needed. The affected area under study is small, limiting the options for data sources.