...
The main difference between the first and the second example is that in the second example the code needs
to have a for loop to calculate the output value for each time step available in the output time series.
How to configure a custom transformation?
The section above explained the coding of a custom transformation. In addition to the coding the custom transformation should be added
to a workflow so that it can be used in the FEWS system.
Below you can find an example of a custom fews transformation.
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?>
<transformationModule xmlns="http://www.wldelft.nl/fews" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/transformationModule.xsd" version="1.0">
<variable>
<variableId>input1</variableId>
<timeSeriesSet>
<moduleInstanceId>POFlathead_MergeMAP_UpdateStates</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>MAP</parameterId>
<locationId>WGCM8U</locationId>
<timeSeriesType>simulated historical</timeSeriesType>
<timeStep unit="hour" multiplier="6"/>
<relativeViewPeriod unit="week" start="-520" end="0"/>
<readWriteMode>add originals</readWriteMode>
</timeSeriesSet>
</variable>
<variable>
<variableId>input2</variableId>
<timeSeriesSet>
<moduleInstanceId>POFlathead_MergeMAP_UpdateStates</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>MAP</parameterId>
<locationId>WGCM8L</locationId>
<timeSeriesType>simulated historical</timeSeriesType>
<timeStep unit="hour" multiplier="6"/>
<relativeViewPeriod unit="week" start="-520" end="0"/>
<readWriteMode>add originals</readWriteMode>
</timeSeriesSet>
</variable>
<variable>
<variableId>output</variableId>
<timeSeriesSet>
<moduleInstanceId>example1</moduleInstanceId>
<valueType>scalar</valueType>
<parameterId>MAP</parameterId>
<locationId>WGCM8</locationId>
<timeSeriesType>simulated forecasting</timeSeriesType>
<timeStep unit="hour" multiplier="6"/>
<relativeViewPeriod unit="week" start="-520" end="0"/>
<readWriteMode>add originals</readWriteMode>
</timeSeriesSet>
</variable>
<transformation id="Example1">
<custom>
<userDefined>
<input>
<fieldName>input1</fieldName>
<inputVariable>
<variableId>input1</variableId>
</inputVariable>
</input>
<input>
<fieldName>input2</fieldName>
<inputVariable>
<variableId>input2</variableId>
</inputVariable>
</input>
<options>
<float value="0.3" key="option1"></float>
<float value="0.7" key="option2"></float>
</options>
<output>
<fieldName>output</fieldName>
<outputVariable>
<variableId>output</variableId>
</outputVariable>
</output>
<binDir>example</binDir>
<className>example.Example1</className>
</userDefined>
</custom>
</transformation>
</transformationModule>
|