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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

pyterp-0.1.2-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.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyterp-0.1.2-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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ca316d4c9224a55e1535dbf53eed88f2e7f7e79131e0eb0de49a806f1b3ec1d0
MD5 bc70c74c42c9500aaea1a598583b73d7
BLAKE2b-256 f97e643f30f800a988c14f97facccefc4d5f7935a0723ca72cd84db609176766

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.2-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.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 915c6b7aee99084d18adcef6df734e386d240f22b098045f3bb692f92f23e740
MD5 a79a05e123abe3b4ee4bc4d892ec79a0
BLAKE2b-256 601bef7f582c73625d63e9a78ca180f70bc1b224654b912a0107d13f4670a887

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyterp-0.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 effa2d1c4253eaf488091603ac8cbed023e29666a7cd35004e476a4edeb1e78d
MD5 6de75731bfe075e8d006eeb00c526f33
BLAKE2b-256 9e8a7f9d8eba4b9e63682ae06bf3537e4c5f312caa756a4333a4f88bc9055e39

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.2-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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cd47c5193e17e29f0b62d8be5f43b02536eb8807af31cd99de111ec26a96b52c
MD5 6798b44111fb77502c7e5c5c1831e940
BLAKE2b-256 901f0e26c8f60e9ba21df51d901b9a7594ada04f7c11c84f9170b9f673a746f4

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.2-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.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 a760ada83b0f8d72387b553abb62f9b46be3c9e4c419d89d2906b5109cc4d261
MD5 f5d975e2d026c2876e89d6764fd0e988
BLAKE2b-256 39a4432d48246a184e7f0d6fe3f72a41f9468239abf6545e6a98e840d1c5009d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyterp-0.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3361ff5019d90fbe8315d871b52ffa1424a969a62c56e2a6cc9340a072f87d14
MD5 619d6c8754db3c260d30df8216857d29
BLAKE2b-256 cb906b4908447ebb7986e095935eef1f41e00165b1e7bfa83a9bf74a62e8bc02

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.2-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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 80940aa60f18eef65623a4bbf985024808e26f55460cf601acbc8d4d79f60cf5
MD5 bb69ddb3fe9865ac4bd8d6f18f02ee3f
BLAKE2b-256 afd67a262732907c577ba29af3c3f55d783873e993d4ddeb880b53691e6f6446

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyterp-0.1.2-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.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 23bb699ad6f85d83afea19bd92cce83dea6716e78f26563f4500d1a389e7e786
MD5 e662c512d30e69e45bb1c7c1d1bee979
BLAKE2b-256 50df4db70518f7340e556fa9c259d1511b635e5701017eb1c6704244d84f3851

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pyterp-0.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3374952ad1aef39dc4309bf266aa88fb6e447b90f1eb3a73d20487ad3950f099
MD5 5afe65d517014e55c785eae6cda09631
BLAKE2b-256 81322b513bf4a8da668d6f75ebb298d00503057e39366b9f6ad1a36d400bc773

See more details on using hashes here.

Provenance

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