Open
Description
In hope of cleaner dask and sparse support (pydata/sparse#1), I wanted to suggest hooks for XArray operations.
Something like the following:
try:
import dask.array as da
xarray.hooks.register('nansum', da.array, da.nansum)
...
except ImportError:
pass
try:
import sparse.SparseArray
xarray.hooks.register('nansum', sparse.SparseArray, sparse.nansum)
...
except ImportError:
pass
Functions would work something like the following:
(the register would fall back to Numpy if nothing is found)
- Check type of first/primary argument.
- Check register for function.
- Call function
I would argue that this should be in Numpy, but it's a huge project to put it there.