Scripting > Math Functions


Generate Data Pairs from Two Time Series

generateDataPairs(TimeSeriesMath tsData,

      boolean sort)

 

Generate a paired data set by pairing values (by time) from the current time series data set and the time series data set tsData.  The values of the current time series form the x-ordinates, while values from tsData form the y-ordinates of the resulting paired data set.  The times in the two time series data sets must match exactly.  If a value for a time is missing in either time series, no data value pair is formed or added to the paired data set.  If sort is “true”, data pairs in the paired data set are sorted by ascending x-value. 

 

The units and parameter type from the current time series data set are assigned to the paired data set x-units and x-parameter type.  The units and parameter type from tsData are assigned to the paired data set y-units and y-parameter type. 

 

An example application of the function would be to mate a time series record of stage to one of flow to generate a stage-flow paired data set. 

 

Parameters:

tsData – A TimeSeriesMath object that forms the y-ordinates of the resulting paired data set.

sort – Either Constants.TRUE, or Constants.FALSE, value.  If true, sort data pairs in ascending x-value.  If false, leave unsorted.

Example: ratingCurve = tsStage.generateDataPairs(tsFlow)

Returns: A PairedDataMath object with x-ordinates from the current time series, and y-ordinates from tsData.

Generated Exceptions:  Throws a hec.hecmath.HecMathException if times from the current time series and tsData do not match exactly.