pyinterp.geometry.geographic.RTree

Contents

pyinterp.geometry.geographic.RTree#

class pyinterp.geometry.geographic.RTree(self)#

Bases: object

Spatial index for geographic longitude/latitude points.

Build an R-tree on geographic coordinates expressed directly in degrees. All distance calculations and interpolations are performed on the spheroid; no conversion to ECEF is applied.

Examples

>>> import numpy as np
>>> from pyinterp.core.geometry.geographic import RTree
>>> coords = np.array([
...     [2.0, 48.0],
...     [3.0, 49.0]
... ])
>>> values = np.array([10.5, 20.3])
>>> tree = RTree()
>>> tree.packing(coords, values)
>>> query = np.array([[2.5, 48.5]])
>>> distances, neighbors = tree.query(query, k=2)

Create an empty geographic RTree.

Public Methods

bounds(self)

Return the bounding box containing all stored points, or None if the tree is empty.

clear(self)

Remove all points from the tree.

empty(self)

Check if the tree is empty.

insert(self, coordinates[, shape, writable, ...])

Insert points into the tree.

inverse_distance_weighting(self, coordinates)

Inverse distance weighting interpolation on geographic coordinates.

kriging(self, coordinates[, shape, writable])

Kriging interpolation on geographic coordinates.

packing(self, coordinates[, shape, ...])

Bulk-load points using the STR packing algorithm.

query(self, coordinates[, shape, writable])

Query k-nearest neighbors for multiple points.

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

Radial basis function interpolation on geographic coordinates.

size(self)

Return the number of points in the tree.

window_function(self, coordinates[, shape, ...])

Window function interpolation on geographic coordinates.

Special Methods

__getstate__(self)

Get the state for pickling.

__new__(*args, **kwargs)

__setstate__(self, state)

Set the state for unpickling.