Per time step calculate mean for varying periods which are retrieved from a time series (variable). 

  1. time series A indicates period (in the past) for calculating the mean (period can vary) 
  2. time series B indicates historical data (e.g. temperature)
  3. for every point in time the respective period in time series A should be used to calculate the mean value of time series B 
  4. mean values should be written to every time step of time series B to a time series C

Example:



TemperatureAge of waterExpected result
2025-01-01121NOTE: missing first value is ignored
2025-01-02231.5NOTE: missing first value is ignored
2025-01-03322.5
2025-01-04414
2025-01-05323.5
2025-01-06233
2025-01-07142.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>
 


  • No labels