Screen for Erroneous
Values Based on Forward Moving Average
screenWithForwardMovingAverage(integer
numberToAverageOver,
floating-point
changeLimit,
boolean
setInvalidToMissingValue,
string
qualityFlagForInvalidValue)
Screen the current time series data set for possible erroneous values based on the deviation from the forward moving average over numberToAverageOver values computed at the previous point. If the deviation from the moving average is greater than changeLimit, the value fails the screening test. Data values failing the screening test are assigned a quality flag and/or are set to missing.
Missing values and values failing the screening test are not counted in the moving average and the divisor of the average is less one for each such value. At least 2 values must be defined in the moving average else the moving average is undefined and value being examined is screened acceptable.
If setInvalidToMissingValue is true, values failing the screening test are set to missing.
If qualityFlagForInvalidValue is set to a character or string recognized as a valid quality flag, the quality flag will be set for tested values. If there is no previously existing quality available for the time series, the quality flag array will be created for the time series. Values failing the quality test are set to the user specified quality flag for invalid values. If there is existing quality data and the time series value passes the quality test, the existing quality flag for the points is unchanged. If there was no previously existing quality and the time series value passes the quality test, the quality flag for the point is set to "Okay.”
The acceptable values for qualityFlagForInvalidValue strings are: "M" or "Missing”, "R" or "Rejected”, "Q" or "Questionable.” A blank string (" ") is entered to disable the setting of the quality flag.
For the example:
resultantDataSet = dataSet.screenWithForwardMovingAverage (
16, 100., Constants.TRUE, “R” )
the forward moving average will be computed over 16 values, values deviating from the moving average by more than 100.0 will be set to missing and flagged as rejected.
Parameters:
numberToAverageOver – An integer specifying the number of averaging
values. Must be at least 2.
changeLimit – A floating-point number specifying the maximum change allowed
in the tested value from the forward moving average value.
setInvalidToMissingValue – Either Constants.TRUE, or Constants.FALSE,
specifying whether time series values failing the screening test are set to the "Missing"
value.
qualityFlagForInvalidValue - A string representing the quality flag setting
for values failing the screening test. The accepted character strings are: "M" or
"Missing”, "R" or "Rejected”, "Q" or "Questionable.” An empty string (“ ”) is
entered to disable the setting of the quality flag.
Example:
screenedData = tsData.screenWithForwardMovingAverage(
16,
100.,
Constants.TRUE,
“R”)
Returns: A new TimeSeriesMath object.
Generated Exceptions: Throws a HecMathException if numberToAverageOver is less
than 2; if an unrecognized quality flag is entered for qualityFlagForInvalidValue or if setInvalidToMissingValue is false and qualityFlagForInvalidValue is blank (no
action would occur).