Add natural neighbor (Voronoi-based) interpolation

Open
#1,153 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
numpy, python
Domain
data

Research direction

Start by reading the existing idw() and kriging() functions to understand their shared interface and gridding behavior. Then investigate the numpy path using scipy.spatial.Voronoi, along with how a GPU path would be handled. Done means scattered points produce a raster with Sibson natural-neighbor interpolation while preserving the existing interface.

Written by the indexing model from the issue text.

Description

after-1.0.0-release enhancement

Motivation

The interpolation module currently has IDW, kriging, and spline, but is missing natural neighbor interpolation. This is one of gdal_grid's interpolation methods and is often preferred over IDW because it produces smoother surfaces without the "bullseye" artifacts that IDW tends to create around data points.

Proposed scope

  • Given scattered points (x, y, value), produce a gridded raster using Sibson's natural neighbor method.
  • The method works by constructing Voronoi diagrams: the interpolated value at a query point is a weighted average of nearby data points, where each weight is proportional to the area "stolen" from that point's Voronoi cell when the query point is inserted.
  • Should follow the same interface as the existing idw() and kriging() functions.

Implementation notes

The Voronoi computation is the expensive part. For the numpy path, scipy.spatial.Voronoi can be leveraged. The GPU path would need a custom Voronoi implementation or a different algorithmic approach.

Additional suggestion

Also worth considering: a simple moving-average gridding method (another gdal_grid mode) as a cheaper alternative for cases where the smoothness of natural neighbor isn't needed.

Dominant language
Python
Stars
972
Forks
92
Avg merge
2d 12h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xarray-contrib/xarray-spatial

All issues in xarray-contrib/xarray-spatial

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.