From 116725e69a93ba85267daaa7557f2773f2f3a225 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Mon, 2 Feb 2026 01:55:15 +0100 Subject: [PATCH 1/3] Remove duplicate Notes section --- xarray/computation/apply_ufunc.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/xarray/computation/apply_ufunc.py b/xarray/computation/apply_ufunc.py index 9d62d40f38b..36cdf2bfbf6 100644 --- a/xarray/computation/apply_ufunc.py +++ b/xarray/computation/apply_ufunc.py @@ -1040,6 +1040,12 @@ def apply_ufunc( Note that due to the overhead :py:func:`xarray.map_blocks` is considerably slower than ``apply_ufunc``. + :ref:`dask.automatic-parallelization` + User guide describing :py:func:`apply_ufunc` and :py:func:`map_blocks`. + + :doc:`xarray-tutorial:advanced/apply_ufunc/apply_ufunc` + Advanced Tutorial on applying numpy function using :py:func:`apply_ufunc` + Examples -------- Calculate the vector magnitude of two arguments: @@ -1141,14 +1147,6 @@ def apply_ufunc( dask.array.apply_gufunc xarray.map_blocks - Notes - ----- - :ref:`dask.automatic-parallelization` - User guide describing :py:func:`apply_ufunc` and :py:func:`map_blocks`. - - :doc:`xarray-tutorial:advanced/apply_ufunc/apply_ufunc` - Advanced Tutorial on applying numpy function using :py:func:`apply_ufunc` - References ---------- .. [1] https://numpy.org/doc/stable/reference/ufuncs.html From 6b7e835472eb4f8c00e5c376c738c38e4b867e62 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Mon, 2 Feb 2026 02:00:06 +0100 Subject: [PATCH 2/3] Fix numpydoc section header underline lengths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed incorrect number of dashes in section headers: - See Also, Returns, Parameters, Examples sections now have correct number of dashes matching the section title length 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude --- xarray/core/dataarray.py | 10 +++++----- xarray/core/dataset.py | 2 +- xarray/core/options.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index a6a7f1f80ae..ea32b88af1c 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -3199,7 +3199,7 @@ def drop_vars( New Dataset copied from `self` with variables removed. Examples - ------- + -------- >>> data = np.arange(12).reshape(4, 3) >>> da = xr.DataArray( ... data=data, @@ -4702,7 +4702,7 @@ def broadcast_equals(self, other: Self) -> bool: DataArray to compare to. Returns - ---------- + ------- equal : bool True if the two DataArrays are broadcast equal. @@ -4756,7 +4756,7 @@ def equals(self, other: Self) -> bool: DataArray to compare to. Returns - ---------- + ------- equal : bool True if the two DataArrays are equal. @@ -4812,7 +4812,7 @@ def identical(self, other: Self) -> bool: DataArray to compare to. Returns - ---------- + ------- equal : bool True if the two DataArrays are identical. @@ -6746,7 +6746,7 @@ def convert_calendar( time part of the timestamps. Parameters - --------- + ---------- calendar : str The target calendar name. dim : str diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index fc82e89d021..c69265c913f 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -9933,7 +9933,7 @@ def convert_calendar( time part of the timestamps. Parameters - --------- + ---------- calendar : str The target calendar name. dim : Hashable, default: "time" diff --git a/xarray/core/options.py b/xarray/core/options.py index 686f84c970a..2d910d80d65 100644 --- a/xarray/core/options.py +++ b/xarray/core/options.py @@ -385,7 +385,7 @@ def get_options(): Get options for xarray. See Also - ---------- + -------- set_options """ From 40eb0c29b138ce5c168941e99513bc7ec97bcd0b Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Mon, 2 Feb 2026 02:01:17 +0100 Subject: [PATCH 3/3] Fix numpydoc unknown section names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed incorrect section names to match numpydoc standards: - Return → Returns - Note → Notes - Example → Examples - Warning → Warnings - See also -> See Also 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude --- xarray/backends/api.py | 2 +- xarray/coding/cftime_offsets.py | 2 +- xarray/core/dataarray.py | 14 +++++++------- xarray/core/dataset.py | 24 ++++++++++++------------ xarray/core/datatree.py | 14 +++++++------- xarray/core/datatree_mapping.py | 2 +- xarray/core/treenode.py | 2 +- xarray/core/utils.py | 2 +- xarray/namedarray/parallelcompat.py | 2 +- xarray/structure/combine.py | 4 ++-- xarray/structure/concat.py | 2 +- xarray/structure/merge.py | 2 +- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/xarray/backends/api.py b/xarray/backends/api.py index 85da88f5339..59af266f202 100644 --- a/xarray/backends/api.py +++ b/xarray/backends/api.py @@ -805,7 +805,7 @@ class (a subclass of ``BackendEntrypoint``) can also be used. All parameters are passed directly to `xarray.open_dataset`. See that documentation for further details. - See also + See Also -------- open_dataset """ diff --git a/xarray/coding/cftime_offsets.py b/xarray/coding/cftime_offsets.py index 5ddbe55d98a..26857c3cc71 100644 --- a/xarray/coding/cftime_offsets.py +++ b/xarray/coding/cftime_offsets.py @@ -1415,7 +1415,7 @@ def date_range( 2000-07-01 00:00:00, 2000-09-01 00:00:00, 2000-11-01 00:00:00], dtype='object', length=6, calendar='noleap', freq='2MS') - See also + See Also -------- pandas.date_range cftime_range diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index ea32b88af1c..227b55476f9 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -3985,7 +3985,7 @@ def to_dataframe( result: DataFrame DataArray as a pandas DataFrame. - See also + See Also -------- DataArray.to_pandas DataArray.to_series @@ -4028,7 +4028,7 @@ def to_series(self) -> pd.Series: result : Series DataArray as a pandas Series. - See also + See Also -------- DataArray.to_pandas DataArray.to_dataframe @@ -5487,7 +5487,7 @@ def differentiate( ------- differentiated: DataArray - See also + See Also -------- numpy.gradient: corresponding numpy function @@ -5545,7 +5545,7 @@ def integrate( ------- integrated : DataArray - See also + See Also -------- Dataset.integrate numpy.trapz : corresponding numpy function @@ -5602,7 +5602,7 @@ def cumulative_integrate( ------- integrated : DataArray - See also + See Also -------- Dataset.cumulative_integrate scipy.integrate.cumulative_trapezoid : corresponding scipy function @@ -6867,8 +6867,8 @@ def interp_calendar( dim : str The time coordinate name. - Return - ------ + Returns + ------- DataArray The source interpolated on the decimal years of target, """ diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index c69265c913f..425a3dc19cb 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -1178,7 +1178,7 @@ def as_numpy(self) -> Self: """ Coerces wrapped data and coordinates into numpy arrays, returning a Dataset. - See also + See Also -------- DataArray.as_numpy DataArray.to_numpy : Returns only the data as a numpy.ndarray object. @@ -1688,8 +1688,8 @@ def identical(self, other: Self) -> bool: """Like equals, but also checks all dataset attributes, the attributes on all variables and coordinates, and indexes. - Example - ------- + Examples + -------- >>> a = xr.Dataset( ... {"Width": ("X", [1, 2, 3])}, @@ -6558,7 +6558,7 @@ def interpolate_na( interpolated: Dataset Filled in Dataset. - Warning + Warnings -------- When passing fill_value as a keyword argument with method="linear", it does not use ``numpy.interp`` but it uses ``scipy.interpolate.interp1d``, which provides the fill_value parameter. @@ -7601,7 +7601,7 @@ def from_dict(cls, d: Mapping[Any, Any]) -> Self: ------- obj : Dataset - See also + See Also -------- Dataset.to_dict DataArray.from_dict @@ -8398,7 +8398,7 @@ def differentiate( ------- differentiated: Dataset - See also + See Also -------- numpy.gradient: corresponding numpy function """ @@ -8464,7 +8464,7 @@ def integrate( ------- integrated : Dataset - See also + See Also -------- DataArray.integrate numpy.trapz : corresponding numpy function @@ -8585,7 +8585,7 @@ def cumulative_integrate( ------- integrated : Dataset - See also + See Also -------- DataArray.cumulative_integrate scipy.integrate.cumulative_trapezoid : corresponding scipy function @@ -9592,8 +9592,8 @@ def eval( result : Dataset or DataArray, depending on whether ``statement`` contains an assignment. - Warning - ------- + Warnings + -------- Like ``pd.eval()``, this method should not be used with untrusted input. Examples @@ -10054,8 +10054,8 @@ def interp_calendar( dim : Hashable, default: "time" The time coordinate name. - Return - ------ + Returns + ------- DataArray The source interpolated on the decimal years of target, """ diff --git a/xarray/core/datatree.py b/xarray/core/datatree.py index e079332780c..3ac63f37be1 100644 --- a/xarray/core/datatree.py +++ b/xarray/core/datatree.py @@ -1237,7 +1237,7 @@ def from_dict( ------- DataTree - See also + See Also -------- Dataset @@ -1428,7 +1428,7 @@ def to_dict(self, relative: bool = False) -> dict[str, Dataset]: ------- dict[str, Dataset] - See also + See Also -------- DataTree.subtree_with_keys """ @@ -1805,7 +1805,7 @@ def map_over_datasets( subtrees : DataTree, tuple of DataTrees One or more subtrees containing results from applying ``func`` to the data at each node. - See also + See Also -------- map_over_datasets """ @@ -2052,8 +2052,8 @@ def to_netcdf( * ``dask.delayed.Delayed`` if compute is False * ``None`` otherwise - Note - ---- + Notes + ----- Due to file format specifications the on-disk root group name is always ``"/"`` overriding any given ``DataTree`` root node name. """ @@ -2147,8 +2147,8 @@ def to_zarr( kwargs : Additional keyword arguments to be passed to ``xarray.Dataset.to_zarr`` - Note - ---- + Notes + ----- Due to file format specifications the on-disk root group name is always ``"/"`` overriding any given ``DataTree`` root node name. """ diff --git a/xarray/core/datatree_mapping.py b/xarray/core/datatree_mapping.py index b905545c064..2bed7c8f1ca 100644 --- a/xarray/core/datatree_mapping.py +++ b/xarray/core/datatree_mapping.py @@ -86,7 +86,7 @@ def map_over_datasets( Result of applying `func` to each node in the provided trees, packed back into DataTree objects via `DataTree.from_dict`. - See also + See Also -------- DataTree.map_over_datasets group_subtrees diff --git a/xarray/core/treenode.py b/xarray/core/treenode.py index 7eccf09088e..6f81183ddeb 100644 --- a/xarray/core/treenode.py +++ b/xarray/core/treenode.py @@ -830,7 +830,7 @@ def group_subtrees( TreeIsomorphismError If trees are not isomorphic, i.e., they have different structures. - See also + See Also -------- DataTree.subtree DataTree.subtree_with_keys diff --git a/xarray/core/utils.py b/xarray/core/utils.py index e88c499fdb2..c6828f0a363 100644 --- a/xarray/core/utils.py +++ b/xarray/core/utils.py @@ -162,7 +162,7 @@ def did_you_mean( >>> did_you_mean("none", ("blech", "gray_r", 1, None, (2, 56))) 'Did you mean one of (None,)?' - See also + See Also -------- https://en.wikipedia.org/wiki/String_metric """ diff --git a/xarray/namedarray/parallelcompat.py b/xarray/namedarray/parallelcompat.py index b3e017c9cda..8a68f5e9562 100644 --- a/xarray/namedarray/parallelcompat.py +++ b/xarray/namedarray/parallelcompat.py @@ -514,7 +514,7 @@ def scan( ------- Chunked array - See also + See Also -------- dask.array.cumreduction """ diff --git a/xarray/structure/combine.py b/xarray/structure/combine.py index d736f896b4a..e8e973683d0 100644 --- a/xarray/structure/combine.py +++ b/xarray/structure/combine.py @@ -679,7 +679,7 @@ def combine_nested( temperature (t) float64 80B -0.8878 -1.981 -0.3479 ... -0.4381 -1.253 precipitation (t) float64 80B 1.202 -0.3873 -0.3023 ... -0.8955 0.3869 - See also + See Also -------- concat merge @@ -925,7 +925,7 @@ def combine_by_coords( Will return a Dataset unless all the inputs are unnamed DataArrays, in which case a DataArray will be returned. - See also + See Also -------- concat merge diff --git a/xarray/structure/concat.py b/xarray/structure/concat.py index 5acd769a9b5..9609dbcb5a9 100644 --- a/xarray/structure/concat.py +++ b/xarray/structure/concat.py @@ -202,7 +202,7 @@ def concat( ------- concatenated : type of objs - See also + See Also -------- merge diff --git a/xarray/structure/merge.py b/xarray/structure/merge.py index d4790421070..ed5dcbf7ece 100644 --- a/xarray/structure/merge.py +++ b/xarray/structure/merge.py @@ -1092,7 +1092,7 @@ def merge( xarray.MergeError If any variables with the same name have conflicting values. - See also + See Also -------- concat combine_nested