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.4.3-cp312-cp312-win_amd64.whl (121.8 kB view details)

Uploaded CPython 3.12Windows x86-64

pyterp-0.4.3-cp312-cp312-win32.whl (106.4 kB view details)

Uploaded CPython 3.12Windows x86

pyterp-0.4.3-cp312-cp312-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pyterp-0.4.3-cp311-cp311-win_amd64.whl (120.1 kB view details)

Uploaded CPython 3.11Windows x86-64

pyterp-0.4.3-cp311-cp311-win32.whl (105.0 kB view details)

Uploaded CPython 3.11Windows x86

pyterp-0.4.3-cp311-cp311-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pyterp-0.4.3-cp310-cp310-win_amd64.whl (119.6 kB view details)

Uploaded CPython 3.10Windows x86-64

pyterp-0.4.3-cp310-cp310-win32.whl (104.3 kB view details)

Uploaded CPython 3.10Windows x86

pyterp-0.4.3-cp310-cp310-manylinux_2_28_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pyterp-0.4.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c9642620b043afeac18926476088900c6026551d1c380a43a15df9251c45686a
MD5 dcc56ca08d384210bf49a54e58d33692
BLAKE2b-256 55bf0800cc792c036dcb19c4eccc89b77e49bda1eb02a7a5d3c47c44ea35bab6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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.4.3-cp312-cp312-win32.whl.

File metadata

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

File hashes

Hashes for pyterp-0.4.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 17d0a18d78d58ab40cd575d33e93532cc74900c0786f269e4789669fd1907aab
MD5 a347a541012de3839904ea0cbeb61c57
BLAKE2b-256 7439441d6d68e921de705d7826ab97ca53ca8645e302661b936a66565227b719

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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.4.3-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.4.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 157e9efa0bbc79424bae92bf0c5e1f3743e5df43c94d6f35f6efcc52e4fded69
MD5 8cc8e33d13f70bbb8de4cae884b781c0
BLAKE2b-256 8ef3b26f3ef285ab507ab4bdb1abbb68cb8bee5784d52df6127504646064b546

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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.4.3-cp311-cp311-win_amd64.whl.

File metadata

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

File hashes

Hashes for pyterp-0.4.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 41162d68ac4d4c8ff1bc6e41d197a463056045ca8639a4fa26268b804a8ae209
MD5 de331b2a6cf93f14edf78bc45d1cc04f
BLAKE2b-256 ef3e4b38e0b0d090b76fc02e6b9353f8cb5abb4ca196d1ae4a7c11cdfb64c740

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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.4.3-cp311-cp311-win32.whl.

File metadata

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

File hashes

Hashes for pyterp-0.4.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 ad8de47c0bbef913f3446086af0d4059a94bb4904d4e9a8da6ca67d04b117165
MD5 cf7bf80195c2cfedfaf09ad2e4f53820
BLAKE2b-256 fd32d0e51b2aafc039bc8a07257d2c1dc2c63b3451eb4c9bcd154f051c5a3622

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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.4.3-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.4.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b0aedafd609b8bbbbf14e61e36e063ebc1b8d3e1ea8a36e4da703d8d69c690c3
MD5 43422c10a25ecb37b5463b39587a6f0f
BLAKE2b-256 080684447545df56e3c5280f035d202a7a09dd10d858821ae2a993e0562e9c69

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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.4.3-cp310-cp310-win_amd64.whl.

File metadata

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

File hashes

Hashes for pyterp-0.4.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 158a97b9d04d4a60dc3fa116301a4d690d3bffcb95895d576cbd6f4279ac3f8c
MD5 bd53291753dc7bf6979dedcdd1643d2f
BLAKE2b-256 52189b54e257c203fed6b435bafd44dc0d9c977873049463936680e54b5b321c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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.4.3-cp310-cp310-win32.whl.

File metadata

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

File hashes

Hashes for pyterp-0.4.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c6eeb678be0a4f9e0c6513ca5c6d32f09f27ac4433cc6f2d3648a9789b43039b
MD5 af7692d110a48172fcef9d1a7561e861
BLAKE2b-256 4cc4c62d9801a36d6fe82b1a3a3f22876d789248c9353a9ad1db8df73ca22283

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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.4.3-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.4.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9bdb9d4b92f7ce47390520f7102b912feba0c2a47e9dbc52f7229ae71e30fd73
MD5 4be0f9a46ec0789fb6800514c2ce8b97
BLAKE2b-256 6c0c96842c3d0e35b00e6844979c86f2b806135eb990c63c33cfbe51a44af623

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.4.3-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