Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from pydata:main #506

Merged
merged 2 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[
Expand Down
4 changes: 2 additions & 2 deletions xarray/tests/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion xarray/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,14 @@ def imshow_called(self, plotmethod):

def contourf_called(self, plotmethod):
plotmethod()
paths = plt.gca().findobj(mpl.collections.PathCollection)

# Compatible with mpl before (PathCollection) and after (QuadContourSet) 3.8
def matchfunc(x):
return isinstance(
x, (mpl.collections.PathCollection, mpl.contour.QuadContourSet)
)

paths = plt.gca().findobj(matchfunc)
return len(paths) > 0


Expand Down