Fast Barnes Interpolation
This Python package provides an 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 package now also supports Barnes interpolation of 1-dimensional and 3-dimensional data.
Mathematical Background
Barnes interpolation is a method that is widely used in geospatial sciences like meteorology to remodel data values $f_k \in \mathbb{R}$ recorded at irregularly distributed points $\mathbf{x}_k \in \mathbb{R}^2$ into a representative analytical field $f(\mathbf{x}) \in \mathbb{R}$. It is defined as
with Gaussian weights
for a specific Gaussian width parameter $\sigma$.
Naive computation of Barnes interpolation leads to an algorithmic complexity of $\mathcal{O}(N \cdot W \cdot H)$, where $N$ is the number of sample points and $W \times H$ the size of the underlying grid.
As shown in the paper, for sufficiently large $n$ (in general in the range from 3 to 6) a good approximation of Barnes interpolation with a reduced complexity $\mathcal{O}(N + W \cdot H)$ can be obtained by the convolutional expression
where $\delta_{\mathbf{x}_k}$ is the Dirac impulse function at location $\mathbf{x}_k$ and $r_n(.)$ an elementary rectangular function of a specific length that depends on $\sigma$ and $n$.
Example with a Speed-up Factor of more than 1000
The example below is taken from the paper and shows a comparison of the naive Barnes interpolation with the fast Barnes interpolation for $N = 3490$ sample points on a grid with $2400 \times 1200$ points. The test was conducted on a computer with a customary 2.6 GHz Intel i7-6600U processor with two cores (of minor importance since the code is written in sequential manner).
The recorded execution times for the pure interpolation tasks were
- 280.764 s for the naive Barnes interpolation with a 3-fold nested for-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 first image depicts the isoline visualization for the naive approach, the second image that for the convolutional, fast approach.
Further Links
- Minimal Working Examples
To find out how to use the code. - Release Notes
Summary of the recent changes.
Metadata
Release files for fast-barnes-py 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fast-barnes-py-2.0.0.tar.gz | 17.6 kB | Without provenance | Details for fast-barnes-py-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fast_barnes_py-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for fast_barnes_py-2.0.0-py3-none-any.whl |
Total release size: 37.4 kB
Release files / fast-barnes-py-2.0.0.tar.gz
| Download URL | fast-barnes-py-2.0.0.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c73afaabb93898af4918f765aa181a269b07a46c71d603be85dbe8102bafd99f
|
|
BLAKE2b-256 checksum How to use checksums |
6b504838910ad1c27865d8d14ca9d6722135cecd491320ba9912889408b7b009
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.7
|
Release files / fast_barnes_py-2.0.0-py3-none-any.whl
| Download URL | fast_barnes_py-2.0.0-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5204f44bf33bf64a423c0ea5d514c6513dd0263c77aaff244a1754fa87f1111
|
|
BLAKE2b-256 checksum How to use checksums |
858cf03af9394bc4730bfea67e5d42147b7fb892b10de76caf6c2298edfbf359
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.7
|
Security for fast-barnes-py 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.