Per time step calculate mean for varying periods which are retrieved from a time series (variable).
- time series A indicates period (in the past) for calculating the mean (period can vary)
- time series B indicates historical data (e.g. temperature)
- for every point in time the respective period in time series A should be used to calculate the mean value of time series B
- mean values should be written to every time step of time series B to a time series C
Example:
| Temperature | Age of water | Expected result | ||
| 2025-01-01 | 1 | 2 | 1 | NOTE: missing first value is ignored |
| 2025-01-02 | 2 | 3 | 1.5 | NOTE: missing first value is ignored |
| 2025-01-03 | 3 | 2 | 2.5 | |
| 2025-01-04 | 4 | 1 | 4 | |
| 2025-01-05 | 3 | 2 | 3.5 | |
| 2025-01-06 | 2 | 3 | 3 | |
| 2025-01-07 | 1 | 4 | 2.5 |
config example:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by WL | Delft Hydraulics (WL | Delft Hydraulics) -->
<transformationModule version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wldelft.nl/fews"
xsi:schemaLocation="http://www.wldelft.nl/fews https://fewsdocs.deltares.nl/schemas/version1.0/transformationModule.xsd">
<variable>
<variableId>inputVariable</variableId>
<timeSeriesSet>
<moduleInstanceId>PeriodVaryingMeanFunctionTest</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>H.obs.upstream</parameterId>
<locationId>H-2001</locationId>
<timeSeriesType>external historical</timeSeriesType>
<timeStep unit="hour"/>
<relativeViewPeriod unit="day" start="0" end="1"/>
<readWriteMode>read only</readWriteMode>
</timeSeriesSet>
</variable>
<variable>
<variableId>inputPeriodVariable</variableId>
<timeSeriesSet>
<moduleInstanceId>PeriodVaryingMeanFunctionTest</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>H.simulated</parameterId>
<locationId>H-2001</locationId>
<timeSeriesType>external historical</timeSeriesType>
<timeStep unit="hour"/>
<relativeViewPeriod unit="day" start="0" end="1"/>
<readWriteMode>editing visible to all future task runs</readWriteMode>
</timeSeriesSet>
</variable>
<variable>
<variableId>outputVariable</variableId>
<timeSeriesSet>
<moduleInstanceId>PeriodVaryingMeanFunctionTest</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>H.merged</parameterId>
<locationId>H-2001</locationId>
<timeSeriesType>external historical</timeSeriesType>
<timeStep unit="hour"/>
<relativeViewPeriod unit="day" start="0" end="1"/>
<readWriteMode>editing visible to all future task runs</readWriteMode>
</timeSeriesSet>
</variable>
<transformation id="2dTableTest">
<statisticsSerial>
<periodVaryingMean>
<inputVariable>
<variableId>inputVariable</variableId>
</inputVariable>
<inputPeriodVariable>
<variableId>inputPeriodVariable</variableId>
</inputPeriodVariable>
<outputVariable>
<variableId>outputVariable</variableId>
</outputVariable>
</periodVaryingMean>
</statisticsSerial>
</transformation>
</transformationModule>