Skip to content

Commit

Permalink
Fix flagging logic for missing and unknown data in QARTOD spike test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakshamgupta90 committed Aug 13, 2024
1 parent e56dec6 commit 5ffa1c6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ioos_qc/qartod.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,17 @@ def spike_test(
flag_arr[0] = QartodFlags.UNKNOWN
flag_arr[-1] = QartodFlags.UNKNOWN

# If the value is masked or nan set the flag to MISSING
flag_arr[diff.mask] = QartodFlags.MISSING

# Check if the original data was masked
for i in range(inp.size):

# Check if both inp and diff are masked
if inp.mask[i] and diff.mask[i]:
flag_arr[i] = QartodFlags.MISSING

# Check if either inp or diff is masked
elif inp.mask[i] or diff.mask[i]:
flag_arr[i] = QartodFlags.UNKNOWN

return flag_arr.reshape(original_shape)


Expand Down

0 comments on commit 5ffa1c6

Please sign in to comment.