
extracts five classes from QA band: background, cloud, cirrus, snow and water. NOTE: THE NEW USGS LANDSAT COLLECTION 1 DATA HAS CHANGED THE QA BITWORD ASSIGNMENTS. THIS IS NOT YET IMPLEMENTED HERE. DO NOT USE encodeQA, decodeQA and classifyQA FOR LANDSAT COLLECTION 1 DATA (yet)!
classifyQA(img, type = c("background", "cloud", "cirrus", "snow", "water"),
confLayers = FALSE, ...)
RasterLayer. Landsat 8 OLI QA band.
Character. Classes which should be returned. One or more of c("background", "cloud", "cirrus","snow", "water").
Logical. Return one layer per class classified by confidence levels, i.e. cloud:low, cloud:med, cloud:high.
further arguments passed to writeRaster
Returns a RasterLayer with maximal five classes:
class | value |
background | 1L |
cloud | 2L |
cirrus | 3L |
snow | 4L |
water | 5L |
Values outside of these classes are returned as NA.
If confLayers = TRUE
then a RasterStack with one layer per condition (except 'background') is returned, whereby each layer contains the confidence level of the condition.
Confidence | value |
low | 1L |
med | 2L |
high | 3L |
By default each class is queried for *high* confidence. See encodeQA for details. To return the different confidence levels per condition use confLayers=TRUE
.
This approach corresponds to the way LandsatLook Quality Images are produced by the USGS.
# NOT RUN {
library(raster)
qa <- raster(ncol = 100, nrow=100, val = sample(1:2^14, 10000))
## QA classes
qacs <- classifyQA(img = qa)
## Confidence levels
qacs_conf <- classifyQA(img = qa, confLayers = TRUE)
# }
Run the code above in your browser using DataLab