pflm.interp.interp2d#
- interp2d(x: ndarray, y: ndarray, v: ndarray, x_new: ndarray, y_new: ndarray, method: str = 'linear') ndarray[source][source]#
Interpolate 2D gridded data using linear or spline interpolation.
- Parameters:
- xnp.ndarray of shape (n_x,)
X-coordinates of the grid (first axis of v).
- ynp.ndarray of shape (n_y,)
Y-coordinates of the grid (second axis of v).
- vnp.ndarray of shape (n_x, n_y)
Values on the grid defined by (x, y).
- x_newnp.ndarray of shape (m_x,)
Query x-coordinates.
- y_newnp.ndarray of shape (m_y,)
Query y-coordinates.
- method{“linear”, “spline”}, default=”linear”
Interpolation method.
- Returns:
- v_newnp.ndarray of shape (m_x, m_y)
Interpolated values evaluated on the mesh defined by (x_new, y_new). The dtype follows x (float32 -> f32 backend; otherwise f64).
- Raises:
- ValueError
If input dimensionality is invalid, arrays are empty, shape of v does not match (x, y), any input contains NaN, or method is invalid.
See also
interp1dInterpolate 1D data using linear or spline interpolation.
Notes
Duplicates in x and y are deduplicated using the first occurrence.
The underlying C++ implementation expects v in Fortran-like layout with axes swapped; this wrapper transposes/contiguates as needed.
Backend is selected by dtype of x (float32 -> f32; otherwise f64).