A pixel can convert neatly into a decimal and still be unsuitable for the question being asked. This workshop separates a quality decision from a numerical transformation. You will apply a declared cloud-and-fill mask to three fictional Landsat pixels and scale only the retained value. No satellite image download or remote-processing account is required.
Keep the product definition attached to the numbers
USGS documents quality flags for Landsat Collection 2. For the Landsat 8–9 QA_PIXEL band, fill and cloud are represented by separate bits. The example below checks those flags only.
USGS gives Collection 2 Level 2 surface reflectance a scale factor of 0.0000275 and offset −0.2, with a fill value of zero. Other products use different transformations.
Do not transfer this formula to a temperature band or another collection merely because the input is an integer. Product, band and collection identity are part of the data contract. Basic decimal arithmetic and familiarity with a bit flag are enough for the paper exercise.
Declare the mask before calculating
The exercise excludes a pixel when its fill bit or cloud bit is set. It does not claim to implement every quality condition needed for a real analysis. The supplied clear pixel has neither of those two flags; any further real-world acceptance rule would need to be stated separately.
| Pixel | Reflectance DN | Supplied QA condition | Decision |
|---|---|---|---|
| A | 10000 | No fill or cloud flag | Keep for this exercise |
| B | 20000 | Cloud flag set | Exclude |
| C | 0 | Fill flag set | Exclude |
Write the decision column before scaling anything. That makes the quality choice visible and prevents an attractive decimal from becoming an accidental acceptance criterion.
Work the retained value
Pixel A:
10000 × 0.0000275 - 0.2
= 0.275 - 0.2
= 0.075
Pixel B: excluded by declared cloud rule
Pixel C: excluded as fill
Retained pixels: 1 of 3
The complete answer contains one retained reflectance value, 0.075, and two exclusions with reasons. It does not contain three usable reflectance measurements. Keep excluded pixels marked as excluded rather than replacing them with zero, which would introduce a different numerical meaning.
If B were converted without its quality decision, its arithmetic result would be 0.35. That calculation does not remove the cloud flag. Likewise, mechanically scaling the fill value would produce −0.2, but the fixture identifies it as fill rather than an observed surface value. Correct arithmetic cannot repair an inappropriate interpretation of the input.
Compare a deliberate rule change
For a sensitivity exercise, imagine an analyst explicitly chooses to retain cloudy pixels for a different inspection task. The output set would change, and its purpose would need a new label. It must not be presented as the original cloud-excluding result. Keep the two decisions side by side if comparing them.
Do not decide which rule is scientifically appropriate from this tiny table. A real analysis requires its own objective and quality policy. This workshop teaches how to make a declared decision auditable, not which pixels every application should use.
Write a compact processing record
Record the product identity, formula, quality rule, input count and retained count. Include the reason for each exclusion. If processing a larger dataset later, test the implementation on these three toy cases first and preserve the distinction between the mask and the transformed values.
The missing-data sensitivity workshop explores how changed inclusion rules change an answer. The data-dictionary exercise helps document units and special values. Continue in the workshop collection.
Questions about quality and scaling
Why not scale all three numbers and decide afterward?
Doing so can hide the reason an input is excluded. The worked answer keeps the quality decision attached to each pixel.
Does 0.35 make the cloudy pixel acceptable?
No. It is an arithmetic conversion, not evidence that the declared cloud-exclusion rule has been satisfied.
Is this a complete quality mask for every Landsat study?
No. Only two stated conditions are tested. A real application must identify its product and justify its full quality policy.
Official references
Checked 17 October 2026: USGS quality bands and scale factors. The three-pixel fixture is original.
Related guides
View the worked-example diagram

