Skip to content

Commit

Permalink
mention map_blocks in the docstring of apply_ufunc (#5011)
Browse files Browse the repository at this point in the history
Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>
  • Loading branch information
keewis and dcherian authored Mar 10, 2021
1 parent 50d97e9 commit da0adc3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions xarray/core/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,14 @@ def apply_ufunc(
Single value or tuple of Dataset, DataArray, Variable, dask.array.Array or
numpy.ndarray, the first type on that list to appear on an input.
Notes
-----
This function is designed for the more common case where ``func`` can work on numpy
arrays. If ``func`` needs to manipulate a whole xarray object subset to each block
it is possible to use :py:func:`xarray.map_blocks`.
Note that due to the overhead ``map_blocks`` is considerably slower than ``apply_ufunc``.
Examples
--------
Calculate the vector magnitude of two arguments:
Expand Down Expand Up @@ -1015,6 +1023,8 @@ def earth_mover_distance(first_samples,
numpy.broadcast_arrays
numba.vectorize
numba.guvectorize
dask.array.apply_gufunc
xarray.map_blocks
References
----------
Expand Down

0 comments on commit da0adc3

Please sign in to comment.