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

Uploaded CPython 3.12Windows x86-64

pyterp-0.1.1-cp312-cp312-win32.whl (76.3 kB view details)

Uploaded CPython 3.12Windows x86

pyterp-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pyterp-0.1.1-cp311-cp311-win_amd64.whl (85.0 kB view details)

Uploaded CPython 3.11Windows x86-64

pyterp-0.1.1-cp311-cp311-win32.whl (76.1 kB view details)

Uploaded CPython 3.11Windows x86

pyterp-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pyterp-0.1.1-cp310-cp310-win_amd64.whl (83.9 kB view details)

Uploaded CPython 3.10Windows x86-64

pyterp-0.1.1-cp310-cp310-win32.whl (75.1 kB view details)

Uploaded CPython 3.10Windows x86

pyterp-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

File details

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

File metadata

  • Download URL: pyterp-0.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 85.5 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.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 11c699815270b3be92440c37d213db2440b911e90afeeb2e93f6dcced0c3e408
MD5 466f74dca32a15253f2e75a9c414e2a8
BLAKE2b-256 9566f78d09b451cf4ad74735b24341cc530028d5106ae6af68fbaff58e3cb4e7

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.1-cp312-cp312-win32.whl
  • Upload date:
  • Size: 76.3 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.1.1-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 b91b8d52bcebfa1730d88f239167c6efd9817c2c5484ab7fef23ccc45c825b2f
MD5 ee4c5d000c0be20b2e3b7edbfb4e6222
BLAKE2b-256 bcc24f45b2a48c1baee55acc201b6639f62cdf5708c3dae34e64e025bc6bce98

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.1.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.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f692aaba04c2203bfabf72790581226815ca01b941697bf3b804449ffabdadda
MD5 ce9e2f045241af55f438efae78f1ced9
BLAKE2b-256 79cba0383c7174c529092f40ce432017ef71a1ee1399f691a56cbdc57e4897f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_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.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyterp-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 85.0 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.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 40cc9856d88f891b7a607d87bdde62a1e856ade4f4753798afbd484df8ad2646
MD5 5267213d5bd050cbcd89321860fb88a0
BLAKE2b-256 e9dd97010078f8c6f750e2ef68f8a447c03c9bb8b3e691eea4ac0c0cbbdfb094

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 76.1 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.1.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d51eb13d9bf52800ceb0e42f96982393ec0cd11815a1f647ea185063b3703b92
MD5 33bc32013ed35718b54f120e3b175687
BLAKE2b-256 4f0c923f225639d47d4f9001c9eaa3736d92c9e771df110668741f8e6c1d85a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.1.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.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d3d86077052d2c01d036a0141b41792bba4415f14e29e9066674ffc7fe484dc0
MD5 27b78db7b1542bc0bb87ab499f709119
BLAKE2b-256 fb39f0cb8f0fe25994d263e563bcd2266f3b143851e672361b26473f7ba6c4cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_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.1.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyterp-0.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 83.9 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.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 257839f7d82257293f31b400133d072e22f0adc20ebf703f8dcbfe6639fbc29e
MD5 e0ab049ac70de986e24dcca7e5a0cfc6
BLAKE2b-256 e71980f8416a952955d5c57b7950bc92e961fc08102053aa9fc2984944e45342

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 75.1 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.1.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 2f3b5bd06f4f86520fb505aad8cadc6e9673cfcf675228a0d5b9461d8c858646
MD5 ccfe78cb1409f3a8606339397054889c
BLAKE2b-256 1ee9f58437646ec33c59a0df1cacfd9b73a78844f2b0220a0e4a395be9b4eabe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.1.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.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyterp-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43ed0871d9089f93017cf4dbee895a49ecf23fc8e7ebc388b74a8e7c407f2263
MD5 dc3aa716870735337cb118c04d953d2a
BLAKE2b-256 84fe3500a0efe200b787bd9ab550b65d6f2978c10cb20e13b5d247fe32f0c66f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyterp-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_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