public class BarnesSurfaceInterpolator extends Object
Barnes Surface Interpolation is a surface estimating method commonly used as an interpolation technique for meteorological datasets. The algorithm operates on a regular grid of cells covering a specified extent in the input data space. It computes an initial pass to produce an averaged (smoothed) value for each cell in the grid, based on the cell's proximity to the points in the input observations. Subsequent refinement passes may be performed to improve the surface estimate to better approximate the observed values.
For the first pass, the estimated value at each grid cell is:
E_{g} = sum(w_{i} * o_{i}) / sum(w_{i})where
E_{g}
is the estimated surface value at the grid cell
w_{i}
is the weight value for the i'th observation point (see below
for definition)
o_{i}
is the value of the i'th observation point
The weight (decay) function used is:
w_{i} = exp(d_{i}^{2} / L^{2}c )where:
w_{i}
is the weight of the i'th observation point value
d_{i}
is the distance from the grid cell being estimated to the
i'th observation point
L
is the length scale, which is determined by the observation spacing
and the natural scale of the phenomena being measured. The length scale is in the units of
the coordinate system of the data points. It will likely need to be empirically estimated.
c
is the convergence factor, which controls how much refinement takes
place during each refinement step. In the first pass the convergence is automatically set
to 1. For subsequent passes a value in the range 0.2  0.3 is usually effective.
E_{g}' = E_{g} + sum( w_{i} * (o_{i}  E_{i}) ) / sum( w_{i} )To optimize performance for large input datasets, it is only necessary to provide the data points which affect the surface interpolation within the specified output extent. In order to avoid "edge effects", the provided data points should be taken from an area somewhat larger than the output extent. The extent of the data area depends on the length scale, convergence factor, and data spacing in a complex way. A reasonable heuristic for determining the size of the query extent is to expand the output extent by a value of 2L.
Since the visual quality and accuracy of the computed surface is lower further from valid observations, the algorithm allows limiting the extent of the computed cells. This is done by using the concept of supported grid cells. Grid cells are supported by the input observations if they are within a specified distance of a specified number of observation points. Grid cells which are not supported are not computed and are output as NO_DATA values.
References
Modifier and Type  Field and Description 

static float 
DEFAULT_NO_DATA_VALUE
The default grid cell value used to indicate no data was computed for that cell

Constructor and Description 

BarnesSurfaceInterpolator(Coordinate[] observationData)
Creates a Barnes Interpolator over a specified dataset of observation values.

Modifier and Type  Method and Description 

float[][] 
computeSurface(Envelope srcEnv,
int xSize,
int ySize)
Computes the estimated values for a regular grid of cells.

void 
setConvergenceFactor(double convergenceFactor)
Sets the convergence factor used during refinement passes.

void 
setLengthScale(double lengthScale)
Sets the length scale for the interpolation weighting function.

void 
setMaxObservationDistance(double maxObsDistance)
Sets the maximum distance from an observation for a grid point to be supported by that
observation.

void 
setMinObservationCount(int minObsCount)
Sets the minimum number of inrange observations which are required for a grid point to be
supported.

void 
setNoData(float noDataValue)
Sets the NO_DATA value used to indicate that a grid cell was not computed.

void 
setPassCount(int passCount)
Sets the number of passes performed during Barnes interpolation.

public static final float DEFAULT_NO_DATA_VALUE
public BarnesSurfaceInterpolator(Coordinate[] observationData)
Coordinate
values, where the X,Y ordinates are the
observation location, and the Z ordinate contains the observation value.data
 the observed data valuespublic void setPassCount(int passCount)
passCount
 the number of estimation passes to perform (1 or more)public void setLengthScale(double lengthScale)
lengthScale
 public void setConvergenceFactor(double convergenceFactor)
convergenceFactor
 the factor determining how much to refine the surface estimatepublic void setMaxObservationDistance(double maxObsDistance)
maxObsDistance
 the maximum distance from an observation for a supported grid pointpublic void setMinObservationCount(int minObsCount)
minObsCount
 the minimum inrange observation count for supported grid pointspublic void setNoData(float noDataValue)
noDataValue
 the value to use to represent NO_DATA.public float[][] computeSurface(Envelope srcEnv, int xSize, int ySize)
Envelope
. The size of the grid is specified by the cell count for the
grid width (X) and height (Y).srcEnv
 the area covered by the gridxSize
 the width of the gridySize
 the height of the gridCopyright © 1996–2018 Geotools. All rights reserved.