File tree 3 files changed +63
-0
lines changed
3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change @@ -589,6 +589,10 @@ Internal Changes
589
589
590
590
- :py:func: `as_variable ` now consistently includes the variable name in any exceptions
591
591
raised. (:pull: `7995 `). By `Peter Hill <https://github.com/ZedThree >`_
592
+ - Redirect cumulative reduction functions internally through the :py:class: `ChunkManagerEntryPoint `,
593
+ potentially allowing :py:meth: `~xarray.DataArray.ffill ` and :py:meth: `~xarray.DataArray.bfill ` to
594
+ use non-dask chunked array types.
595
+ (:pull: `8019 `) By `Tom Nicholas <https://github.com/TomNicholas >`_.
592
596
- :py:func: `encode_dataset_coordinates ` now sorts coordinates automatically assigned to
593
597
`coordinates ` attributes during serialization (:issue: `8026 `, :pull: `8034 `).
594
598
`By Ian Carroll <https://github.com/itcarroll >`_.
Original file line number Diff line number Diff line change @@ -97,6 +97,28 @@ def reduction(
97
97
keepdims = keepdims ,
98
98
)
99
99
100
+ def scan (
101
+ self ,
102
+ func : Callable ,
103
+ binop : Callable ,
104
+ ident : float ,
105
+ arr : T_ChunkedArray ,
106
+ axis : int | None = None ,
107
+ dtype : np .dtype | None = None ,
108
+ ** kwargs ,
109
+ ) -> DaskArray :
110
+ from dask .array .reductions import cumreduction
111
+
112
+ return cumreduction (
113
+ func ,
114
+ binop ,
115
+ ident ,
116
+ arr ,
117
+ axis = axis ,
118
+ dtype = dtype ,
119
+ ** kwargs ,
120
+ )
121
+
100
122
def apply_gufunc (
101
123
self ,
102
124
func : Callable ,
Original file line number Diff line number Diff line change @@ -403,6 +403,43 @@ def reduction(
403
403
"""
404
404
raise NotImplementedError ()
405
405
406
+ def scan (
407
+ self ,
408
+ func : Callable ,
409
+ binop : Callable ,
410
+ ident : float ,
411
+ arr : T_ChunkedArray ,
412
+ axis : int | None = None ,
413
+ dtype : np .dtype | None = None ,
414
+ ** kwargs ,
415
+ ) -> T_ChunkedArray :
416
+ """
417
+ General version of a 1D scan, also known as a cumulative array reduction.
418
+
419
+ Used in ``ffill`` and ``bfill`` in xarray.
420
+
421
+ Parameters
422
+ ----------
423
+ func: callable
424
+ Cumulative function like np.cumsum or np.cumprod
425
+ binop: callable
426
+ Associated binary operator like ``np.cumsum->add`` or ``np.cumprod->mul``
427
+ ident: Number
428
+ Associated identity like ``np.cumsum->0`` or ``np.cumprod->1``
429
+ arr: dask Array
430
+ axis: int, optional
431
+ dtype: dtype
432
+
433
+ Returns
434
+ -------
435
+ Chunked array
436
+
437
+ See also
438
+ --------
439
+ dask.array.cumreduction
440
+ """
441
+ raise NotImplementedError ()
442
+
406
443
@abstractmethod
407
444
def apply_gufunc (
408
445
self ,
You can’t perform that action at this time.
0 commit comments