ioos / ioos_qc

:ballot_box_with_check: :ocean: IOOS QARTOD and other Quality Control tests implemented in Python
https://ioos.github.io/ioos_qc/
Apache License 2.0
46 stars 27 forks source link

QARTOD Spike_test: Adding an optional second method #48

Closed JessyBarrette closed 3 years ago

JessyBarrette commented 3 years ago

IOOS_QC QARTOD Spike_Test is a direct implementation of the spike test described within the QARTOD Manual. This algorithm is acting in some conditions similarly than the the rate_of_change test. We present here a potential implementation of an alternative method which will target exclusively the single spike values over a certain threshold.

I suggest implementing this second method as an option within the QARTOD spike_test via a method optional input and keeping the original average method as the default one.

The method consider essentially that a value N is flagged if the following conditions are respected:

""

To highlight the difference between the two methods, an example can be find here within a jupyter notebook which is using the following vector and threshold values:

Average Method (suggested by QARTOD)

By applying the regular QARTOD Spike method, we get the following result: image

Differential Method (suggested alternative method)

Here's the results in similar conditions for the suggested differential method. image

As shown, the second method only flag the single spike values without flagging records that are associated with a strong preceding jump. The QARTOD rate of change test can then be use to flag those data more rigorously if desired.

kwilcox commented 3 years ago

Fixed in https://github.com/ioos/ioos_qc/pull/50