-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
When I try passing a dtype
to xarray_reduce, the output is still uint64
for some reason:
import xarray as xr
from flox.xarray import xarray_reduce
ds = xr.Dataset(
{
"counts": ("time", np.array([0,2,1,0,1])),
"group": ("time", np.array([1,1,1,2,2]))
},
)
xarray_reduce(ds["counts"],
ds["group"],
expected_groups=(np.array([1,2]),),
func="sum",
dtype="uint8")
<xarray.DataArray 'counts' (group: 2)> Size: 16B
array([3, 1], dtype=uint64)
Coordinates:
* group (group) int64 16B 1 2
This happens whether I use "uint8"
as a string or np.uint8
.
Of course, I can just use .astype
after the fact, but I expect this is an allowed parameter for some reason or another?
Python 3.12.5
flox 0.9.10
xarray 2024.7.0
Metadata
Metadata
Assignees
Labels
No labels