To use the tests first decide which tests are relevant to the analysis and are to be used for masking data. For this example, all tests with an assessment of "Bad" are chosen, except for test 4 which is not in use. The tests used are [1, 2, 3, 5]. Test 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 arrays and equal to the values
Create an array of tests numbers to use in the mask
tests = [1, 2, 3, 5]
Create a single mask value combining all the tests from the 'tests' array.
mask = TOTAL(ISHFT(1L,tests-1), /PRESERVE_TYPE) ;
Show the flags set in the mask:
print, mask, FORMAT='(b)'
Search the companion QC field for at least one of the tests to be tripped. The result of the search is an array of indexes where at leat one of the 'tests' has been set as true. If none of the tests were tripped a single !NULL value is returned.
index = WHERE(qc_direct_normal_broadband AND mask, /NULL)print, index 0 1 2 3 8
Replace direct normal broadband data values where the companion QC field indicated a test was tripped to the IEEE Not A Number value to exclude from further analysis. If index is equal !NULL the data array is unchanged.
direct_normal_broadband[index] = !Values.F_NANprint, direct_normal_broadband NaN NaN NaN NaN 11.0 20.0 50.0 110.0 NaN 134.0