Hooks for XArray operations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Start by reviewing how XArray currently dispatches operations, then determine where a type-based hook registry and NumPy fallback would fit; done would mean optional dask and sparse implementations can register operations and receive the appropriate primary argument type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100