Cloud Masking
Optical remote sensing works only when the sensor can actually see the ground, and a great deal of the time it cannot. Between satellite and surface lies an atmosphere often full of cloud, and the clouds that block the view cast shadows that darken the scene beside them. Because the Digital Imagery concept treats every pixel as a measurement of energy from a patch of the Earth’s surface, a pixel that instead recorded a cloud top, its shadow, or scattered haze is no measurement of the surface at all — it is a contaminated observation wearing the same numeric clothes as a good one. Cloud masking is the preprocessing step that finds those contaminated pixels and sets them aside, so that everything downstream runs only on observations that genuinely saw the ground. These ideas concern the physics of the observation rather than any particular tool, so they hold whatever software you later use to build or apply a mask.
Why clouds and shadows confound optical interpretation
Clouds are bright and opaque, so a clouded pixel carries the reflectance of the cloud top rather than of the land beneath it — the surface signal is simply gone. Worse, cloud is often brighter than almost anything on the ground, so even a few undetected cloudy pixels pull averages upward and can saturate a band entirely. Cloud shadows do the opposite, suppressing the light reaching the surface so that a shadowed field can mimic water or a genuinely dark material. Between the two extremes sits haze and thin cirrus, only partly transparent; they add scattered light and blur the surface without ever announcing themselves as an obvious white blob, which makes them the most insidious contaminant of all.
A further difficulty is that some legitimate surfaces resemble cloud. Snow, ice, salt flats, and bright artificial surfaces are all highly reflective across the visible range, so a detector tuned simply to “bright” confuses them with cloud and erases real data — telling bright cloud from bright ground is one of the central problems of masking, not an edge case. And the damage is cumulative: contamination that survives biases every statistic computed from it, and across dates a single undetected cloud reads as change that never happened.
Detecting cloud, shadow, and haze
Detection strategies fall into three broad families, usually combined rather than used alone. The first is a quality band: many datasets ship a per-pixel flag, computed by the data provider, marking each cell as clear, cloud, shadow, or snow. It is the cheapest option to apply but only as good as the provider’s algorithm and its fixed thresholds, so it can be conservative in one scene and leaky in the next. The second is a cloud-probability layer, which replaces the hard yes/no with a continuous per-pixel likelihood of cloud, letting you set your own threshold and choose deliberately where to sit between missing cloud and discarding clear ground rather than inheriting someone else’s cut-off.
The third family reasons directly from the measurements, using spectral tests grounded in the Spectral Bands concept. Clouds are not just bright but spectrally flat and white — high across the visible bands together — and cold in the thermal, so brightness, whiteness, and temperature tests each catch part of the cloud population. The confusion with snow is resolved in the shortwave infrared, where snow reflectance falls away sharply while cloud stays bright, a contrast a normalised snow index exploits. Shadows are found geometrically as much as spectrally: from the solar and viewing angles in the metadata, the shadow each detected cloud must cast can be projected onto the ground and confirmed with a darkness test. No single test is decisive — bright buildings trip the brightness test, terrain shadow the darkness test — so robust masks combine several, accepting a judged estimate rather than a certainty.
Masking versus down-weighting uncertain observations
Once contamination is estimated, there are two ways to act on it. Masking makes a binary decision: a flagged pixel is removed, marked as nodata in the sense the Digital Imagery concept describes, and excluded from every later calculation. This is honest and simple, the right default when clear observations are plentiful; its cost is that it discards partially usable information and, if aggressive, can leave a pixel with too few clear dates to work with. Down-weighting instead keeps the observation but reduces its influence in proportion to confidence, so a marginal, hazy pixel contributes a little while a clearly clean one contributes fully. This degrades gracefully and preserves scarce data, at the price of more complexity and a reliance on the confidence estimate being trustworthy. The choice turns on how many clear observations you can afford to lose and whether the downstream method can carry weights at all.
The effect of masking on composites and time series
Masking is precisely what makes clean composites and a usable Time Series possible. A composite collapses many dates into one image by drawing, for each pixel, on whichever observations were clear, so a cell clouded on one date is filled from another — which works only if the contaminated observations were removed first. Masking is therefore a precondition for compositing, not an afterthought.
But removing pixels reshapes the record in ways worth watching. It makes the series irregular — some dates lose most of their pixels, others survive intact — and thins the effective cadence unevenly across a scene. More subtly, when cloudiness is itself seasonal — a persistent wet season, say — the surviving observations are biased toward the clear part of the year, so the record over-represents dry conditions: a real sampling bias, not random noise. And any contamination the mask misses becomes the classic source of a spurious spike in a series or a false alarm in Change Detection. Over-masking carries its own cost, erasing legitimate bright surfaces and opening gaps, so the goal is a mask that is neither so loose that cloud leaks through nor so tight that it eats the data.
Checking masks visually and statistically
A mask is a classifier, and like any classifier it makes two kinds of error. A false positive, or commission error, flags a clear pixel as cloud and so erodes good data, most often over the bright surfaces that look cloud-like. A false negative, or omission error, lets a contaminated pixel through, leaking noise into later results; it is the more dangerous of the two because it is invisible until the artefact surfaces later. No threshold removes both at once, so masking settles for a defensible balance rather than a perfect answer.
Because of that, a mask must be checked, both by eye and by number. Visually, overlaying it on a natural- or false-colour composite shows whether the flagged pixels really are cloud and whether the diffuse fringes and displaced shadows were caught — residual haze at a cloud’s edge is the usual leak. Statistically, a well-masked composite or series should be smoother and free of implausible spikes: comparing the value distribution before and after masking, and tracking the fraction of pixels masked per date, gives an honest health signal — a date that comes back almost entirely masked, or an index that still jumps between clear dates, points to a mask that needs adjusting. Ultimately the mask is judged by the product it serves — fewer false alarms in a change map, a cleaner seasonal curve — and which error to prefer follows from that purpose.
Cloud masking, then, is less a single algorithm than a disciplined judgement about which observations may speak for the surface. It sits at the gate of the optical workflow, so everything after it — indices, composites, time series, change maps — inherits the quality of that judgement. Done well it is almost invisible: its payoff is the absence of a cloud-shaped artefact in results that would otherwise report the sky as if it were the ground.