Skip to main content

PyTerp

A 3D interpolator for Python designed for maximum speed on large datasets. It accelerates the IDW algorithm with a parallelized C++ core (OpenMP) and optimized k-NN searches (nanoflann).

Theoretical Summary

The interpolation is performed in a two-step process that combines the k-NN and IDW algorithms.

  1. Neighbor Selection (k-NN): For each point where a value is to be estimated, the k-Nearest Neighbors algorithm first finds the k closest known source points in space. The efficiency of this search is ensured by an optimized data structure (k-d tree).

  2. Value Calculation (IDW): Next, the Inverse Distance Weighting method calculates the final value as a weighted average of the k found neighbors. The weight of each neighbor is inversely proportional to its distance (weight = 1/distanceᵖ, where p is a power parameter), causing closer points to have a much greater influence on the result.

Prerequisites

Before you begin, ensure you have the following software installed:

  • Python 3.10+
  • Git
  • A C++ compiler: This package contains C++ code that needs to be compiled during installation.
    • Windows: Install Visual Studio Build Tools (select the "Desktop development with C++" workload).
    • Linux (Debian/Ubuntu): Install build-essential with: sudo apt-get install build-essential.

Installation

PyPI

Install the package:

pip install pyterp

GitHub

1. Clone the repository:

git clone https://github.com/jgmotta98/PyTerp.git
cd PyTerp

2. Create and activate a virtual environment:

# Create the environment
python -m venv .venv

# Activate the environment
# On Windows (cmd.exe):
.venv\Scripts\activate
# On macOS/Linux (bash/zsh):
source .venv/bin/activate

3. Install the requirements:

pip install -r requirements.txt

4. Install the package:

pip install .

Usage Example

For a complete and runnable example, including the creation and preparation of input data, please see the scripts in the examples folder.

Acknowledgements

This project uses nanoflann, a high-performance C++ library for the k-Nearest Neighbors algorithm. The efficiency of nanoflann's k-d tree implementation is fundamental to this interpolator's performance.

Metadata

Release files for pyterp 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyterp 1.3.0
File Size Uploaded
pyterp-1.3.0.tar.gz 24.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyterp 1.3.0
File Interpreter ABI Platform
pyterp-1.3.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
pyterp-1.3.0-cp310-cp310-win32.whl CPython 3.10 CPython 3.10 Windows x86-32 Details
pyterp-1.3.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details

Total release size: 1.7 MB

Release files / pyterp-1.3.0.tar.gz

Download URL pyterp-1.3.0.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f0279fde943dd875b9e9966a7acef58a47ecda03ae510f9b73ba761daab4e62b
BLAKE2b-256 checksum
How to use checksums
70a9d7d22e99706c23fd4223552cefe6fd2585bee83102715316f0430d1bd4d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / pyterp-1.3.0-cp310-cp310-win_amd64.whl

Download URL pyterp-1.3.0-cp310-cp310-win_amd64.whl
Size 98.7 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
e1653660959f1b681989ef6876a5bd9e1b2b3f7e838a35df2d3d35fea12850d9
BLAKE2b-256 checksum
How to use checksums
647036697636aa8931b7644ec008f543fbb2f9628ada9e2726665c751aa109c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / pyterp-1.3.0-cp310-cp310-win32.whl

Download URL pyterp-1.3.0-cp310-cp310-win32.whl
Size 84.2 kB
Tags CPython 3.10 Windows x86-32
SHA-256 checksum
How to use checksums
700c7ed3e49eaa625e2546e4b764e7d0f34fc4b8a4adbff038e4d7e0382d0a49
BLAKE2b-256 checksum
How to use checksums
09b9eb004ab6acd2e890c6de82b28da2967a728a27ba706777217cbfe62120dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / pyterp-1.3.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL pyterp-1.3.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 1.5 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
9b418c40bde6cb0735175c2862260302e64cc9bdad92939f98d2c6caecc9d616
BLAKE2b-256 checksum
How to use checksums
e3e884ed110f45b2171548dad3d1206f06741784b188767bdb63dc12129c649b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.3.0 This release

4 release files

0.1.3

9 release files

0.1.2

9 release files

0.1.1

9 release files

0.1.0

4 release files

0.0.0

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page