Scripting > Math Functions


Screen for Erroneous Values Based on Maximum/Minimum Range


screenWithMaxMin(floating-point minValueLimit,

      floating-point maxValueLimit,

      floating-point changeLimit,

      boolean setInvalidToMissingValue,

      string qualityFlagForInvalidValue)

 

Flag values in a time series data set exceeding minimum and maximum limit values or maximum change limit.

 

Values in the time series are screened for quality. Values below minValueLimit or above maxValueLimit or with a change from the previous time series value greater than changeLimit fail the screening test.  The maximum change comparison is done only when consecutive values are not flagged.

 

If setInvalidToMissingValue is set to true, values failing the screening test are set to the "Missing" value.

 

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 is set to "Okay.”

 

For example:

 

resultantDataSet = dataSet.screenWithMaxMin ( 0.0, 1000., 100., Constants.FALSE,  “R” )

 

time series values less than 0.0, or greater than 1000., or with a change from a previous point greater than 100 will be flagged as “Rejected.”  Flagged points however will not be set to the “Missing” value.

 

Parameters:

minValueLimit – A floating-point number specifying the minimum valid value limit.

maxValueLimit - A floating-point number specifying the maximum valid value limit.

changeLimit - A floating-point number specifying the maximum change allowed in the tested value from the previous time series 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.screenWithMaxMin(

      0.,

      1000.,

      100.,

      Constants.FALSE,

      “R”)

Returns: A new TimeSeriesMath object.

Generated Exceptions: Throws a HecMathException if an unrecognized quality flag is entered for qualityFlagForInvalidValue or if setInvalidToMissingValue is false and qualityFlagForInvalidValue is blank (no action would occur).