Transformation - InterpolationSpatial average

schema:

transformationModule.xsd

keywords:

transformation, spatial interpolation

Description and usage

This transformation function is used to calculate the average value of an input time series (grid or scalar) within the area of a polygon of the output time series.

This transformation can handle three types of input:

  • scalar (point)
  • regular grid
  • irregular grid

When the input is a scalar time series the average value for a certain polygon in the output will be calculated by finding the points in the input time series which are within the area of the polygon and calculate the average value of these points. When the input contains polygon geometries, these will be converted to points, either by using X,Y attributes if those are defined, or by calculating the polygon centroid providing a result that is not very accurate as none of the polygons areas are accounted for.
When the input is a time series with a grid (regular or irregular) the transformation will determine which cells of the input time series have an overlap with the output polygon and the average value of these cells will be calculated. The average value will be a weighted average. The weight of each input cell wil be based on how much area of the input cell covers a certain part of the output polygon. This is done by the next algorithm, called "cookie cutter":

  1. find smallest sub grid that contains the whole polygon
  2. quadruple the number of grid cells until the sub grid contains at least 10000 (sub) cells, this is to detect that a cell is partially inside the polygon
  3. create an image with the same number of pixels as the refined sub grid
  4. convert the polygon coordinates to grid coordinates, coordinates are floating points so not only at cell centers
  5. draw the polygon at the image in black using Java2D
  6. analyze the image pixels. The number of black pixels per grid cell determines the weight of the grid cell for calculating the polygon sum or average

The output time series can be a output time series with polygons or a irregular/regular grid. However it is expected to have a slow performance with large grids because this transformation is optimized for output time series based on polygons.

The configurator has the possibility to configure a minimum or a maximum value for the output of the transformation. If the output exceeds the minimum or maximum value configured the output will truncated to the minimum or maximum value configured.

Note: It should not be used to transform one regular grid into another regular grid with higher resolution (smaller cells). Use the bilinear interpolation then. A config warning is raised when you use the average method in such cases.

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 can be a scalar time series or time series with a regular/irregular grid.
  • outputVariable: A time series in which the output will be stored. The output time series can be a time series with polygons or with a regular grid.
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.

minimumValue

Optional element defining the minimum value of the output time series. If the output value is lower than the configured minimum value the output value will be equal to the configured minimum value.

maximumValue

Optional element defining the maximum value of the input time series. If the output value is higher than the configured maximum value the output value will be equal to the configured maximum value. 

Example

<interpolationSpatial>
  <average>
    <minimumValue>0</minimumValue>
    <maximumValue>20000</maximumValue>
    <inputVariable>
      <variableId>input</variableId>
    </inputVariable>
    <outputVariable>
      <variableId>output</variableId>
    </outputVariable>
  </average>
</interpolationSpatial>
Common issues

None reported.

Related items

transformationModule.xsd

 

  • No labels