Skip to main content
U.S. flag

An official website of the United States government

How is the C Function of Mask algorithm used with Landsat Level-1 data?

The C Function of Mask (CFMask) algorithm populates cloud, cloud confidence, cloud shadow, and snow/ice pixels in the processing of Landsat Collections Level-1 data products, with the results represented as bit-mapped values within the Landsat Collection 1 Level-1 Quality Assessment (QA) Band.  CFMask derives from the Function of Mask (FMask), an algorithm written in MATLAB at Boston University and translated into the C programming language at USGS EROS to facilitate its implementation in a production environment. The CFMask is also compatible with Collection 2 level-1 data products. 

CFMask is a multi-pass algorithm that uses decision trees to prospectively label pixels in the scene; it then validates or discards those labels according to scene-wide statistics. It also creates a cloud shadow mask by iteratively estimating cloud heights and projecting them onto the ground. 

While the CFMask algorithm is designed by default to be run with thermal data, it is possible to employ it without a thermal input. This may be necessary at times, such as when thermal data from Landsat 8 Thermal Infrared Sensor (TIRS) is not immediately available.   

Currently, non-thermal CFMask is run by removing all thermal threshold tests from the algorithm. Users should be aware that this change does alter the results of the cloud, cloud confidence, cloud shadow, and snow/ice detection routines.   

Learn more: CFMask Algorithm