Skip to main content

A package for performing optimized k-NN IDW interpolation using C++.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyterp-0.3.1-cp312-cp312-win_amd64.whl (109.4 kB view details)

Uploaded CPython 3.12Windows x86-64

pyterp-0.3.1-cp312-cp312-win32.whl (98.1 kB view details)

Uploaded CPython 3.12Windows x86

pyterp-0.3.1-cp312-cp312-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pyterp-0.3.1-cp311-cp311-win_amd64.whl (108.4 kB view details)

Uploaded CPython 3.11Windows x86-64

pyterp-0.3.1-cp311-cp311-win32.whl (97.4 kB view details)

Uploaded CPython 3.11Windows x86

pyterp-0.3.1-cp311-cp311-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pyterp-0.3.1-cp310-cp310-win_amd64.whl (107.7 kB view details)

Uploaded CPython 3.10Windows x86-64

pyterp-0.3.1-cp310-cp310-win32.whl (96.7 kB view details)

Uploaded CPython 3.10Windows x86

pyterp-0.3.1-cp310-cp310-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

Details for the file pyterp-0.3.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyterp-0.3.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 109.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyterp-0.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 82f55022b4a7a7b2075ae2e6db1095cb114b1a9b63831733ff0f3d8c0482e90d
MD5 212bb1c2e7c8ea8f0e562e981cda53b5
BLAKE2b-256 6ec56f8205f04c3f5a737be1c753fe146df4bb6c36fd6f8d5ed10b69864ebcb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp312-cp312-win_amd64.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyterp-0.3.1-cp312-cp312-win32.whl.

File metadata

  • Download URL: pyterp-0.3.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 98.1 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyterp-0.3.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 7d0cd8ce7aea210c7cf491f293d45369b57e935e4b8b3b844774dee4e1d58dd9
MD5 e2c3a7b39506e3527feabdb8096574e9
BLAKE2b-256 fa97b6835010b421196d636ea9ec662f049d7bf34764f55944ff8e5e1a624826

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp312-cp312-win32.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyterp-0.3.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.3.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b669fd6b94714416e580bd6aaec697c4985d386fc355e9b0570f13ba749dc66a
MD5 b451e5f22181f2f660df306eff1eb1e4
BLAKE2b-256 7849a04851bf4f094a024975d30f182c19fcabb67abfbfdc9d8b8fa4db6184c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyterp-0.3.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyterp-0.3.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 108.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyterp-0.3.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 534e814327e95269a7c40302779328baab6598e7305c491745c75e31420749bb
MD5 2f087fbd117b0c856b6137609c11dc49
BLAKE2b-256 40a7a9f2873270c98e2a8bc840545ff9b6c9115b69cf709fb11a64461523120c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp311-cp311-win_amd64.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyterp-0.3.1-cp311-cp311-win32.whl.

File metadata

  • Download URL: pyterp-0.3.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 97.4 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyterp-0.3.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 93845ee62dc7958708a3e9716a94e999b1bdde51934608ea43b056eaad03a820
MD5 a18aec7285fead11e9ce3ee9fae40f4b
BLAKE2b-256 2eb21b436c6cea3a4dd868f65ec2a3184b6fcbcc12621200e6378ca82da2ef67

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp311-cp311-win32.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyterp-0.3.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.3.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ded1fe769f2dab71c6390f5439b1bd0416c540f4768252b3889521dbeb56f29
MD5 217df806ed03b558a72ac1ce784270e4
BLAKE2b-256 7f774f0f852dafa8722d750b17f13f90e1a2a19eb462142b109039409f251252

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyterp-0.3.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyterp-0.3.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 107.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyterp-0.3.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f66863b021bef0dfdbcd6a41c6b7a26570a00eda915a64c2d9a1c2be4d605524
MD5 dd6c86aa3457d678f9f371fe89f37584
BLAKE2b-256 7095a7dcc594339a5eed99d4451d32f66bb2c225d61b8cd00752ad771afe269c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp310-cp310-win_amd64.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyterp-0.3.1-cp310-cp310-win32.whl.

File metadata

  • Download URL: pyterp-0.3.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 96.7 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyterp-0.3.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 1ec9bdb61d0df7163d3b994ca7ef7b264780d931bda870e56594e705ea83ee1a
MD5 96a3f87e95680ae1edb31bd342ea967e
BLAKE2b-256 a29c9bef5f5d7dc1ed704641900500b6fa4ee65714e30393f9cfffdb61a614ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp310-cp310-win32.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyterp-0.3.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.3.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b4a4cccd5d01ed19079f1d9e241e739b3854601f479106372f47a311a2307eeb
MD5 df5595997e5766ff63df7f55b1c58f36
BLAKE2b-256 b5359bd5385f92ebdc5b64625cc385a1dc360b63561aff29b028cd231e849571

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.3.1-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: release.yaml on jgmotta98/PyTerp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page