Skip to content

Commit 8704ca5

Browse files
DOC: Various Numpydoc fixes (#11122)
* Remove duplicate Notes section * Fix numpydoc section header underline lengths 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 <noreply@anthropic.com> * Fix numpydoc unknown section names 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 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent bc0fdc9 commit 8704ca5

14 files changed

Lines changed: 49 additions & 51 deletions

File tree

xarray/backends/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ class (a subclass of ``BackendEntrypoint``) can also be used.
805805
All parameters are passed directly to `xarray.open_dataset`. See that
806806
documentation for further details.
807807
808-
See also
808+
See Also
809809
--------
810810
open_dataset
811811
"""

xarray/coding/cftime_offsets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ def date_range(
14151415
2000-07-01 00:00:00, 2000-09-01 00:00:00, 2000-11-01 00:00:00],
14161416
dtype='object', length=6, calendar='noleap', freq='2MS')
14171417
1418-
See also
1418+
See Also
14191419
--------
14201420
pandas.date_range
14211421
cftime_range

xarray/computation/apply_ufunc.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,12 @@ def apply_ufunc(
10401040
10411041
Note that due to the overhead :py:func:`xarray.map_blocks` is considerably slower than ``apply_ufunc``.
10421042
1043+
:ref:`dask.automatic-parallelization`
1044+
User guide describing :py:func:`apply_ufunc` and :py:func:`map_blocks`.
1045+
1046+
:doc:`xarray-tutorial:advanced/apply_ufunc/apply_ufunc`
1047+
Advanced Tutorial on applying numpy function using :py:func:`apply_ufunc`
1048+
10431049
Examples
10441050
--------
10451051
Calculate the vector magnitude of two arguments:
@@ -1141,14 +1147,6 @@ def apply_ufunc(
11411147
dask.array.apply_gufunc
11421148
xarray.map_blocks
11431149
1144-
Notes
1145-
-----
1146-
:ref:`dask.automatic-parallelization`
1147-
User guide describing :py:func:`apply_ufunc` and :py:func:`map_blocks`.
1148-
1149-
:doc:`xarray-tutorial:advanced/apply_ufunc/apply_ufunc`
1150-
Advanced Tutorial on applying numpy function using :py:func:`apply_ufunc`
1151-
11521150
References
11531151
----------
11541152
.. [1] https://numpy.org/doc/stable/reference/ufuncs.html

xarray/core/dataarray.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,7 +3199,7 @@ def drop_vars(
31993199
New Dataset copied from `self` with variables removed.
32003200
32013201
Examples
3202-
-------
3202+
--------
32033203
>>> data = np.arange(12).reshape(4, 3)
32043204
>>> da = xr.DataArray(
32053205
... data=data,
@@ -3985,7 +3985,7 @@ def to_dataframe(
39853985
result: DataFrame
39863986
DataArray as a pandas DataFrame.
39873987
3988-
See also
3988+
See Also
39893989
--------
39903990
DataArray.to_pandas
39913991
DataArray.to_series
@@ -4028,7 +4028,7 @@ def to_series(self) -> pd.Series:
40284028
result : Series
40294029
DataArray as a pandas Series.
40304030
4031-
See also
4031+
See Also
40324032
--------
40334033
DataArray.to_pandas
40344034
DataArray.to_dataframe
@@ -4702,7 +4702,7 @@ def broadcast_equals(self, other: Self) -> bool:
47024702
DataArray to compare to.
47034703
47044704
Returns
4705-
----------
4705+
-------
47064706
equal : bool
47074707
True if the two DataArrays are broadcast equal.
47084708
@@ -4756,7 +4756,7 @@ def equals(self, other: Self) -> bool:
47564756
DataArray to compare to.
47574757
47584758
Returns
4759-
----------
4759+
-------
47604760
equal : bool
47614761
True if the two DataArrays are equal.
47624762
@@ -4812,7 +4812,7 @@ def identical(self, other: Self) -> bool:
48124812
DataArray to compare to.
48134813
48144814
Returns
4815-
----------
4815+
-------
48164816
equal : bool
48174817
True if the two DataArrays are identical.
48184818
@@ -5487,7 +5487,7 @@ def differentiate(
54875487
-------
54885488
differentiated: DataArray
54895489
5490-
See also
5490+
See Also
54915491
--------
54925492
numpy.gradient: corresponding numpy function
54935493
@@ -5545,7 +5545,7 @@ def integrate(
55455545
-------
55465546
integrated : DataArray
55475547
5548-
See also
5548+
See Also
55495549
--------
55505550
Dataset.integrate
55515551
numpy.trapz : corresponding numpy function
@@ -5602,7 +5602,7 @@ def cumulative_integrate(
56025602
-------
56035603
integrated : DataArray
56045604
5605-
See also
5605+
See Also
56065606
--------
56075607
Dataset.cumulative_integrate
56085608
scipy.integrate.cumulative_trapezoid : corresponding scipy function
@@ -6746,7 +6746,7 @@ def convert_calendar(
67466746
time part of the timestamps.
67476747
67486748
Parameters
6749-
---------
6749+
----------
67506750
calendar : str
67516751
The target calendar name.
67526752
dim : str
@@ -6867,8 +6867,8 @@ def interp_calendar(
68676867
dim : str
68686868
The time coordinate name.
68696869
6870-
Return
6871-
------
6870+
Returns
6871+
-------
68726872
DataArray
68736873
The source interpolated on the decimal years of target,
68746874
"""

xarray/core/dataset.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ def as_numpy(self) -> Self:
11781178
"""
11791179
Coerces wrapped data and coordinates into numpy arrays, returning a Dataset.
11801180
1181-
See also
1181+
See Also
11821182
--------
11831183
DataArray.as_numpy
11841184
DataArray.to_numpy : Returns only the data as a numpy.ndarray object.
@@ -1688,8 +1688,8 @@ def identical(self, other: Self) -> bool:
16881688
"""Like equals, but also checks all dataset attributes, the
16891689
attributes on all variables and coordinates, and indexes.
16901690
1691-
Example
1692-
-------
1691+
Examples
1692+
--------
16931693
16941694
>>> a = xr.Dataset(
16951695
... {"Width": ("X", [1, 2, 3])},
@@ -6558,7 +6558,7 @@ def interpolate_na(
65586558
interpolated: Dataset
65596559
Filled in Dataset.
65606560
6561-
Warning
6561+
Warnings
65626562
--------
65636563
When passing fill_value as a keyword argument with method="linear", it does not use
65646564
``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:
76017601
-------
76027602
obj : Dataset
76037603
7604-
See also
7604+
See Also
76057605
--------
76067606
Dataset.to_dict
76077607
DataArray.from_dict
@@ -8398,7 +8398,7 @@ def differentiate(
83988398
-------
83998399
differentiated: Dataset
84008400
8401-
See also
8401+
See Also
84028402
--------
84038403
numpy.gradient: corresponding numpy function
84048404
"""
@@ -8464,7 +8464,7 @@ def integrate(
84648464
-------
84658465
integrated : Dataset
84668466
8467-
See also
8467+
See Also
84688468
--------
84698469
DataArray.integrate
84708470
numpy.trapz : corresponding numpy function
@@ -8585,7 +8585,7 @@ def cumulative_integrate(
85858585
-------
85868586
integrated : Dataset
85878587
8588-
See also
8588+
See Also
85898589
--------
85908590
DataArray.cumulative_integrate
85918591
scipy.integrate.cumulative_trapezoid : corresponding scipy function
@@ -9592,8 +9592,8 @@ def eval(
95929592
result : Dataset or DataArray, depending on whether ``statement`` contains an
95939593
assignment.
95949594
9595-
Warning
9596-
-------
9595+
Warnings
9596+
--------
95979597
Like ``pd.eval()``, this method should not be used with untrusted input.
95989598
95999599
Examples
@@ -9933,7 +9933,7 @@ def convert_calendar(
99339933
time part of the timestamps.
99349934
99359935
Parameters
9936-
---------
9936+
----------
99379937
calendar : str
99389938
The target calendar name.
99399939
dim : Hashable, default: "time"
@@ -10054,8 +10054,8 @@ def interp_calendar(
1005410054
dim : Hashable, default: "time"
1005510055
The time coordinate name.
1005610056
10057-
Return
10058-
------
10057+
Returns
10058+
-------
1005910059
DataArray
1006010060
The source interpolated on the decimal years of target,
1006110061
"""

xarray/core/datatree.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ def from_dict(
12371237
-------
12381238
DataTree
12391239
1240-
See also
1240+
See Also
12411241
--------
12421242
Dataset
12431243
@@ -1428,7 +1428,7 @@ def to_dict(self, relative: bool = False) -> dict[str, Dataset]:
14281428
-------
14291429
dict[str, Dataset]
14301430
1431-
See also
1431+
See Also
14321432
--------
14331433
DataTree.subtree_with_keys
14341434
"""
@@ -1805,7 +1805,7 @@ def map_over_datasets(
18051805
subtrees : DataTree, tuple of DataTrees
18061806
One or more subtrees containing results from applying ``func`` to the data at each node.
18071807
1808-
See also
1808+
See Also
18091809
--------
18101810
map_over_datasets
18111811
"""
@@ -2052,8 +2052,8 @@ def to_netcdf(
20522052
* ``dask.delayed.Delayed`` if compute is False
20532053
* ``None`` otherwise
20542054
2055-
Note
2056-
----
2055+
Notes
2056+
-----
20572057
Due to file format specifications the on-disk root group name
20582058
is always ``"/"`` overriding any given ``DataTree`` root node name.
20592059
"""
@@ -2147,8 +2147,8 @@ def to_zarr(
21472147
kwargs :
21482148
Additional keyword arguments to be passed to ``xarray.Dataset.to_zarr``
21492149
2150-
Note
2151-
----
2150+
Notes
2151+
-----
21522152
Due to file format specifications the on-disk root group name
21532153
is always ``"/"`` overriding any given ``DataTree`` root node name.
21542154
"""

xarray/core/datatree_mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def map_over_datasets(
8686
Result of applying `func` to each node in the provided trees, packed back
8787
into DataTree objects via `DataTree.from_dict`.
8888
89-
See also
89+
See Also
9090
--------
9191
DataTree.map_over_datasets
9292
group_subtrees

xarray/core/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def get_options():
385385
Get options for xarray.
386386
387387
See Also
388-
----------
388+
--------
389389
set_options
390390
391391
"""

xarray/core/treenode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ def group_subtrees(
830830
TreeIsomorphismError
831831
If trees are not isomorphic, i.e., they have different structures.
832832
833-
See also
833+
See Also
834834
--------
835835
DataTree.subtree
836836
DataTree.subtree_with_keys

xarray/core/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def did_you_mean(
162162
>>> did_you_mean("none", ("blech", "gray_r", 1, None, (2, 56)))
163163
'Did you mean one of (None,)?'
164164
165-
See also
165+
See Also
166166
--------
167167
https://en.wikipedia.org/wiki/String_metric
168168
"""

0 commit comments

Comments
 (0)