@@ -147,9 +147,9 @@ def make_broadcastable( # noqa: C901
147
147
Returns
148
148
-------
149
149
Decorator
150
- Decorator function that can be applied with the usual ``@decorator``
151
- syntax. See Notes for a description of the action of the returned
152
- decorator.
150
+ Decorator function that can be applied with the
151
+ ``@make_broadcastable(...)`` syntax. See Notes for a description of
152
+ the action of the returned decorator.
153
153
154
154
Notes
155
155
-----
@@ -158,9 +158,10 @@ def make_broadcastable( # noqa: C901
158
158
axes of an input ``xarray.xr.DataArray``.
159
159
160
160
The ``r_decorator`` takes a single parameter, ``f``. ``f`` should be a
161
- ``Callable`` that acts on 1D data , that is to be converted into a
161
+ ``Callable`` that acts on 1D inputs , that is to be converted into a
162
162
broadcast-able function ``fr``, applying the action of ``f`` along an axis
163
- of an ``xarray.xr.DataArray``.
163
+ of an ``xarray.xr.DataArray``. ``f`` should return either scalar or 1D
164
+ outputs.
164
165
165
166
If ``f`` is a class method, it should be callable as
166
167
``f(self, [x, y, ...], \*args, \*\*kwargs)``.
@@ -175,6 +176,9 @@ def make_broadcastable( # noqa: C901
175
176
The ``\*args`` and ``\*\*kwargs`` match those passed to ``f``, and retain
176
177
the same interpretations and effects on the result.
177
178
179
+ See the docstring of ``make_broadcastable_inner`` in the source code for a
180
+ more explicit explanation of the returned decorator.
181
+
178
182
See Also
179
183
--------
180
184
broadcastable_method : Convenience alias for ``is_classmethod = True``.
@@ -218,24 +222,26 @@ def make_broadcastable( # noqa: C901
218
222
def make_broadcastable_inner (
219
223
f : DecoratorInput ,
220
224
) -> FunctionDaToDa :
221
- """Broadcast a 1D function along a ``xr.DataArray`` dimension.
225
+ r """Broadcast a 1D function along a ``xr.DataArray`` dimension.
222
226
223
227
Parameters
224
228
----------
225
229
f : Callable
226
230
1D function to be converted into a broadcast-able function,, that
227
- returns a scalar value. If ``f`` is a class method, it should be
228
- callable as ``f(self, [x, y, ...], *args, **kwargs)``. Otherwise,
229
- ``f`` should be callable as ``f([x, y, ...], *args, **kwargs).
231
+ returns either a scalar value or 1D output. If ``f`` is a class
232
+ method, it should be callable as
233
+ ``f(self, [x, y, ...], *args, **kwargs)``.
234
+ Otherwise, ``f`` should be callable as
235
+ ``f([x, y, ...], *args, **kwargs).
230
236
231
237
Returns
232
238
-------
233
239
Callable
234
240
Callable with signature
235
241
``(self,) data, *args, broadcast_dimension = str, **kwargs``,
236
242
that applies ``f`` along the ``broadcast_dimension`` of ``data``.
237
- ``args`` and ``kwargs`` match those passed to ``f``, and retain the
238
- same interpretations.
243
+ ``\* args`` and ``\*\* kwargs`` match those passed to ``f``, and
244
+ retain the same interpretations.
239
245
240
246
Notes
241
247
-----
0 commit comments