# SST Quality Flags

## Quality Tests

A series of quality tests are performed for each sst or sst4 retrieval. The quality tests are used to set the quality levels, which are then used to control the Level-3 binning process. For the l2gen implementation, each quality test was assigned a bit in a product-specific flag array. A separate, 16-bit flag product is created for both the short-wave (sst4) and long-wave (sst) products (flags_sst4 and flags_sst, respectively). The 16 flag bits are assigned as follows:

Bit Name Description
02 BTRANGE Brightness temperatures are out-of-range for top of the atmosphere realistic ocean surface values, -4 to 37 °C
03 BTDIFF Brightness temperatures spectral differences between channels are outside of expected valid ranges, 0 – 1.6 °C
04 SSTRANGE SST outside valid range -1.8 to 45 °C
05 SSTREFDIFF Retrieved SST is too different from Reynolds reference field. Threshold is > -3 °C non dust regions and a more stringent > -1.25 °C in known dust region defined as 10S to 30N latitude and 105W and 105E longitude.
06 SST_triple_DIFF Longwave NSST is different from SST_triple
07 SST_triple_VDIFF Longwave NSST is very different from shortwave SST_triple
08 BTNONUNIF Brightness temperatures are spatially non-uniform > 0.7 °C
09 BTVNONUNIF Brightness temperatures are very spatially non-uniform ° 1.2 °C
10 spare spare
11 REDNONUNIF Red-band reflectance spatial non-uniformity or saturation > 0.01. Test not applied in sun glint region.
12 HISENZ Sensor zenith angle high > 55 degrees
13 VHISENZ Sensor zenith angle very high > 65 degrees
14 SSTREFVDIFF SST is too different from reference > 5 °C
15 SST_CLOUD Pixel failed the cloud Alternating decision tree
Set if the SST processing is not performed because the pixel was masked prior to invocation. The l2gen code allows the user to specify a number of masking conditions. For standard SST processing, the only condition which would likely be selected for masking by l2gen at this stage is if the pixel is over land.

Set if the observed radiances are beyond the limits of the radiance to brightness temperature tables, such that brightness temperatures can not be determined. This generally indicates saturation of one of the critical IR channels.

• BTRANGE
Set if one of the brightness temperatures falls outside the physically realistic range for ocean observations. The currently accepted range is $-4$ to $37^{\circ}C$. The $4\mu$ band has a range of $-4$ to $35^{\circ}C$.

• BTDIFF
Set if the brightness temperature difference falls outside the physically realistic range for ocean observations. For long-wave SST, $dBT = BT11 - BT12$ and the currently accepted range for dBT is $0$ to $3.6^{\circ}C$. For short-wave SST, $dBT = BT39 - BT40$ and the currently accepted range for dBT is $0$ to $8^{\circ}C$.

• SSTRANGE
Set if the SST retrieval falls outside the physically realistic range for ocean observations. The currently accepted range is $-2$ to $40^{\circ}C$ during the day and $-2$ to $37^{\circ}C$ at night.

• SSTREFDIFF
Cold test. Set if $SST - REFSST \ge -3.0$. This prevents flagging, as bad, good pixels that may be warmer than reference as a result of the diurnal heating of the skin surface at low wind speeds during the day. In regions likely to be contaminated by dust, where retrievals are generally colder, a more stringent cold threshold is applied: $SST - REFSST \ge -1.25$. The Dust Region is defined as falling within a latitude $\le 30N$ and $\gt 10S$ and longitude of and between $105 E$ and $105W$.
Cold tests are problematic in regions of high spatial variability (e.g., frontal boundaries), as the sstref field is very low in spatial resolution and smoothed over time.

• SST4DIFF
This test is only applicable at night. Set if the absolute difference between the long-wave and short-wave SST retrieval exceeds $0.8^{\circ}C$.

• SST4VDIFF
This test is only applicable at night. Set if the absolute difference between the long-wave and short-wave SST retrieval exceeds $1.0 ^{\circ}C$.

• BTNONUNIF
Set if one of the required brightness temperatures shows evidence of spatial non-uniformity. The uniformity is determined by examination of the $3\times3$-pixel area around the pixel of interest. If the difference between the maximum value and the minimum value in that $9$-pixel set exceeds $0.7^{\circ}C$, the bit is set. This test does have a tendency to flag frontal boundaries and coastlines.

• BTVNONUNIF
Set if one of the required brightness temperatures shows a high degree of spatial non-uniformity. The test is identical to that of BTNONUNIF, but with a larger threshold. If the difference between the maximum value and the minimum value in the $9$-pixel set exceeds $1.2^{\circ}C$ the bit is set.

• REDNONUNIF
This test is only valid for daytime, and therefore only relevant to the long-wave SST product. Top-of-atmosphere reflectance, $\rho_t$, in the $678$-nm band (MODIS band 14) is computed over the $3\times3$ pixel area centered on the pixel of interest, where $$\rho_t = \frac{\pi \times L_t}{F_0 \times \mu_0 \times t \times t_0 \times t_{oz}}$$ and $L_t$ is observed TOA radiance, $F_0$ is band-averaged solar irradiance (at day of year), $\mu_0$ is cosine of solar zenith angle, $t_0$ and $t$ are the diffuse transmittance through a Rayleigh atmosphere (solar path and sensor path), and $t_{oz}$ is the ozone transmittance (inbound and outbound). If the the difference between the maximum value and the minimum value of $\rho_t$ in the $9$-pixel set exceeds $0.01$, the bit is set.
This bit is also set if $8$ or more of the $9$ pixels are saturated in the $678$-nm band. In general, such saturation might indicate the presence of clouds, but it may also indicate the presence of sun glint. The long-wave SST is affected by clouds (SST retrieval appears colder than normal), but not by sun glint. To recover the sun glint case, the REDNONUNIF bit is only set if the retrieved SST is more than $1^{\circ}C$ colder than the reference. This secondary requirement works best in locations with temporally and spatially stable SST conditions, where the low-resolution sstref and the retrieved SST can be expected to be consistent. The saturation test is a much more stringent test than the original uniformity test. The new test is can be summarized as: set if red band reflectance in the pixel neighborhood is saturated OR spatially nonuniform AND SST retrieval is cold relative to the reference.

• HISENZ
Set if the sensor zenith angle exceeds $55^{\circ}$. For l2gen, this is redundant with the HISATZEN bit in the l2_flag array, but with a different standard threshold.

• VHISENZ
Set if the sensor zenith angle exceeds $75^{\circ}$. This is rare.

• SSTREFVDIFF
Set to indicate that the difference between the retrieved SST and the reference is very large ($5^{\circ}C$). The related flag, SSTREFDIFF, indicates that the difference between the retrieved SST and the reference is moderately large ($3^{\circ}C$).

• SST_CLOUD
Set if pixels fail either the day or night decision tree indicating a likely problem/contaminate in the atmosphere that may lead to failure of the SST atmospheric correction algorithm. Note that the SST_CLOUD flag is distinct from the OC_CLOUD flag.

## Quality Levels

The quality tests described above are used to set quality levels between 0 and 4, where 0 indicates best quality and 4 indicates complete failure or masked (usually land). The quality level determination varies between day and night conditions, and between the short-wave and long-wave SST products. The following tables show the quality test bits and associated quality levels. If no bits are set then the quality level is 0 but for short-wave SST retrievals in daylight the quality level is always set to 3 (bad) or 4 (failed or not computed). The quality level information for each SST product, sst and sst4, can be output by $l2gen$ as products $qual\_sst$ and $qual\_sst4$, respectively.

SST Flags 2-band SST Day Minimum Quality Level 2-band NSST Night Minimum Quality Level 3-band SST_triple Minimum Quality Level