Currently the MCD43 code in the pre processor doesn't take into account the quality flags that accompany the data. Indeed, we don't even read the QA flags.
This leads to issues when the MODIS BRDF cannot be inverted in the upstream code, as it will then fall back to a magnitude inversion or - in particularly bad cases - fill values. In this PR I update ORAC to read the QA flag and apply filtering if requested by the user. By default, no filtering is done (i.e: Behaviour remains same as now).
Users can set the desired QA threshold by passing MCD43_MAX_QAFLAG=n via the preprocessor driver file, where n is the desired maximum QA value.
QA values are defined as follows:
- 0: best quality, 100% with full inversions
- 1: good quality, 75% or more with best full inversions and 90% with full inversions
- 2: relative good quality, 75% or more with full inversions
- 3: mixed, 75% or less full inversions and 25% or less fill values
- 4: all magnitude iversions or 50% or less fill values
- 5: 50% or more fill values
- 255: fill value
Setting MCD43_MAX_QAFLAG to 3 for example, will allow pixels with QA values of 0, 1, 2, or 3 to pass while those with values of 4, 5 or 255 will be set to the fill value.
Below is an example of how this can be used to filter bad quality retrievals, in this case cloud contamination in the BRDF magnitude inversion:
Currently the MCD43 code in the pre processor doesn't take into account the quality flags that accompany the data. Indeed, we don't even read the QA flags.
This leads to issues when the MODIS BRDF cannot be inverted in the upstream code, as it will then fall back to a magnitude inversion or - in particularly bad cases - fill values. In this PR I update ORAC to read the QA flag and apply filtering if requested by the user. By default, no filtering is done (i.e: Behaviour remains same as now). Users can set the desired QA threshold by passing
MCD43_MAX_QAFLAG=n
via the preprocessor driver file, wheren
is the desired maximum QA value. QA values are defined as follows:Setting
MCD43_MAX_QAFLAG
to3
for example, will allow pixels with QA values of 0, 1, 2, or 3 to pass while those with values of 4, 5 or 255 will be set to the fill value.Below is an example of how this can be used to filter bad quality retrievals, in this case cloud contamination in the BRDF magnitude inversion: