Skip to content

Add interpolation tools: IDW, Kriging, and Spline#934

Merged
brendancol merged 1 commit intomasterfrom
worktree-interpolation-tools
Mar 3, 2026
Merged

Add interpolation tools: IDW, Kriging, and Spline#934
brendancol merged 1 commit intomasterfrom
worktree-interpolation-tools

Conversation

@brendancol
Copy link
Contributor

Summary

Adds three interpolation methods for converting scattered point observations into gridded rasters. Closes #932.

  • IDW: all-points numba JIT kernel + k-nearest via scipy cKDTree, with CUDA kernel for GPU. All 4 backends.
  • Kriging: ordinary kriging with automatic variogram fitting (spherical, exponential, gaussian). Numpy and dask backends; GPU stubs raise NotImplementedError.
  • Spline: thin plate spline with CPU system solve and parallelised grid evaluation. All 4 backends.

Also adds .xrs accessor methods (idw, kriging, spline), updates the README, and includes 25 tests.

Test plan

  • IDW exact interpolation, symmetry, k=1 nearest-neighbor
  • Spline exact interpolation, linear recovery, smoothing effect
  • Kriging prediction at data points, variance output, all 3 variogram models
  • Dask backends match numpy for all three methods
  • Validation errors for bad inputs (wrong types, NaN-only points, invalid params)
  • Edge cases (single point, collinear points, k > n_points)
  • Existing accessor tests still pass

Three new functions for converting scattered point observations
(x, y, z arrays) into gridded xarray DataArrays on a user-specified
template grid.

- IDW: all-points numba JIT kernel and k-nearest via scipy cKDTree,
  with CUDA kernel for GPU; all 4 backends
- Kriging: ordinary kriging with automatic variogram fitting
  (spherical, exponential, gaussian models); numpy and dask backends
- Spline: thin plate spline with CPU system solve and parallelised
  grid evaluation; all 4 backends

Also adds .xrs accessor methods and 25 tests covering correctness,
cross-backend consistency, validation, and edge cases.
@github-actions github-actions bot added the performance PR touches performance-sensitive code label Mar 3, 2026
@brendancol brendancol merged commit 25309d8 into master Mar 3, 2026
11 checks passed
@brendancol brendancol deleted the worktree-interpolation-tools branch March 5, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add interpolation tools: IDW, Kriging, and Spline

1 participant