Open chandley564 opened 8 months ago
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! If you have an idea for a solution, we would really welcome a Pull Request with proposed changes. See the Contributing Guide for more. It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better. Thank you!
FWIW this seems to be correct under numbagg or bottleneck; so it's an issue with the naive xarray routines. We could just raise an error there.
Expected:
<xarray.DataArray (x: 6)> Size: 48B
array([ nan, 0.66666667, 0.66666667, 0.66666667, 0.33333333,
nan])
Dimensions without coordinates: x
With int dtype:
<xarray.DataArray (x: 6)> Size: 48B
array([ nan, 0.66666667, 0.66666667, 0.66666667, 0.33333333,
nan])
Dimensions without coordinates: x
With bool dtype:
<xarray.DataArray (x: 6)> Size: 48B
array([ nan, 0.66666667, 0.66666667, 0.66666667, 0.33333333,
nan])
Dimensions without coordinates: x
Rolling sum:
<xarray.DataArray (x: 6)> Size: 48B
array([nan, 2., 2., 2., 1., nan])
Dimensions without coordinates: x
What happened?
Taking a rolling mean of a DataArray with dytpe=bool doesn't behave as I would expect. Rather than converting to int and taking the rolling mean the result is equivilent to converting to int then taking a rolling sum.
What did you expect to happen?
No response
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
No response
Environment