Skip to content

Using apply_ufunc with dask='allowed' for a function with xarray operations #6796

Answered by alessioarena
tlsw231 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, if you are applying an xarray operation you should not need to apply it using apply_ufunc. You can assume that all xarray operations will work with dask.
In that specific case:

dummy.rolling(time=2).mean().groupby('time.year').max()

Should work fine.

The only change you should make to have that being a dask operation is declaring your dataset as

import dask.array as da
dummy = xr.DataArray(da.random.random([nt,ny,nx]),dims=['time','y','x'],
                    coords=[times,range(ny),range(nx)] )

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dcherian
Comment options

Answer selected by dcherian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants