act.qc.QCFilter.add_step_change_test#

QCFilter.add_step_change_test(var_name, k=1.0, detrend=True, n_flagged=2, add_nan=False, test_meaning=None, test_assessment='Indeterminate', test_number=None, flag_value=False, prepend_text=None)#

Method to detect a shift change in values using the CUSUM (cumulative sum control chart) test.

Parameters:
  • var_name (str) – Data variable name in Dataset to use for testing. Results are inserted into accompanying embedded quality control variable.

  • k (float) – Reference value. This is typically around the value of the shift size change to to be detected when detrend=True. Will typically be around half the value of the shift size when no detrend is applied.

  • detrend (bool) – Remove the trend in the data by differencing the data before applying the CUSUM algorithm. Needed for most data that have atmospheric variability.

  • n_flagged (int) – Number of time steps to flag in the quality control variable. Default is to flag the point of and one after the step change since we will not know which value of the two will be suspect. Can set to any number of time steps or -1 to flag the remaining data after the detected step change.

  • add_nan (bool) – Should a NaN value be added to the data where a value is missing. A value is determined to be missing when the time step is larger than the mode of the difference in time values. This will stop the reporting of a step when there is an outage and the data normally rises/decends but with the gap is appears as a step change.

  • test_meaning (str) – Optional text description to add to flag_meanings describing the test. Will use a default if not set.

  • test_assessment (str) – Optional single word describing the assessment of the test. Will use a default if not set.

  • test_number (int) – Optional test number to use. If not set will use next available test number.

  • flag_value (boolean) – Indicates that the tests are stored as integers not bit packed values in quality control variable.

  • prepend_text (str) – Optional text to prepend to the test meaning. Example is indicate what institution added the test.

Returns:

test_info (tuple) – A tuple containing test information including var_name, qc variable name, test_number, test_meaning, test_assessment