Possible bug(?) in xarray.groupby('time.month') operations

Thanks for these efforts @jemmajeffree et al.

FYI for all - if you want a good, basic overview of Xarray’s “groupby” from Deepak spend 37 minutes on this > https://youtu.be/92-QU37W9WI?si=a1XgLxqsjygjPyfu

I think this needs to be posted at xarray repo?

I admit I don’t know what flox is… But the example above with groupby giving NaNs seems very counter-intuitive to me (as did the initial post by @hrsdawson)!!

edit: I actually missed reading the “I’m planning on raising the bug with the xarray…” bit by @jemmajeffree; nice!

Well if indeed somehow groupby results in the computations following it being done at float32 instead of float64 that might explain things! For datasets where the variation is close to the float32 presicion then adding/subtracting/etc gives nonsense (including variances that are negative) and thus NaN when sqrt is taken.