[Git][debian-gis-team/flox][upstream] New upstream version 0.11.1
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sat Feb 14 10:05:52 GMT 2026
Antonio Valentino pushed to branch upstream at Debian GIS Project / flox
Commits:
21938a12 by Antonio Valentino at 2026-02-14T09:40:21+00:00
New upstream version 0.11.1
- - - - -
2 changed files:
- flox/xarray.py
- tests/test_core.py
Changes:
=====================================
flox/xarray.py
=====================================
@@ -20,6 +20,12 @@ from .rechunk import rechunk_for_blockwise as rechunk_array_for_blockwise
from .rechunk import rechunk_for_cohorts as rechunk_array_for_cohorts
from .reindex import ReindexStrategy
+try:
+ from xarray.indexes import PandasMultiIndex
+except ImportError:
+ PandasMultiIndex = tuple() # type: ignore[misc,assignment,unused-ignore]
+
+
if TYPE_CHECKING:
from xarray.core.types import T_DataArray, T_Dataset
@@ -238,7 +244,7 @@ def xarray_reduce(
unindexed_dims = tuple(
b
for b, isbin_ in zip(by, isbins)
- if isinstance(b, Hashable) and not isbin_ and b in obj.dims and b not in obj.indexes
+ if isinstance(b, Hashable) and not isbin_ and b in obj.dims and b not in obj.xindexes
)
by_da = tuple(obj[g] if isinstance(g, Hashable) else g for g in by)
@@ -253,12 +259,6 @@ def xarray_reduce(
ds = cast(xr.Dataset, obj)
else:
ds = obj._to_temp_dataset()
-
- try:
- from xarray.indexes import PandasMultiIndex
- except ImportError:
- PandasMultiIndex = tuple() # type: ignore[misc,assignment,unused-ignore]
-
more_drop = set()
for var in maybe_drop:
maybe_midx = ds._indexes.get(var, None)
@@ -467,12 +467,9 @@ def xarray_reduce(
actual = actual.drop_vars(name)
# When grouping by MultiIndex, expect is an pd.Index wrapping
# an object array of tuples
- if (
- name in ds_broad.indexes
- and isinstance(ds_broad.indexes[name], pd.MultiIndex)
- and not isinstance(expect3, pd.RangeIndex)
- ):
- levelnames = ds_broad.indexes[name].names
+ xindex = ds_broad.xindexes.get(name)
+ if isinstance(xindex, PandasMultiIndex) and not isinstance(expect3, pd.RangeIndex):
+ levelnames = xindex.index.names
if isinstance(expect3, np.ndarray):
# TODO: workaround for IntervalIndex issue.
raise NotImplementedError
=====================================
tests/test_core.py
=====================================
@@ -2136,7 +2136,7 @@ def test_blockwise_avoid_rechunk() -> None:
array = dask.array.zeros((6,), chunks=(2, 4), dtype=np.int64)
by = np.array(["1", "1", "0", "", "0", ""], dtype="<U1")
actual, *groups = groupby_reduce(array, by, func="first")
- assert_equal(groups, [["", "0", "1"]])
+ assert_equal(groups, np.asarray([["", "0", "1"]], dtype="<U1"))
assert_equal(actual, np.array([0, 0, 0], dtype=np.int64))
View it on GitLab: https://salsa.debian.org/debian-gis-team/flox/-/commit/21938a126848fedaa0145078de7667ee0628c2e6
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/flox/-/commit/21938a126848fedaa0145078de7667ee0628c2e6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20260214/d42847c9/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list