diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index 2e0a3a7089d..6dd907a0230 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -3380,7 +3380,7 @@ def interpolate_na( dim : Hashable or None, optional Specifies the dimension along which to interpolate. method : {"linear", "nearest", "zero", "slinear", "quadratic", "cubic", "polynomial", \ - "barycentric", "krog", "pchip", "spline", "akima"}, default: "linear" + "barycentric", "krogh", "pchip", "spline", "akima"}, default: "linear" String indicating which method to use for interpolation: - 'linear': linear interpolation. Additional keyword @@ -3389,7 +3389,7 @@ def interpolate_na( are passed to :py:func:`scipy.interpolate.interp1d`. If ``method='polynomial'``, the ``order`` keyword argument must also be provided. - - 'barycentric', 'krog', 'pchip', 'spline', 'akima': use their + - 'barycentric', 'krogh', 'pchip', 'spline', 'akima': use their respective :py:class:`scipy.interpolate` classes. use_coordinate : bool or str, default: True diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index a96d1f34c98..40ba2677f45 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -3730,7 +3730,7 @@ def interp( If DataArrays are passed as new coordinates, their dimensions are used for the broadcasting. Missing values are skipped. method : {"linear", "nearest", "zero", "slinear", "quadratic", "cubic", "polynomial", \ - "barycentric", "krog", "pchip", "spline", "akima"}, default: "linear" + "barycentric", "krogh", "pchip", "spline", "akima"}, default: "linear" String indicating which method to use for interpolation: - 'linear': linear interpolation. Additional keyword @@ -3739,7 +3739,7 @@ def interp( are passed to :py:func:`scipy.interpolate.interp1d`. If ``method='polynomial'``, the ``order`` keyword argument must also be provided. - - 'barycentric', 'krog', 'pchip', 'spline', 'akima': use their + - 'barycentric', 'krogh', 'pchip', 'spline', 'akima': use their respective :py:class:`scipy.interpolate` classes. assume_sorted : bool, default: False @@ -4006,7 +4006,7 @@ def interp_like( names to an 1d array-like, which provides coordinates upon which to index the variables in this dataset. Missing values are skipped. method : {"linear", "nearest", "zero", "slinear", "quadratic", "cubic", "polynomial", \ - "barycentric", "krog", "pchip", "spline", "akima"}, default: "linear" + "barycentric", "krogh", "pchip", "spline", "akima"}, default: "linear" String indicating which method to use for interpolation: - 'linear': linear interpolation. Additional keyword @@ -4015,7 +4015,7 @@ def interp_like( are passed to :py:func:`scipy.interpolate.interp1d`. If ``method='polynomial'``, the ``order`` keyword argument must also be provided. - - 'barycentric', 'krog', 'pchip', 'spline', 'akima': use their + - 'barycentric', 'krogh', 'pchip', 'spline', 'akima': use their respective :py:class:`scipy.interpolate` classes. assume_sorted : bool, default: False @@ -6371,7 +6371,7 @@ def interpolate_na( dim : Hashable or None, optional Specifies the dimension along which to interpolate. method : {"linear", "nearest", "zero", "slinear", "quadratic", "cubic", "polynomial", \ - "barycentric", "krog", "pchip", "spline", "akima"}, default: "linear" + "barycentric", "krogh", "pchip", "spline", "akima"}, default: "linear" String indicating which method to use for interpolation: - 'linear': linear interpolation. Additional keyword @@ -6380,7 +6380,7 @@ def interpolate_na( are passed to :py:func:`scipy.interpolate.interp1d`. If ``method='polynomial'``, the ``order`` keyword argument must also be provided. - - 'barycentric', 'krog', 'pchip', 'spline', 'akima': use their + - 'barycentric', 'krogh', 'pchip', 'spline', 'akima': use their respective :py:class:`scipy.interpolate` classes. use_coordinate : bool or Hashable, default: True diff --git a/xarray/core/missing.py b/xarray/core/missing.py index 137d689de3b..e77ec34b307 100644 --- a/xarray/core/missing.py +++ b/xarray/core/missing.py @@ -501,7 +501,7 @@ def _get_interpolator( ) elif method == "barycentric": interp_class = _import_interpolant("BarycentricInterpolator", method) - elif method == "krog": + elif method in ["krogh", "krog"]: interp_class = _import_interpolant("KroghInterpolator", method) elif method == "pchip": interp_class = _import_interpolant("PchipInterpolator", method) diff --git a/xarray/core/types.py b/xarray/core/types.py index 8f00ed05cdb..6c15d666f1c 100644 --- a/xarray/core/types.py +++ b/xarray/core/types.py @@ -189,7 +189,7 @@ def copy( Interp1dOptions = Literal[ "linear", "nearest", "zero", "slinear", "quadratic", "cubic", "polynomial" ] -InterpolantOptions = Literal["barycentric", "krog", "pchip", "spline", "akima"] +InterpolantOptions = Literal["barycentric", "krogh", "pchip", "spline", "akima"] InterpOptions = Union[Interp1dOptions, InterpolantOptions] DatetimeUnitOptions = Literal[ diff --git a/xarray/tests/test_missing.py b/xarray/tests/test_missing.py index c303659116b..fe2cdc58807 100644 --- a/xarray/tests/test_missing.py +++ b/xarray/tests/test_missing.py @@ -117,8 +117,8 @@ def test_interpolate_pd_compat(): @requires_scipy -@pytest.mark.parametrize("method", ["barycentric", "krog", "pchip", "spline", "akima"]) -def test_scipy_methods_function(method): +@pytest.mark.parametrize("method", ["barycentric", "krogh", "pchip", "spline", "akima"]) +def test_scipy_methods_function(method) -> None: # Note: Pandas does some wacky things with these methods and the full # integration tests won't work. da, _ = make_interpolate_example_data((25, 25), 0.4, non_uniform=True)