...
- outputVariable
Description
Equidistant Timeseries
This transformations calculates the mean value of instantaneous values over a certain period. If the options option allowMissingValues is enabled true, then a mean missing value is calculated if there 1 or more valid returned if one of the input values in the aggregation period is a missing value. If the option is disabled a missing value returned if one of the allowMissingValues is false (this is the default behaviour), then a mean value is calculated if there are 1 or more non-missing values in the period is a missing valueaggregation period, i.e. missing values are ignored in this case.
The transformation offers two options different ways for calcuating calculating the mean value over a period. The default method (used by setting the includeFirstValueOfAggregationPeriodInCalculation option to true - this is the default behaviour) takes calculates the mean of the last n pairs, averages that, and stores it at the output time. An alternate method (similar to the MeanToMean aggregation) is enabled by setting the includeFirstValueOfAggregationPeriodInCalculation option to false) takes the last n calculates the mean of all values that fit in the output interval (includding , excluding the start time itself) , and stores these that at the output time.
In the table four tables below an example examples of in and output using both methods is given:
the different options are given.
Example for includeFirstValueOfAggregationPeriodInCalculation = true and allowMissingValues = false:
Date/Time | Input Value | Calculation | Output Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|
2007-01-01 00:00 | 1 | Original series |
| Aggregated series |
|
|
|
| ||
2007-01-01 06:00 | 2 |
| method-> | Alternate (like meanToMean) |
| Default |
| Alternate (like meanToMean) |
| |
2007-01-01 12:00 | 3 | Default |
| option-> | allow missing | allow missing |
| do not allow missing | do not allow missing |
|
Date/Time | Value | Value | Calculation | Value | Calculation | Value | Value | |||
01-01-2007 00:00 | 1 |
|
|
|
|
|
| |||
01-01-2007 06:00 | 2 |
|
|
|
|
|
| |||
01-01-2007 12:00 | 3 |
|
|
|
|
|
| |||
01-01-2007 18:00 | 4 |
|
|
|
|
|
| |||
2007-01-01 18:00 | 4 |
|
| |||||||
2007-01-02 00:00 | 5 | (((1+2)/2) + ((2+3)/2) + ((3+4)/2) + ((4+5)/2))/4 | 3 | |||||||
2007-01-02 06:00 | 6 |
|
| |||||||
2007-01-02 12:00 | 7 |
|
| |||||||
2007-01-02 18:00 | NaN |
|
| |||||||
2007-01-03 00:00 | 9 | (((5+6)/2)+((6+7)/2))/2 | 6 | |||||||
2007-01-03 06:00 | 10 |
|
|
Example for includeFirstValueOfAggregationPeriodInCalculation = true and allowMissingValues = true:
Date/Time | Input Value | Calculation | Output Value | |||||||
---|---|---|---|---|---|---|---|---|---|---|
2007-01-01 00:00 | 1 |
|
| |||||||
2007-01-01 06:00 | 2 |
|
| |||||||
2007-01-01 12:00 | 3 |
|
| |||||||
2007-01-01 18:00 | 4 |
|
| |||||||
2007-01-02 00:00 | 5 | ( | 02-01-2007 00:00 | 5 | 3,50 | (2 + 3 + 4 + 5)/4 | 3 | (((1+2)/2) + ((2+3)/2) + ((3+4)/2) + ((4+5)/2))/4 | 3 ,5 | 3 |
02 2007-01-2007 02 06:00 | 6 |
|
| |||||||
2007-01-02 12:00 | 7 |
|
| |||||||
2007-01-02 18:00 | NaN |
|
| |||||||
02 2007-01-2007 1203 00:00 | 9 | - | NaN | |||||||
2007-01-03 06:00 | 7 10 |
|
|
Example for includeFirstValueOfAggregationPeriodInCalculation = false and allowMissingValues = false:
Date/Time | Input Value | Calculation | Output Value | ||||
---|---|---|---|---|---|---|---|
2007-01-01 00:00 | 1 |
|
| ||||
2007-01-01 06:00 | 2 |
|
| ||||
02 2007-01-01 12:00 | 3 |
|
| ||||
2007-01-01 18:00 | NaN 4 |
|
| ||||
2007-01-02 00:00 | 5 | (2 + 3 + 4 + 5)/4 | 3,50 | ||||
2007-01-02 06:00 | 6 |
|
| ||||
2007-01-02 12:00 | 7 |
|
| ||||
03 2007-01-02 18:00 | NaN |
|
| ||||
2007-01-03 00:00 | 9 | 7,33 | (6 + 7 + 9)/3 | 6 | (((5+6)/2)+((6+7)/2))/2 | - | - |
03-01-2007 06:00 | 10 |
|
|
|
|
|
|
7,33 | |||
2007-01-03 06:00 | 10 |
|
|
Example for includeFirstValueOfAggregationPeriodInCalculation = false and allowMissingValues = true:
Date/Time | Input Value | Calculation | Output Value |
---|---|---|---|
2007-01-01 00:00 | 1 |
|
|
2007-01-01 06:00 | 2 |
|
|
2007-01-01 12:00 | 3 |
|
|
2007-01-01 18:00 | 4 |
|
|
2007-01-02 00:00 | 5 | (2 + 3 + 4 + 5)/4 | 3,50 |
2007-01-02 06:00 | 6 |
|
|
2007-01-02 12:00 | 7 |
|
|
2007-01-02 18:00 | NaN |
|
|
2007-01-03 00:00 | 9 | - | NaN |
2007-01-03 06:00 | 10 |
|
|
Non Equidistant Timeseries
In the case of a non equidistant timeries, the allowMissingValues option does not bear much meaning, as it is unknown how much (if any) points should be available in the aggregation period. Setting this option does handle the case where a (non equidistant) timestep is available without an actual value (NaN). Furthermore, for non equidistant timeseries the includeFirstValueOfAggregationPeriodInCalculation option is not taken into account, as it is unknown what the first value of the aggregation period would be. The following calculation methodology is executed to determine the mean over the aggregation period:
First the (linearly interpolated) values at the aggregation period boundaries are determined from the non equidistant timeseries. Then, the average of each pair of connected values (including the calculated boundary values) is calculated and multiplied with the respective time between the measurement points. The weighted average of these mean values constitutes the aggregation period mean.
It should be noted that a mean value will be calculated even if no measurement points are available within the aggregation period. This is because the aggregation period boundary values will be calculated when measurement values are available at each side of the aggregation period and these will then be taken as input for the mean value calculation.
The image below visually explains the calculation methodology for non equidistant timeseries, where the interpolated value of one boundary is determined, before the weighted average of the connected pairs is taken.
Validation rules
Configuration example
No Format |
---|
<transformation id="aggregation instantaneousToMean"> <aggregation> <instantaneousToMean> <inputVariable> <timeSeriesSet> <moduleInstanceId>ImportTelemetry</moduleInstanceId> <valueType>scalar</valueType> <parameterId>H.obs</parameterId> <locationSetId>hydgauges</locationSetId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="minute" multiplier="15"/> <relativeViewPeriod unit="day" startOverrulable="true" start="-7" end="0"/> <readWriteMode>read only</readWriteMode> <delay unit="minute" multiplier="0"/> </timeSeriesSet> </inputVariable> <allowMissingValues>true</allowMissingValues> <includeFirstValueOfAggregationPeriodInCalculation>true</includeFirstValueOfAggregationPeriodInCalculation> <outputVariable> <timeSeriesSet> <moduleInstanceId>Aggregate_Historic</moduleInstanceId> <valueType>scalar</valueType> <parameterId>instantaneousToMean</parameterId> <locationSetId>hydgauges</locationSetId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="hour" multiplier="1"/> <relativeViewPeriod unit="day" startOverrulable="true" start="-7" end="0"/> <readWriteMode>add originals</readWriteMode> <synchLevel>1</synchLevel> </timeSeriesSet> </outputVariable> </instantaneousToMean> </aggregation> </transformation> |