diff --git a/modules/util/util.py b/modules/util/util.py
index 788400ab765dd417734f724484225192aef8f8bb..046b2166c36143edddcf8eb3fb5e047e1d6589dd 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -861,7 +861,8 @@ def write_icing_file_nc4(clvrx_str_time, output_dir, preds_dct, probs_dct,
 
     prob_s = np.where(prob_s < prob_thresh, -1.0, prob_s)
     max_lvl = np.where(np.all(prob_s == -1, axis=2), -1, np.argmax(prob_s, axis=2))
-    # max_lvl = np.argmax(prob_s, axis=2)
+    if use_nan:
+        max_lvl = np.where(max_lvl == -1, np.nan, max_lvl)
     if has_time:
         max_lvl = max_lvl.reshape((1, y.shape[0], x.shape[0]))