Check if we can implement NEP18
Closed this issue · 3 comments
See https://discourse.pangeo.io/t/wrapped-for-dask-teos-10-gibbs-seawater-gsw-oceanographic-toolbox/466/2 for the discussion and https://numpy.org/neps/nep-0018-array-function-protocol.html for the NEP.
@efiring, if you think this is beyond the scope here feel free to just close it and we can work on a wrapper around gsw
instead.
NEP 18 is mind-bending, but I get the impression that for most GSW functions, it could be implemented by using a different decorator. We already use the match_args_return
decorator to handle masked arrays. I get the impression that for functions like those in GSW, NEP 18 can also be implemented via a decorator. It seems like it is supposed to enable exactly the sort of thing we do in match_args_return
; it lists np.ma
in the set of example subclasses that could be supported.
My understanding of NEP 18 is extremely fuzzy, though, so I think we would need considerable help from one of the wizards. If a wizard is interested in putting in the time, I'm willing to consider it. I'm a little worried that it opens a can of worms; how much complexity does it add, both to the code (including the code-generation machinery) and to the testing?
@rabernat, would you like to elaborate on what the changes to GSW-Python would look like?