You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You could dig through the original PRs to be sure, but I think we mostly picked join='exact' out of an abundance of caution. In principle I think it would be reasonable to change it, there is a pretty good case that (d1 * d2).sum() and d1 @ d2 should be consistent.
I started with a PR using join = OPTIONS["arithmetic_join"] but then I realized that dot does not support skipna. Thus join="left"join="right", and join="outer" returns NaN for nonequal coords, which I think defeats the purpose. I can
Use OPTIONS["arithmetic_join"] anyway
Only support join="inner" (i.e. hard-code it in the call to apply_ufunc)
try to implement skipna for dot (in a separate PR)
Other?
(3) is certainly the largest change but may be as easy as da.fillna(0.). Thoughts?
Activity
[-]xr.dot requires equal dimensions[/-][+]xr.dot requires equal indexes (join="exact")[/+]fujiisoup commentedon Jan 14, 2020
I have no strong opinion, but if most of the arithmetic in xarray uses
join='inner', then it would be nicer to do so here too.shoyer commentedon Jan 15, 2020
You could dig through the original PRs to be sure, but I think we mostly picked
join='exact'out of an abundance of caution. In principle I think it would be reasonable to change it, there is a pretty good case that(d1 * d2).sum()andd1 @ d2should be consistent.mathause commentedon Jan 16, 2020
I started with a PR using
join = OPTIONS["arithmetic_join"]but then I realized thatdotdoes not supportskipna. Thusjoin="left"join="right", andjoin="outer"returnsNaNfor nonequal coords, which I think defeats the purpose. I canOPTIONS["arithmetic_join"]anywayjoin="inner"(i.e. hard-code it in the call toapply_ufunc)skipnafordot(in a separate PR)(3) is certainly the largest change but may be as easy as
da.fillna(0.). Thoughts?I use this at:
xarray/xarray/core/weighted.py
Lines 142 to 149 in 3cc00c1
mathause commentedon Jan 16, 2020
On second thought, even with implemented
skipnathe result will not differ betweenjoin="inner",join="left"join="right", andjoin="outer"; i.e.:So I guess (2) is fine.
mathause commentedon Jan 16, 2020
Sorry for the noise, I do live thinking...
However, if I do (2) there is a different behavior for
(d1 * d2).sum()andd1 @ d2in one case:So?