File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 2121from ..logger import get_logger
2222
2323
24+ def _std (x : da .Array ) -> da .Array :
25+ """Returns the standard deviation."""
26+ return da .where (
27+ da .count_nonzero (da .isfinite (x ), axis = 0 ) > 0 ,
28+ da .nanstd (x , axis = 0 ),
29+ np .nan ,
30+ )
31+
32+
2433class CollectOp (Operator ):
2534 """The collect operator."""
2635
@@ -56,7 +65,7 @@ def run(self, source: Dataset) -> Dataset: # noqa: D102
5665 if v_unc in target :
5766 continue
5867 get_logger ().info (f"starting graph for variable: { v_unc } " )
59- x_unc = da . nanstd (decode (subset [v ].data , x .attrs ), axis = 0 )
68+ x_unc = _std (decode (subset [v ].data , x .attrs ))
6069 get_logger ().info (f"finished graph for variable: { v_unc } " )
6170 target [v_unc ] = DataArray (
6271 data = encode (x_unc , x .attrs , x .dtype ),
You can’t perform that action at this time.
0 commit comments