Interpolation on Unstructured Grids#

Spatial index trees.

Spatial Index (R-Tree)#

RTree3D([spheroid, dtype])

Spatial index for 3D point data with interpolation methods.

RTree3DFloat32(self[, spheroid])

Spatial index for 3D point data with interpolation methods.

RTree3DFloat64(self[, spheroid])

Spatial index for 3D point data with interpolation methods.

Algorithms#

Interpolation algorithms for unstructured data.

inverse_distance_weighting(tree, coordinates)

Inverse Distance Weighting interpolation.

radial_basis_function(tree, coordinates[, ...])

Radial Basis Function interpolation.

kriging(tree, coordinates[, config, k, ...])

Kriging interpolation.

window_function(tree, coordinates[, config, ...])

Window function interpolation.

query(tree, coordinates[, config, k, ...])

Query nearest neighbors.

Core RTree#

Base Class and Type Hints#

The RTree3DHolder is the generic base class used in type hints for R-Tree spatial indexes with support for different data types (float32 and float64). It is returned by the factory functions RTree3D(), RTree3DFloat32(), and RTree3DFloat64().

class pyinterp.core.RTree3DHolder(Generic[_FloatDType])#

Generic holder for a 3D R-Tree spatial index supporting different floating-point types.

Parameters:

spheroid (pyinterp.core.geometry.geographic.Spheroid | None) – Optional spheroid for geographic coordinate transformations.

bounds() tuple[NDArray, NDArray] | None#

Get the bounding box of all inserted points.

clear() None#

Clear the R-Tree by removing all stored points.

empty() bool#

Check if the R-Tree is empty.

insert(coordinates: NDArray[TwoDims], values: NDArray[OneDim]) None#

Insert points and associated values into the R-Tree.

inverse_distance_weighting(coordinates: NDArray[TwoDims], config: rtree.InverseDistanceWeighting | None = None) tuple[NDArray[OneDim], NDArray[UInt32]]#

Perform Inverse Distance Weighting interpolation on the R-Tree.

kriging(coordinates: NDArray[TwoDims], config: rtree.Kriging | None = None) tuple[NDArray[OneDim], NDArray[UInt32]]#

Perform Kriging interpolation on the R-Tree.

packing(coordinates: NDArray[TwoDims], values: NDArray[OneDim]) None#

Pack points and values into the R-Tree for optimized queries.

query(coordinates: NDArray[TwoDims], config: rtree.Query | None = None) tuple[NDArray[TwoDims], NDArray[TwoDims]]#

Query the R-Tree for nearest neighbors.

radial_basis_function(coordinates: NDArray[TwoDims], config: rtree.RadialBasisFunction | None = None) tuple[NDArray[OneDim], NDArray[UInt32]]#

Perform Radial Basis Function interpolation on the R-Tree.

size() int#

Get the number of points stored in the R-Tree.

window_function(coordinates: NDArray[TwoDims], config: rtree.InterpolationWindow | None = None) tuple[NDArray[OneDim], NDArray[UInt32]]#

Perform window function interpolation on the R-Tree.

spheroid: pyinterp.core.geometry.geographic.Spheroid | None#

The spheroid associated with this R-Tree instance.

Geographic R-Tree Implementation#

Specialized R-Tree implementation for geographic (spherical/ellipsoidal) coordinates.

RTree(self)

Spatial index for geographic longitude/latitude points.

Note

The pyinterp.core.geometry.geographic.RTree class provides geographic-aware spatial indexing on spherical/ellipsoidal coordinates (longitude/latitude). This is the same class alias used throughout the library’s high-level API as pyinterp.geometry.geographic.RTree.