interp#
- _HdfData.interp(data, unit=None, **kwargs)[source]#
Interpolate the dataset at arbitrary spatial positions.
Builds or reuses a
RegularGridInterpolatorand 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:
- data
ArrayLike|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.- unit
UnitLike|None, optional Output unit. Default is
None(code units).- **kwargs
object Forwarded to
RegularGridInterpolator. Notable keywords:bounds_error(defaultTrue),fill_value(defaultNone).
- data
- Returns:
- out
Quantity Interpolated values of shape
(N,).
- out
- Raises:
ImportErrorIf 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)