Skip to content

Commit 6d84b83

Browse files
committed
Fix z-score dimension handling
1 parent 7b71866 commit 6d84b83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

code/climate_cube_math/stats/anomalies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def zscore_over_time(
1818
eps = STD_EPS if std_eps is None else std_eps
1919
mean = da.mean(dim=dim, skipna=True)
2020
std = da.std(dim=dim, skipna=True)
21-
valid_std = std > eps
21+
valid_std = (std > eps).broadcast_like(da)
2222
z = xr.where(valid_std, (da - mean) / std, np.nan)
2323
# Keep the original dimension ordering so callers don't have to
2424
# defensively transpose results. xarray broadcasting can sometimes

0 commit comments

Comments
 (0)