Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

This page describes the quality and advisory flags provided with the soil moisture products. These flags allow users to identify pixels affected by surface conditions, processing limitations, or suitability constraints for specific applications.

The available flag layers vary by product:

All flags share the same spatial grid and dimensions within a given product.


Overview

Common properties:

Pixels with value 255 represent missing or undefined data and should be excluded from analysis.


PFLAG — Processing flag (pflag)

Applies to: D-MSSM only

Description: Bit flags that record the quality and processing success of the data.

Bit meanings

BitConditionMeaning when bit = 1
0Recommended qualityQuality not recommended
1Retrieval successfulRetrieval not successful

Recommended quality is determined from the QFLAG. If static and/or dynamic conditions are present, the retrieval is flagged as not recommended. The retrieval-successful state is determined from the DAI (Data Availability Index); when dai = 0, no soil moisture is retrieved and pflag is set to 3 (not recommended + not successful).


QFLAG — Quality flag (qflag)

Description: Bit flags that record surface conditions.

Each bit represents a condition that may affect retrieval quality. D-MSSM and D-ESSM/D-HSSM use different bit definitions.

D-MSSM qflag (7 bits)

BitConditionMeaning when bit = 1Recommended action
0Complex topographyComplex terrain presentUse with caution
1Urban areaUrban area detectedUse with caution or exclude
2Water bodyWater body detectedTypically exclude
3PrecipitationHeavy precipitation detectedUse with caution
4Snow and iceHigh snow/ice amounts detectedUsually exclude
5Freeze/thawFrozen ground detectedUsually exclude
6Dense vegetationDense vegetation detectedUse with caution

Static conditions (complex topography, urban area, water bodies) do not change over time. Dynamic conditions (precipitation, snow/ice, freeze/thaw, dense vegetation) vary with each observation.

D-ESSM / D-HSSM qflag (8 bits)

BitConditionMeaning when bit = 1Recommended action
0Terrain ruggednessComplex terrainUse with caution
1Urban areaBuilt-up surfaces presentUse with caution or exclude
2Permanent water bodyOpen waterTypically exclude
3Periodic water bodySeasonal waterOften exclude depending on application
4Dense vegetationStrong canopy effectsUse with caution
5Patchy vegetationHeterogeneous land coverModerate uncertainty
6RMSE of downscalingElevated downscaling errorConsider thresholding
7Freeze/thawFrozen ground conditionsUsually exclude

Multiple bits may be set simultaneously in both variants.

Interpreting values

Because QFLAG is a bitmask, the numeric value encodes a combination of conditions.

Examples (D-ESSM/D-HSSM):


EFLAG — Enhanced flag (eflag)

Applies to: D-ESSM and D-HSSM only

Description: Indicates where downscaling/enhancement has been applied.

EFLAG values

ValueMeaning
0Enhanced (downscaling applied)
1Not enhanced
255Missing / no data

EFLAG usage

EFLAG allows users to distinguish between pixels produced directly from source observations and those derived through enhancement or downscaling.

Typical uses:


AFLAG — Advisory flag (aflag)

Applies to: all products (D-MSSM, D-ESSM, D-HSSM)

Description: Binary indicator of whether soil moisture values are recommended for use.

AFLAG values

ValueMeaning
0Quality recommended
1Quality not recommended
255Missing / no data

AFLAG usage

AFLAG provides a high-level recommendation based on internal quality assessments. It is intended as a quick screening tool for users who prefer a simple accept/reject criterion.


Filtering should depend on the application and tolerance for uncertainty.

Conservative approach

Exclude pixels where:

Moderate approach

Exclude only major contamination sources:

Application-specific filtering

Some applications may retain pixels flagged for vegetation or urban areas, while others may exclude them.


Example: decoding flags in Python

import xarray as xr

ds = xr.open_dataset("...")

qflag = ds["qflag"]
aflag = ds["aflag"]

# Mask missing values
valid = (qflag != 255) & (aflag != 255)

# Function to test whether a bit is set
def bit_is_set(data, bit):
    return (data & (1 << bit)) != 0

# Example masks (D-ESSM / D-HSSM)
is_perm_water = bit_is_set(qflag, 2)
is_seasonal_water = bit_is_set(qflag, 3)
is_frozen = bit_is_set(qflag, 7)

# Conservative filtering
mask = valid & (aflag == 0) & ~(is_perm_water | is_seasonal_water | is_frozen)

# Apply to soil moisture variable (replace 'sm' with actual name)
sm_filtered = ds["sm"].where(mask)