Skip to content
forked from pydata/xarray

Commit

Permalink
preserve attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Sep 19, 2024
1 parent 17b7f2f commit 339ed3a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xarray/groupers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def _factorize_given_labels(self, group: T_Group) -> EncodedGroups:
kwargs={"labels": self.labels},
dask="parallelized",
output_dtypes=[np.int64],
keep_attrs=True,
)
return EncodedGroups(
codes=codes,
Expand Down Expand Up @@ -350,7 +351,7 @@ def _wrapper(data, **kwargs):
self.bins = bins
return binned.codes.reshape(data.shape)

return apply_ufunc(_wrapper, group, dask="parallelized")
return apply_ufunc(_wrapper, group, dask="parallelized", keep_attrs=True)

def factorize(self, group: T_Group) -> EncodedGroups:
if isinstance(group, _DummyGroup):
Expand Down

0 comments on commit 339ed3a

Please sign in to comment.