Scripting > Math Functions


Period Constants Generation

periodConstants(TimeSeriesMath tsData)

Derive a new time series data set by applying values in the current time series data set to the times defined by the time series data set tsData.  Both time series data sets may be regular or irregular interval.  Values in a new time series are set according to:

 

ts1(j)  ≤  tsnew(i)  <  ts1(j+1) ,      TSNEW(i)  =  TS1(j)

 

where ts1 is the time in the current time series, TS1 is the value in the current time series, tsnew is the time in the new time series, TSNEW is the value in the new time series.

 

If times in the new time series precede the first data point in the current time series, the value for these times is set to missing.  If times in the new time series occur after the last data point in the current time series, the value for these times is set to the value of the last point in the current time series.   The interpolation of values with the periodConstants function is shown the the figure below.

 

Interpolation of Time Series Values Using Period Constants function

 

Parameters:

tsData – A regular  or irregular interval time series data set.

Example:

tsConstants = tsValues.periodConstants(tsData)

Returns: A new TimeSeriesMath object.