Skip to main content

Spatial Interpolation in Python

Project description

Tests Code style: black

Polire

pip install polire

The word "interpolation" has Latin origin and is composed of two words - Inter meaning between and Polire meaning to polish.

This repository is a collection of several spatial interpolation algorithms.

Examples

To checkout a practical example of how to use this library, please refer to the documentation.

Minimal example of interpolation

import numpy as np
from polire import Kriging

# Data
X = np.random.rand(10, 2) # Spatial 2D points
y = np.random.rand(10) # Observations
X_new = np.random.rand(100, 2) # New spatial points

# Fit
model = Kriging()
model.fit(X, y)

# Predict
y_new = model.predict(X_new)

Supported Interpolation Methods

from polire import (
    Kriging, # Best spatial unbiased predictor
    GP, # Gaussian process interpolator from GPy
    IDW, # Inverse distance weighting
    SpatialAverage,
    Spline,
    Trend,
    Random, # Predict uniformly within the observation range, a reasonable baseline
    NaturalNeighbor,
    CustomInterpolator # Supports any regressor from Scikit-learn
)

Use GP kernels from GPy and regressors from sklearn (temporary unavailable)

from sklearn.linear_model import LinearRegression # or any Scikit-learn regressor
from GPy.kern import Matern32 # or any other GPy kernel

from polire import GP, CustomInterpolator

# GP model
model = GP(Matern32(input_dim=2))

# Sklearn model
model = CustomInterpolator(LinearRegression(normalize = True))

Extract spatial features from spatio-temporal dataset

# X and X_new are datasets as numpy arrays with first three dimensions as longitude, latitute and time.
# y is corresponding observations with X

from polire.preprocessing import SpatialFeatures
spatial = SpatialFeatures(n_closest=10)
Features = spatial.fit_transform(X, y)
Features_new = spatial.transform(X_new)

More info

Contributors: S Deepak Narayanan, Zeel B Patel*, Apoorv Agnihotri, and Nipun Batra* (People with * are currently active contributers).

This project is a part of Sustainability Lab at IIT Gandhinagar.

Acknowledgement to sklearn template for helping to package into a PiPy package.

Citation

If you use this code, please cite the following paper:

@inproceedings{10.1145/3384419.3430407,
author = {Narayanan, S Deepak and Patel, Zeel B and Agnihotri, Apoorv and Batra, Nipun},
title = {A Toolkit for Spatial Interpolation and Sensor Placement},
year = {2020},
isbn = {9781450375900},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3384419.3430407},
doi = {10.1145/3384419.3430407},
booktitle = {Proceedings of the 18th Conference on Embedded Networked Sensor Systems},
pages = {653–654},
numpages = {2},
location = {Virtual Event, Japan},
series = {SenSys '20}
}

Project details


Download files

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

Source Distribution

polire-0.1.4.tar.gz (1.5 MB view details)

Uploaded Source

File details

Details for the file polire-0.1.4.tar.gz.

File metadata

  • Download URL: polire-0.1.4.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for polire-0.1.4.tar.gz
Algorithm Hash digest
SHA256 c15b05408debff140d51aca1370fc2fefeca1ebf791dde3cecdadfc2b1c0d996
MD5 8326f732739277e24cc45cf5997ffb8f
BLAKE2b-256 20f3a4c3f6f99975f9e1c5300c6143bc8ecc1cd02b028896149b0b89643be692

See more details on using hashes here.

Supported by

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