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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

pyterp-0.1.3-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.3-cp311-cp311-win_amd64.whl (85.0 kB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

pyterp-0.1.3-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.3-cp310-cp310-win_amd64.whl (83.9 kB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

pyterp-0.1.3-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.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyterp-0.1.3-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.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 91cac4e0cd4d05cc6b8ce27ee05393170b28927da23a9fd4faaf1014f30f6108
MD5 5078df834cf17b90abbcf3bd9843a972
BLAKE2b-256 7c2e6c76bc8e5927519ffb9e29f5da3018a26172def3790531edfa461e1f4114

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.3-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.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 fe92dcc93b1e312c260a66f1639c7ddc77c10516e1bdf2fa8c65c9187d080b05
MD5 b6bd5480f63227978324d9085af59a51
BLAKE2b-256 8f2175331c20dd44f9bfd4781d93d9db95ac8c68968013856515369cc5265f70

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyterp-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 90d8f8e989fda4a73e948a14e7d8add21dad1b11455c599d3730ee241d5d7c88
MD5 776fa40b0e2c3990759173a7ed6b6ed9
BLAKE2b-256 7b0d9f84e4c7f0fe967f6d1257839f24e2e72011f2c5e5f0051df345d52a2dec

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.3-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.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7ef02b8edbd360c2bd79eceeac025e031f9f868c7b8feee9807e304dd22c5af9
MD5 aad37a3920f5ddfa0201779cf1ec0458
BLAKE2b-256 b2d47765a428f91c59a369661ee61262ef82e91c966fc4a3bd14c291d2765960

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.3-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.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 a52c2103c4793b078b83b02215278cf4471c00e20b6d287f93d30ebe092d929a
MD5 a1b87cb22f4387e8969f92df2c66dc8f
BLAKE2b-256 f7ee3db62f9b29ceebefc3fb1361a35388fd923ed79ec8786ca2acb0cbae7954

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyterp-0.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b247a0c6be673ef2c4ae7141bd0c4bb41cdfe02c9eee3dee73489f0a7a7bb53
MD5 51f0d6ddc65ca0cf7559036aff4a30a3
BLAKE2b-256 552a82091ad5056bdb4a3f2197040e528558952a5e61df2c7ca6eb5b426b7577

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.3-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.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bad470dc59b3aa319dc7e5b1126ffc6bd5603b685d35f92dd2c1e95e0270c6a2
MD5 19a0037cc8d175856e65e00bccb81351
BLAKE2b-256 3b6bd96e774044467a38ae9081bac7c814b83950f9b2dbdf874f3a51c7e7184a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.3-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.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 969be9bac10fa1ce0b2d438340b75433ad145b8716a53fae82b191d58eb8fe42
MD5 56b58f58a92fe9ae770ae687b33cea0e
BLAKE2b-256 bede91558d8acb1952fda055fafd28e6bc7b686c2d056515acf387f545a5a132

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyterp-0.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ce83a0fe50834fb571d5c8cbb7598250bd298c966a786712800449a3c7084caf
MD5 43d7155e24ddc45e990bb50561ef63ed
BLAKE2b-256 097031003dccf930fa002e875aa38a921e3a55ff9b05fb0ff594867be918fc86

See more details on using hashes here.

Provenance

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