From 5213f0d63465eac228822fb7299046e0c6701acc Mon Sep 17 00:00:00 2001 From: Michael Niklas Date: Fri, 1 Dec 2023 23:02:38 +0100 Subject: [PATCH] change type of curvefit's p0 and bounds to mapping (#8502) * change type of curvefit's p0 and bounds to mapping * add entry to whats-new --- doc/whats-new.rst | 4 +++- xarray/core/dataarray.py | 4 ++-- xarray/core/dataset.py | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 14869b3a1ea..102a64af433 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -58,7 +58,9 @@ Bug fixes - Fix dtype inference for ``pd.CategoricalIndex`` when categories are backed by a ``pd.ExtensionDtype`` (:pull:`8481`) - Fix writing a variable that requires transposing when not writing to a region (:pull:`8484`) By `Maximilian Roos `_. - +- Static typing of ``p0`` and ``bounds`` arguments of :py:func:`xarray.DataArray.curvefit` and :py:func:`xarray.Dataset.curvefit` + was changed to ``Mapping`` (:pull:`8502`). + By `Michael Niklas `_. Documentation ~~~~~~~~~~~~~ diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index 935eff9fb18..1d7e82d3044 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -6220,8 +6220,8 @@ def curvefit( func: Callable[..., Any], reduce_dims: Dims = None, skipna: bool = True, - p0: dict[str, float | DataArray] | None = None, - bounds: dict[str, tuple[float | DataArray, float | DataArray]] | None = None, + p0: Mapping[str, float | DataArray] | None = None, + bounds: Mapping[str, tuple[float | DataArray, float | DataArray]] | None = None, param_names: Sequence[str] | None = None, errors: ErrorOptions = "raise", kwargs: dict[str, Any] | None = None, diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 5d19265e56d..d010bfbade0 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -9622,8 +9622,8 @@ def curvefit( func: Callable[..., Any], reduce_dims: Dims = None, skipna: bool = True, - p0: dict[str, float | DataArray] | None = None, - bounds: dict[str, tuple[float | DataArray, float | DataArray]] | None = None, + p0: Mapping[str, float | DataArray] | None = None, + bounds: Mapping[str, tuple[float | DataArray, float | DataArray]] | None = None, param_names: Sequence[str] | None = None, errors: ErrorOptions = "raise", kwargs: dict[str, Any] | None = None,