@@ -80,7 +80,7 @@ def xarray_reduce(
80
80
reindex : bool | None = None ,
81
81
** finalize_kwargs ,
82
82
):
83
- """GroupBy reduce operations on xarray objects using numpy-groupies
83
+ """GroupBy reduce operations on xarray objects using numpy-groupies.
84
84
85
85
Parameters
86
86
----------
@@ -105,26 +105,27 @@ def xarray_reduce(
105
105
dim : hashable
106
106
dimension name along which to reduce. If None, reduces across all
107
107
dimensions of `by`
108
- fill_value
108
+ fill_value : Any
109
109
Value used for missing groups in the output i.e. when one of the labels
110
110
in ``expected_groups`` is not actually present in ``by``.
111
111
dtype : data-type, optional
112
- DType for the output. Can be anything accepted by ``np.dtype``.
112
+ DType for the output. Can be anything that is accepted by ``np.dtype``.
113
113
method : {"map-reduce", "blockwise", "cohorts"}, optional
114
+ Note that this arg is chosen by default using heuristics.
114
115
Strategy for reduction of dask arrays only:
115
116
* ``"map-reduce"``:
116
117
First apply the reduction blockwise on ``array``, then
117
118
combine a few newighbouring blocks, apply the reduction.
118
119
Continue until finalizing. Usually, ``func`` will need
119
- to be an Aggregation instance for this method to work.
120
+ to be an `` Aggregation`` instance for this method to work.
120
121
Common aggregations are implemented.
121
122
* ``"blockwise"``:
122
123
Only reduce using blockwise and avoid aggregating blocks
123
124
together. Useful for resampling-style reductions where group
124
- members are always together. If `by` is 1D, `array` is automatically
125
+ members are always together. If `` by`` is 1D, `` array` ` is automatically
125
126
rechunked so that chunk boundaries line up with group boundaries
126
127
i.e. each block contains all members of any group present
127
- in that block. For nD `by `, you must make sure that all members of a group
128
+ in that block. For nD ``by` `, you must make sure that all members of a group
128
129
are present in a single block.
129
130
* ``"cohorts"``:
130
131
Finds group labels that tend to occur together ("cohorts"),
@@ -134,11 +135,11 @@ def xarray_reduce(
134
135
'month', dayofyear' etc. Optimize chunking ``array`` for this
135
136
method by first rechunking using ``rechunk_for_cohorts``
136
137
(for 1D ``by`` only).
137
- engine : {"flox", "numpy", "numba"}, optional
138
+ engine : {"flox", "numpy", "numba", "numbagg" }, optional
138
139
Algorithm to compute the groupby reduction on non-dask arrays and on each dask chunk:
139
140
* ``"numpy"``:
140
141
Use the vectorized implementations in ``numpy_groupies.aggregate_numpy``.
141
- This is the default choice because it works for other array types.
142
+ This is the default choice because it works for most array types.
142
143
* ``"flox"``:
143
144
Use an internal implementation where the data is sorted so that
144
145
all members of a group occur sequentially, and then numpy.ufunc.reduceat
@@ -162,13 +163,13 @@ def xarray_reduce(
162
163
NA. Only used if skipna is set to True or defaults to True for the
163
164
array's dtype.
164
165
reindex : bool, optional
165
- Whether to "reindex" the blockwise results to `expected_groups` (possibly automatically detected).
166
+ Whether to "reindex" the blockwise results to `` expected_groups` ` (possibly automatically detected).
166
167
If True, the intermediate result of the blockwise groupby-reduction has a value for all expected groups,
167
168
and the final result is a simple reduction of those intermediates. In nearly all cases, this is a significant
168
169
boost in computation speed. For cases like time grouping, this may result in large intermediates relative to the
169
- original block size. Avoid that by using method="cohorts". By default, it is turned off for arg reductions .
170
- **finalize_kwargs
171
- kwargs passed to the finalize function, like ``ddof`` for var, std or ``q`` for quantile.
170
+ original block size. Avoid that by using `` method="cohorts"`` . By default, it is turned off for argreductions .
171
+ **finalize_kwargs : dict, optional
172
+ Kwargs passed to finalize the reduction such as ``ddof`` for var, std or ``q`` for quantile.
172
173
173
174
Returns
174
175
-------
0 commit comments