Skip to content

Commit a04ed82

Browse files
committed
Small changes
1 parent 816e794 commit a04ed82

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

xarray/util/generate_reductions.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def {method}(
7575
See Also
7676
--------
7777
numpy.{method}
78+
dask.array.{method}
7879
{obj}.{method}
7980
:ref:`{docref}`
8081
User guide on {docref_description}.
@@ -108,7 +109,8 @@ def {method}(
108109

109110
_KWARGS_DOCSTRING = """**kwargs : dict
110111
Additional keyword arguments passed on to the appropriate array
111-
function for calculating ``{method}`` on this object's data."""
112+
function for calculating ``{method}`` on this object's data.
113+
These could include dask-specific kwargs like ``split_every``."""
112114

113115
NAN_CUM_METHODS = ["cumsum", "cumprod"]
114116

@@ -118,7 +120,7 @@ def {method}(
118120
]
119121

120122
extra_kwarg = collections.namedtuple("extra_kwarg", "docs kwarg call example")
121-
skip_na = extra_kwarg(
123+
skipna = extra_kwarg(
122124
docs=_SKIPNA_DOCSTRING,
123125
kwarg="skipna: bool = None,",
124126
call="skipna=skipna,",
@@ -271,18 +273,18 @@ def generate_code(self, method):
271273
)"""
272274

273275

274-
METHODS = (
276+
REDUCTION_METHODS = (
275277
Method("count"),
276278
Method("all", bool_reduce=True),
277279
Method("any", bool_reduce=True),
278-
Method("max", extra_kwargs=(skip_na,)),
279-
Method("min", extra_kwargs=(skip_na,)),
280-
Method("mean", extra_kwargs=(skip_na,), numeric_only=True),
281-
Method("prod", extra_kwargs=(skip_na, min_count), numeric_only=True),
282-
Method("sum", extra_kwargs=(skip_na, min_count), numeric_only=True),
283-
Method("std", extra_kwargs=(skip_na, ddof), numeric_only=True),
284-
Method("var", extra_kwargs=(skip_na, ddof), numeric_only=True),
285-
Method("median", extra_kwargs=(skip_na,), numeric_only=True),
280+
Method("max", extra_kwargs=(skipna,)),
281+
Method("min", extra_kwargs=(skipna,)),
282+
Method("mean", extra_kwargs=(skipna,), numeric_only=True),
283+
Method("prod", extra_kwargs=(skipna, min_count), numeric_only=True),
284+
Method("sum", extra_kwargs=(skipna, min_count), numeric_only=True),
285+
Method("std", extra_kwargs=(skipna, ddof), numeric_only=True),
286+
Method("var", extra_kwargs=(skipna, ddof), numeric_only=True),
287+
Method("median", extra_kwargs=(skipna,), numeric_only=True),
286288
)
287289

288290

@@ -313,15 +315,15 @@ class DataStructure:
313315
DatasetGenerator = ClassReductionGenerator(
314316
cls="",
315317
datastructure=DatasetObject,
316-
methods=METHODS,
318+
methods=REDUCTION_METHODS,
317319
docref="agg",
318320
docref_description="reduction or aggregation operations",
319321
example_call_preamble="",
320322
)
321323
DataArrayGenerator = ClassReductionGenerator(
322324
cls="",
323325
datastructure=DataArrayObject,
324-
methods=METHODS,
326+
methods=REDUCTION_METHODS,
325327
docref="agg",
326328
docref_description="reduction or aggregation operations",
327329
example_call_preamble="",
@@ -330,31 +332,31 @@ class DataStructure:
330332
DataArrayGroupByGenerator = ClassReductionGenerator(
331333
cls="GroupBy",
332334
datastructure=DataArrayObject,
333-
methods=METHODS,
335+
methods=REDUCTION_METHODS,
334336
docref="groupby",
335337
docref_description="groupby operations",
336338
example_call_preamble='.groupby("labels")',
337339
)
338340
DataArrayResampleGenerator = ClassReductionGenerator(
339341
cls="Resample",
340342
datastructure=DataArrayObject,
341-
methods=METHODS,
343+
methods=REDUCTION_METHODS,
342344
docref="resampling",
343345
docref_description="resampling operations",
344346
example_call_preamble='.resample(time="3M")',
345347
)
346348
DatasetGroupByGenerator = ClassReductionGenerator(
347349
cls="GroupBy",
348350
datastructure=DatasetObject,
349-
methods=METHODS,
351+
methods=REDUCTION_METHODS,
350352
docref="groupby",
351353
docref_description="groupby operations",
352354
example_call_preamble='.groupby("labels")',
353355
)
354356
DatasetResampleGenerator = ClassReductionGenerator(
355357
cls="Resample",
356358
datastructure=DatasetObject,
357-
methods=METHODS,
359+
methods=REDUCTION_METHODS,
358360
docref="resampling",
359361
docref_description="resampling operations",
360362
example_call_preamble='.resample(time="3M")',

0 commit comments

Comments
 (0)