-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Is your feature request related to a problem? Please describe.
Right now there's no efficient way to do a dot product that skips over nan elements.
Describe the solution you'd like
I want to be able to treat the summation in dot as a nansum, controlled by a skipna option. Either this can be implemented directly, or an additional ufunc can be added: xarray.unfuncs.nan_to_num that can be called on the inputs to dot. Unfortunately using numpy's nan_to_num will initiate eager execution.
Describe alternatives you've considered
It's possible to implement this by hand, but it ends up being extremely inefficient in one of my use-cases:
(x*y).sum('dot_prod_dim', skipna=True)takes 30 secondsx.dot(y)takes 1 second