Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Information

Transformation:

Weighted

Transformation Group:

InterpolationSpatial

Description:

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.

Hydrological Information

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:

 

Configuration

There are two possible ways to configure this transformation:

...

Configuration Example
Code Block
languagexml
titleConfiguring the transformation in the module config file
<transformation id="interpolation spatial weighted">
	<interpolationSpatial>
		<weighted>
			<inputVariable>
				<variableId>input</variableId>
			</inputVariable>
			<attributedOutputVariable>
				<outputVariable>
					<variableId>output</variableId>
				</outputVariable>
				<locationIdAttribute>LOCS</locationIdAttribute>
				<weightAttribute>WEIGHTS</weightAttribute>
			</attributedOutputVariable>
		</weighted>
	</interpolationSpatial>
</transformation>


Code Block
languagexml
titleThe location set used for the output variable
<locationSet id="WeightedWithAttributesOutputLocs">
	<csvFile>
		<file>WeightedWithAttributesOutputLocs.csv</file>
		<id>%ID%</id>
		<x>%X%</x>
		<y>%Y%</y>
		<attributeFile>
			<csvFile>WeightedWithAttributesOutputLocs_Attributes.csv</csvFile>
			<id>%OUTID%</id>
			<attribute id="LOCS">
				<text>%INID%</text>
			</attribute>
			<attribute id="WEIGHTS">
				<number>%WEIGHT%</number>
			</attribute>
		</attributeFile>
	</csvFile>
</locationSet>


Code Block
languagetext
titleWeightedWithAttributesOutputLocations_attributes.csv
OUTID, INID, WEIGHT
output_id_1, input_id_1, 1
output_id_2, input_id_1, 0.5
output_id_2, input_id_2, 0.5
output_id_3, input_id_1, 0.5
output_id_3, input_id_3, 0.5
output_id_4, input_id_1, 0.1
output_id_4, input_id_2, 0.3
output_id_4, input_id_4, 0.6

...