## Transformation - InterpolationSerial Linear

schema: | |

keywords: | transformation, interpolation |

##### Description and usage

This transformation function is used to fill inner gaps in a time series. The inner gaps are filled with linearly interpolated data values.

A gap is defined as a number of consecutive values that are unreliable or missing. An inner gap is defined as a gap for which there is at least one reliable or doubtful value before the gap and at least one reliable or doubtful value after the gap. This function fills only inner gaps.

Each inner gap is filled using linear interpolation between the value just before the gap and the value just after the gap.

This function has an option to define the maximum length of the gaps that should be filled. Gaps that are equal to or smaller than the defined maximum gap length will be filled with interpolated values. Gaps that are larger than the defined maximum gap length will not be filled.

The interpolation serial transformation also has the possibility to configure a custom flagSource to be assigned to a flagSourceColumn for interpolated values.

##### Input/Output time series

In this function one input time series and one output time series must be identified.

- inputVariable: A time series with input values. This will typically contain inner gaps.
- outputVariable: A time series in which the output will be stored. The output series will contain all input values and the inner gaps will be filled.

##### Configuration

A basic configuration of the function is described below. This describes the main elements and attributes required and provides an example configuration.

*inputVariable*

Required element defining the identifier of the input time series with input values. This Id must reference a valid input time series.

*outputVariable*

Required element defining the identifier of the output time series with output values. This Id must reference a valid output time series.

*maxGapLength*

Optional element defining the maximum length of gaps that should be filled. The length is equal to the number of time steps. Gaps equal to or smaller than maxGapLength will be filled with interpolated values. Gaps larger than maxGapLength will not be filled. If maxGapLength is not defined, then all gaps will be filled with interpolated values.

*outputCustomFlagSourceId*

Optional element to define what customFlagSource should be written to the flagSourceColumn (defined in the workflow file) for interpolated values. The customFlagSourceId should be configured in CustomFlagSources configuration file.

*outputComment* if **outputCustomFlagSourceId** is being used, then the ouputComment is added for the missing values. For the available values, the input comments would be used.

*Example*

<transformation id="interpolation serial linear"> <interpolationSerial> <linear> <inputVariable> <variableId>input</variableId> </inputVariable> <maxGapLength>5</maxGapLength> <outputVariable> <variableId>output</variableId> </outputVariable> <outputComment>outputCommentTest</outputComment> <outputCustomFlagSourceId>INTP</outputCustomFlagSourceId> </linear> </interpolationSerial> </transformation>

##### Common issues

None reported.