Skip to content

Commit 36811ac

Browse files
committed
xarray 2023 compatibility
1 parent 820e3c2 commit 36811ac

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

bioimageio/core/stat_calculators.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ def compute(
139139
else:
140140
n = int(np.prod([tensor.sizes[d] for d in self._axes]))
141141

142+
if xr.__version__.startswith("2023"):
143+
var = xr.dot(c, c, dims=self._axes) / n
144+
else:
145+
var = xr.dot(c, c, dim=self._axes) / n
146+
142147
var = xr.dot(c, c, dim=self._axes) / n
143148
assert isinstance(var, xr.DataArray)
144149
std = np.sqrt(var)

dev/env-py38.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ dependencies:
3939
- torchvision
4040
- tqdm
4141
- typing-extensions
42-
- xarray>=2024.01,<2025.3.0
42+
- xarray>=2023.01,<2025.3.0
4343
- pip:
4444
- -e ..

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"ruyaml",
4343
"tqdm",
4444
"typing-extensions",
45-
"xarray>=2024.01,<2025.3.0",
45+
"xarray>=2023.01,<2025.3.0",
4646
],
4747
include_package_data=True,
4848
extras_require={

0 commit comments

Comments
 (0)