Transform Time Series to
Regular Interval
transformTimeSeries(string
timeIntervalString,
string
timeOffsetString,
string
functionTypeString )
Generate a new regular interval time series data set from the current regular or irregular time series. The new time series is computed having the regular time interval specified by timeIntervalString and time offset set by timeOffsetString.
Values for the new time series are computed from the original time series data set using one of seven available functions. The function is selected by setting functionTypeString to one of the following types:
"INT" - Interpolate at end of interval
"MAX" - Maximum over interval
"MIN" - Minimum over interval
"AVE" - Average over interval
"ACC" - Accumulation over interval
"ITG" - Integration over interval
"NUM" - Number of valid data over interval
where “interval” is the interval between time points in the new time series.
The regular interval time of the new time series is specified by timeIntervalString. timeIntervalString is a valid HEC time increment string (e.g. “1MIN”, “15MIN”, “1HOUR”, “6HOUR”, “1DAY”, “1MONTH”).
Times in the resultant time series may be shifted (offset) from the regular interval
time by the increment specified by timeOffsetString. As an example,
the offset could be used to shift times from the top of the hour to 6 minutes past the
hour. Typically no offset is used.
The data type of the original time series data governs how values are interpolated. Data type “INST-VAL” (or “INST-CUM”) considers the value to change linearly over the interval from the previous data value to the current data value. Data type “PER-AVER” considers the value to be constant at the current data value over the interval. Data type “PER-CUM” considers the value to increase from 0.0 (at the start of the interval) up to the current value over the interval. Interpolation of the three data types is illustrated in the figure below.
Interpolation of “INST-VAL”, “PER-AVER” and “PER-CUM” data
How interpolation is performed for a specific data type influences the computation of new time series values for the selected function. For example, if the data type is “INST-VAL”, the function “Maximum over interval” is evaluated by: Finding the maximum value of the data points from the original time series that are inclusive in the new time interval. Linearly interpolate values at beginning and ending of the new time interval, and determine if these values represent the maximum over the interval.
Referring to the plots in the figure above, the “Average over interval” function is applied to a time series by integrating the area under the curve between interpolated points and dividing the result by the interval time.
See also: transformTimeSeries( TimeSeriesMath tsData, string functionTypeString )
Parameters:
timeIntervalString – A string specifying the regular time interval for the
resultant time series.
timeOffsetString – A string specifying the offset of the new time points
from the regular interval time. This variable may be a blank string (“ ”).
functionTypeString – A string specifying the method for computing values
for the new time series data set.
Example:
newTsData = tsData.transformTimeSeries(
“1Day”,
“0M”,
“AVE”)
Returns: A new regular interval TimeSeriesMath object.