From 76aa3aa0d207626bf21af41b10781e622b5cb634 Mon Sep 17 00:00:00 2001 From: Michael Niklas Date: Fri, 1 Dec 2023 21:17:05 +0100 Subject: [PATCH 1/2] change type of curvefit's p0 and bounds to mapping --- xarray/core/dataarray.py | 4 ++-- xarray/core/dataset.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 c65bbd6b849..12b1a41c820 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, From f0b516fea70fb46cb654ca9378288a94211c6888 Mon Sep 17 00:00:00 2001 From: Michael Niklas Date: Fri, 1 Dec 2023 21:20:41 +0100 Subject: [PATCH 2/2] add entry to whats-new --- doc/whats-new.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 817ea2c8235..0117a7f293e 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 ~~~~~~~~~~~~~