|
|
To use the tests decide which bits are relevant to the analysis and are to be used for masking data from the analysis. [For this example](direct-normal-broadband), all bits with an assessment of "Bad" are chosen, except for bit 4 which is not in use. The bits used are 10111. Bit 6 is described as "Indeterminate" and will not be part of the mask applied to the data.
|
|
|
|
|
|
For this example, assume the data and companion QC fields are ten element vectors and equal to the values
|
|
|
|
|
|
direct_normal_broadband = c(10, 9, -1, -0.1, 11, 20, 50, 110, 12200, 134)
|
|
|
qc_direct_normal_broadband = c(16, 16, 3, 1, 0, 0, 0, 0, 4, 32)
|
|
|
|
|
|
Create a mask representing all the tests of interest. Flags are packed right to left.
|
|
|
|
|
|
mask <- strtoi("010111", base = 2)
|
|
|
|
|
|
Search the companion QC field for at least one of the tests to be tripped, and replace those values with IEEE NaN value to exclude from further analysis. Could also use R 'NA' value.
|
|
|
|
|
|
exclude_mask = bitwAnd(qc_direct_normal_broadband, mask) != 0
|
|
|
|
|
|
direct_normal_broadband[exclude_mask] = NaN
|
|
|
print(direct_normal_broadband)
|
|
|
[1] NaN NaN NaN NaN 11 20 50 110 NaN 134 |
|
|
\ No newline at end of file |