For each time step this transformation calculates the weighted average of the input variables. The weights are re-scaled so that the total weight becomes 1. If for a given time an input variable has a missing value, then for that time that input variable is ignored and the weights of the other input variables are re-scaled so that the total weight becomes 1.
Purpose and use of Transformation:
This transformation can for example be used to calculate the weighted average of the amount of rainfall of a number of locations in a catchment.
Background and Exceptions:
There are two possible ways to configure this transformation:
- Defining the input time series and the weight of each input time series in the module config file using <weightedInputVariable> elements.
- Using two multi-value attributes of the output time series location to determine the input time series and their weights respectively (available since 2017.02).
The way to configure the input and output variables for these two options will be explained separately. Note that the first option uses the <weightedInputVariable> elements in combination with a regular <outputVariable> element, while the second option uses a single (regular) <inputVariable> element in combination with an <attributedOutputVariable> element. It is not possible to combine the input and output variable element options in a different way.
Both configuration options support an optional element <minInputValuesRequired> which is the minimum number of input variables that should have a non-missing value for the calculation. If for a given time the number of input variables that have a non-missing value is less than this configured minimum, then for that time the output value will be a missing value. This can be used for example to avoid getting output values of calculations for which very few input variables are available, because such calculations would be inaccurate. If <minInputValuesRequired> is not specified, then it will be set to 1.
Configuration using weighted input variables
One or more weighted input variables (<weightedInputVariable> elements). Each input variable has a weight.
Weighted average (a regular <outputVariable> element).
Configuration using multi-value attributes
Available since 2017.02.
A single <inputVariable> element should be configured, with a locationSet containing all possible input locations.
An <attributedOutputVariable> element specifying the <outputVariable> and the attributes <locationIdAttribute> and <weightAttribute> used to determine the input locations and their weights respectively. Note that the attributes should be available for each location if a locationSet is used (the attributeExists constraint can be used to create a new locationSet from an existing locationSet if necessary). Also note that when configuring the multi-value attributes there should never be a an empty value for one of the attribute, otherwise the input locations and weights will not be combined correctly. Finally, note that <locationIdAttribute> should be a text attribute, while <weightAttribute> should be a number attribute.