Skip to content

Commit 71efc11

Browse files
committed
Set MISSING flag at the end of check() to prevent override
1 parent 518c9f7 commit 71efc11

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ioos_qc/qartod.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,6 @@ def check(self, tinp, inp, zinp):
335335
flag_arr = np.ma.empty(inp.size, dtype='uint8')
336336
flag_arr.fill(QartodFlags.UNKNOWN)
337337

338-
# If the value is masked set the flag to MISSING
339-
flag_arr[inp.mask] = QartodFlags.MISSING
340-
341338
# Iterate over each member and apply its spans on the input data.
342339
# Member spans are applied in order and any data points that fall into
343340
# more than one member are flagged by each one.
@@ -388,11 +385,14 @@ def check(self, tinp, inp, zinp):
388385
fail_idx = np.zeros(inp.size, dtype=bool)
389386

390387
suspect_idx = (inp < m.vspan.minv) | (inp > m.vspan.maxv)
391-
388+
392389
with np.errstate(invalid='ignore'):
393390
flag_arr[(values_idx & fail_idx)] = QartodFlags.FAIL
394391
flag_arr[(values_idx & ~fail_idx & suspect_idx)] = QartodFlags.SUSPECT
395392
flag_arr[(values_idx & ~fail_idx & ~suspect_idx)] = QartodFlags.GOOD
393+
394+
# If the value is masked set the flag to MISSING
395+
flag_arr[inp.mask] = QartodFlags.MISSING
396396

397397
return flag_arr
398398

@@ -423,11 +423,11 @@ def climatology_test(config : Union[ClimatologyConfig, Sequence[Dict[str, Tuple]
423423
config: A ClimatologyConfig object or a list of dicts containing tuples
424424
that can be used to create a ClimatologyConfig object. See ClimatologyConfig
425425
docs for more info.
426+
inp: Input data as a numeric numpy array or a list of numbers.
426427
tinp: Time data as a sequence of datetime objects compatible with pandas DatetimeIndex.
427428
This includes numpy datetime64, python datetime objects and pandas Timestamp object.
428429
ie. pd.DatetimeIndex([datetime.utcnow(), np.datetime64(), pd.Timestamp.now()]
429430
If anything else is passed in the format is assumed to be seconds since the unix epoch.
430-
vinp: Input data as a numeric numpy array or a list of numbers.
431431
zinp: Z (depth) data, in meters positive down, as a numeric numpy array or a list of numbers.
432432
433433
Returns:

0 commit comments

Comments
 (0)