This repository provides a Python implementation of the formal algorithms for fast Barnes interpolation as presented in the corresponding paper published in the GMD journal.
In addition to Barnes interpolation for 2-dimensional applications, this implementation now also supports the interpolation of 1-dimensional and 3-dimensional data.
Barnes interpolation is a method that is widely used in geospatial sciences like meteorology to remodel data values
with Gaussian weights
for a specific Gaussian width parameter
Naive computation of Barnes interpolation leads to an algorithmic complexity of
As shown in the paper, for sufficiently large
where
The example below is taken from the paper and shows a comparison of the naive Barnes interpolation with the fast Barnes interpolation for
The recorded execution times for the pure interpolation tasks were
- 280.764 s for the naive Barnes interpolation with a 3-fold nested loop over
$W$ ,$H$ and$N$ - 0.247 s for the fast Barnes interpolation with a 4-fold convolution
The detail views of the isoline visualizations of the respective Barnes interpolation results agree to a very high degree:
The left image depicts the isoline visualization for the naive approach, the right image that for the convolutional, fast approach.
The module interpolation
implements the Barnes interpolation algorithms using the Euclidean distance metric, as described in chapter 4 and 5.4 of the paper.
The Barnes interpolation algorithms that use spherical distance metric on the sphere interpolationS2
.
However, be aware here that the supported geographical domain and projection - as in the paper - is currently fixed to the European latitudes and Lambert conformal projection and cannot be freely chosen.
These algorithms are also available as fast-barnes-py package on PyPI.
The directory demo
provides Python scripts that reproduce the figures and the tables shown in the paper.
In order to execute them you can follow these instructions.
- Minimal Working Examples
To find out how to use the code. - Release Notes
Summary of the recent changes.