interp

interp#

_HdfData.interp(data, unit=None, **kwargs)[source]#

Interpolate the dataset at arbitrary spatial positions.

Builds or reuses a RegularGridInterpolator and evaluates it at the positions given by data. When caching is disabled (cache=None), a minimal bounding-box slice is read on each call. When caching is enabled, the interpolator is cached and reused for subsequent calls that fall within the same grid extent.

Parameters:
dataArrayLike | Table

Positions to interpolate, as a Table-like \(N \times S\) array, where \(\lvert N \rvert\) is the number of positions, and \(\lvert S \rvert\) is the number of scales. When columns do not possess a unit, they are cast to the corresponding scale’s units.

unitUnitLike | None, optional

Output unit. Default is None (code units).

**kwargsobject

Forwarded to RegularGridInterpolator. Notable keywords: bounds_error (default True), fill_value (default None).

Returns:
outQuantity

Interpolated values of shape (N,).

Raises:
ImportError

If scipy is not installed.

Examples

>>> import numpy as np
>>> import astropy.units as u
>>> positions = np.column_stack([[1.5, 2.0], [1.57, 1.57], [0.1, 0.2]])
>>> result = reader.interp(positions)