Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mention map_blocks in the docstring of apply_ufunc #5011

Merged
merged 4 commits into from
Mar 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
keewis marked this conversation as resolved.
Show resolved Hide resolved
dask.array.apply_gufunc
xarray.map_blocks

References
----------
Expand Down