pyinterp.bicubic

pyinterp.bicubic(mesh: Union[pyinterp.grid.Grid2D, pyinterp.grid.Grid3D, pyinterp.grid.Grid4D], x: numpy.ndarray, y: numpy.ndarray, z: Optional[numpy.ndarray] = None, u: Optional[numpy.ndarray] = None, nx: Optional[int] = 3, ny: Optional[int] = 3, fitting_model: str = 'c_spline', boundary: str = 'undef', bounds_error: bool = False, num_threads: int = 0) numpy.ndarray[source]

Bicubic gridded interpolator.

Parameters
  • mesh (pyinterp.grid.Grid2D, pyinterp.grid.Grid3D, pyinterp.grid.Grid4D) –

    Function on a uniform grid to be interpolated. If the grid is a ND grid, the bicubic interpolation is performed spatially along the X and Y axes of the ND grid and a linear interpolation are performed along the other axes between the values obtained by the bicubic interpolation.

    Warning

    The GSL functions for calculating bicubic functions require that the axes defined in the grids are strictly increasing.

  • x (numpy.ndarray) – X-values.

  • y (numpy.ndarray) – Y-values.

  • z (numpy.ndarray, optional) – None for a 2D Grid otherwise Z-values.

  • u (numpy.ndarray, optional) – None for a 2D Grid, 3D Grid otherwise U-values.

  • nx (int, optional) – The number of X-coordinate values required to perform the interpolation. Defaults to 3.

  • ny (int, optional) – The number of Y-coordinate values required to perform the interpolation. Defaults to 3.

  • fitting_model (str, optional) – Type of interpolation to be performed. Supported are linear, bicubic, polynomial, c_spline, c_spline_periodic, akima, akima_periodic and steffen. Default to bicubic.

  • boundary (str, optional) –

    A flag indicating how to handle boundaries of the frame.

    • expand: Expand the boundary as a constant.

    • wrap: circular boundary conditions.

    • sym: Symmetrical boundary conditions.

    • undef: Boundary violation is not defined.

    Default undef.

  • bounds_error (bool, optional) – If True, when interpolated values are requested outside of the domain of the input axes (x,y), a ValueError is raised. If False, then the value is set to NaN. Default to False.

  • num_threads (int, optional) – The number of threads to use for the computation. If 0 all CPUs are used. If 1 is given, no parallel computing code is used at all, which is useful for debugging. Defaults to 0.

Returns

Values interpolated.

Return type

numpy.ndarray