pyinterp.RTree4D

Contents

pyinterp.RTree4D#

pyinterp.RTree4D(dtype: object | None = None) object#

Spatial index for 4D point data with per-observation error variance.

Create a Cartesian 4D R-tree designed to back the Optimal Interpolation estimator. Each observation is stored together with its measurement-error variance σ²_obs.

Parameters:

dtype'float32' or 'float64' (default).

Examples

>>> import numpy as np
>>> import pyinterp
>>> tree = pyinterp.RTree4D()
>>> tree.packing(
...     np.array([[0.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]]),
...     np.array([10.0, 20.0]),
...     np.array([0.01, 0.02]),
... )
>>> from pyinterp.core.config.rtree import Query
>>> distances, values, sigma2 = tree.query(
...     np.array([[0.5, 0.0, 0.0, 0.0]]), Query().with_k(2),
... )