pyinterp.bivariate

Contents

pyinterp.bivariate#

pyinterp.bivariate(grid: GridHolder, x: NDArray1DNumeric, y: NDArray1DNumeric, method: Bivariate | Bivariate) NDArray1DFloat32 | NDArray1DFloat64[source]#
pyinterp.bivariate(grid: GridHolder, x: NDArray1DNumeric, y: NDArray1DNumeric, method: Literal['bilinear', 'idw', 'nearest'] = 'bilinear', *, bounds_error: bool = False, num_threads: int = 0) NDArray1DFloat32 | NDArray1DFloat64
pyinterp.bivariate(grid: GridHolder, x: NDArray1DNumeric, y: NDArray1DNumeric, method: Literal['akima', 'akima_periodic', 'bicubic', 'bilinear', 'c_spline', 'c_spline_not_a_knot', 'c_spline_periodic', 'linear', 'polynomial', 'steffen'], *, bounds_error: bool = False, num_threads: int = 0, half_window_size_x: int | None = None, half_window_size_y: int | None = None, boundary_mode: Literal['shrink', 'undef'] | None = None) NDArray1DFloat32 | NDArray1DFloat64

Bivariate interpolation.

Parameters:
  • grid (GridHolder) – The 2D grid to interpolate from

  • x (NDArray1DNumeric) – X coordinates at which to interpolate

  • y (NDArray1DNumeric) – Y coordinates at which to interpolate

  • method (geometric.Bivariate | windowed.Bivariate | InterpolationMethods) – Interpolation method (config object or string)

  • bounds_error (bool) – If True, raise error for out-of-bounds coordinates

  • num_threads (int) – Number of threads to use (0 = auto)

  • half_window_size_x (int | None) – Half window size for X axis (windowed methods only)

  • half_window_size_y (int | None) – Half window size for Y axis (windowed methods only)

  • boundary_mode (BoundaryMode | None) – Boundary handling mode (windowed methods only)

Returns:

Interpolated values

Return type:

NDArray1DFloat32 | NDArray1DFloat64

Examples

Simple usage:

>>> result = bivariate(grid, x, y, "bilinear")
>>> result = bivariate(grid, x, y, "bicubic", window_size_x=10)

Advanced usage with config objects:

>>> from pyinterp.core.config import windowed
>>> config = windowed.Bivariate.bicubic().with_half_window_size_x(10)
>>> result = bivariate(grid, x, y, config)