hypergas.quality_mask module#
Create a 2D quality mask for hyperspectral satellite data.
- class hypergas.quality_mask.QualityMask(scn)[source]#
Bases:
objectQuality mask for hyperspectral satellite scenes.
Computes per-pixel boolean flags for water, cloud, and cirrus contamination based on top-of-atmosphere (TOA) reflectance thresholds, and combines them into a single
qmaskDataArray.- Parameters:
scn (
Scene) –Satpy Scene that must contain the following datasets:
'radiance'– spectral radiance in W m-2 sr-1 um-1, with dimensions(bands, y, x).'sza'– solar zenith angle in degrees, shape(y, x).
- scn#
The input scene (stored for reference).
- Type:
Scene
- qmask#
Combined quality mask with a
quality_flagdimension whose labels are['water', 'cloud', 'cirrus', 'invalid'].- Type:
- cirrus_mask(rho=None)[source]#
Identify cirrus cloud pixels using TOA reflectance at 1380 nm.
The 1380 nm water-vapour absorption band is used as a cirrus proxy: surface-leaving radiance is almost entirely absorbed by atmospheric water vapour at this wavelength, so any residual reflectance above the threshold is attributed to high-altitude cirrus ice clouds.
Sets
self.cirrusto a booleanDataArrayof shape(y, x).References
Gao & Goetz, GRL, 20(4), 301–304, 1993. https://doi.org/10.1029/93GL00106
- cloud_mask(rho=None)[source]#
Identify cloud pixels using multi-band TOA reflectance thresholds.
Three independent reflectance tests are applied:
450 nm > 0.28 (high visible reflectance)
1250 nm > 0.46 (high short-wave infrared reflectance)
1650 nm > 0.22 (high short-wave infrared reflectance)
A pixel is flagged as cloudy only when all three conditions are satisfied (majority vote ≥ 3 out of 3), reducing false positives over bright land surfaces.
Sets
self.cloudto a booleanDataArrayof shape(y, x).References
Sandford et al., AMT, 13, 7047–7057, 2020. https://doi.org/10.5194/amt-13-7047-2020
- mask()[source]#
Compute all individual masks and combine into
self.qmask.Calls
water_mask(),cloud_mask(), andcirrus_mask()in sequence, then concatenates the results along a newquality_flagdimension. An additional'invalid'flag is appended that isTruewherever any of the three masks isTrue.After calling this method the combined mask is available as
self.qmaskwith shape(quality_flag, y, x)andquality_flaglabels['water', 'cloud', 'cirrus', 'invalid'].