File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -56,15 +56,25 @@ function duration_estimate(feedback::Feedback,S::ModelSetup)
56
56
end
57
57
end
58
58
59
+ """ Returns the number of NaNs in an array."""
60
+ function countnans (A:: AbstractArray )
61
+ n_nan = 0
62
+ for a in A
63
+ n_nan += isnan (a) ? 1 : 0
64
+ end
65
+ return n_nan
66
+ end
67
+
59
68
""" Returns a boolean whether the prognostic variables contains a NaN."""
60
69
function nan_detection! (Prog:: PrognosticVars ,feedback:: Feedback )
61
70
62
- # TODO include a check for Posits
63
- # TODO include check for sst
64
-
65
71
@unpack u,v,η,sst = Prog
66
72
67
- n_nan = sum (isnan .(u)) + sum (isnan .(v)) + sum (isnan .(η)) + sum (isnan .(sst))
73
+ n_nan = countnans (u)
74
+ n_nan += countnans (v)
75
+ n_nan += countnans (η)
76
+ n_nan += countnans (sst)
77
+
68
78
if n_nan > 0
69
79
feedback. nans_detected = true
70
80
end
You can’t perform that action at this time.
0 commit comments