Versions Compared

Key

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

What it calculates

Bilinear interpolation is an extension on linear interpolation. Linear interpolation uses two points to interpolate in one dimension where bilinear interpolation uses 4 points to interpolate in two dimensions. We always interpolate for a point (the point to be interpolated Ptbi), so regardless if the output is a scalar, regular or irregular grid; the output is reduced to points for which a value is calculated individually. In the case of scalar values, this reduction means using it's X and Y coordinates from the associated location. For regular or irregular grids, the X and Y coordinates of each cell center is used. The input can only be a regular grid. 

This leaves us with a collection of Ptbi's and an input grid. First the 4 surrounding cell centers (Ps) for the Ptbi are selected from input grid.

Image Added

 

Now the values of these 4 points are used to calculate the interpolated value as shown below (first interpolate twice on the X axis, then from the resulting points once on the Y axis).

Image Added

 

Some exceptions:

  • If the Ptbi has the same location as one of the Ps's, the resulting value for Ptbi will be that of the Ps.
  • If the Ptbi is on a horizontal or vertical line between 2 Ps's, the resulting value for Ptbi will be a linear interpolation between those two Ps's.
  • If there are less then 4 surrounding points (when for example the Ptbi is outside the input grid), there will be no resulting value for Ptbi

 

Schema

Image Added


Overruling coordinate attributes

It is possible to configure overruling X and Y attributes, which will overrule the X and Y coordinates use for the interpolation.


Code Block
languagexml
<transformation id="bilinear">
   <interpolationSpatial>
      <bilinear>
         <inputVariable>
            <timeSeriesSet>
               <moduleInstanceId>SpatialInterpolationBilinearOverrulingCoordinatesTest</moduleInstanceId>
               <valueType>grid</valueType>
               <parameterId>T.historical</parameterId>
               <locationId>gridLocation3</locationId>
               <timeSeriesType>external historical</timeSeriesType>
               <timeStep unit="day"/>
               <relativeViewPeriod unit="day" start="0" end="10"/>
               <readWriteMode>add originals</readWriteMode>
            </timeSeriesSet>
         </inputVariable>
         <overrulingXAttribute>overrulingX</overrulingXAttribute>
         <overrulingYAttribute>overrulingY</overrulingYAttribute>
         <outputVariable>
            <timeSeriesSet>
               <moduleInstanceId>SpatialInterpolationBilinearOverrulingCoordinatesTest</moduleInstanceId>
               <valueType>scalar</valueType>
               <parameterId>T.historical</parameterId>
               <locationId>polygonLocation2</locationId>
               <timeSeriesType>external historical</timeSeriesType>
               <timeStep unit="day"/>
               <relativeViewPeriod unit="day" start="0" end="10"/>
               <readWriteMode>add originals</readWriteMode>
            </timeSeriesSet>
         </outputVariable>
      </bilinear>
   </interpolationSpatial>
</transformation>