Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
scrollbar


Excerpt
hiddentrue

aggregates data by calculating the mean value


InstantaneousToMean

Trim Output
  • Note that this optional and default false, but very recommended to use to prevent overwriting existing values by missings (see logWarnExistingValueOverwrittenByMissing log messages). This problem will happen in case the transformation is running at a smaller cardinal timestep than the aggregation timestep. For example, running at 00:05, while aggregating to clock hours will result in a non-full clock hour at the start of the aggregation, so result in a missing value. With the trimOutput=true, that missing value will be ignored.
Input
  • inputVariable
Options

...

This transformations calculates the mean value of instantaneous values over a certain period. If the option allowMissingValues is true, then a missing value is returned if one of the input values in the period is a missing value. If the option 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 aggregation period, i.e. missing values are ignored in this case.

The transformation offers two different ways for calculating the mean value over a period.  The default method (used by setting the includeFirstValueOfAggregationPeriodInCalculation option to true - this is the default behaviour) 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) calculates the mean of all values that fit in the output interval, excluding the start time itself, and stores that at the output time.

...



Example for includeFirstValueOfAggregationPeriodInCalculation = true and allowMissingValues = false:

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

(((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

(((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

-

NaN

2007-01-03 06:00

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

 

 



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

(6 + 7 + 9)/3

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

...

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>
				</timeSeriesSet>
			</outputVariable>
		</instantaneousToMean>
	</aggregation>
</transformation>