From b007c2707fbfbaf15318715332d14d59120fe5dc Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Fri, 24 Mar 2023 11:46:39 -0500
Subject: [PATCH] snapshot...

---
 modules/util/viirs_l1b_l2.py | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/modules/util/viirs_l1b_l2.py b/modules/util/viirs_l1b_l2.py
index c567aede..407320a6 100644
--- a/modules/util/viirs_l1b_l2.py
+++ b/modules/util/viirs_l1b_l2.py
@@ -87,14 +87,27 @@ def process_cld_prob(grd_k):
     return grd_k
 
 
+# def process_cld_opd(grd_k):
+#     keep = np.invert(np.isnan(grd_k))
+#     num_keep = np.sum(keep)
+#     grd_k = np.where(np.invert(keep), 0, grd_k)
+#     keep = np.where(keep, np.logical_and(0.1 < grd_k, grd_k < 158.0), False)
+#     frac_keep = np.sum(keep)/num_keep
+#     if frac_keep < 0.60:
+#         return None
+#     return grd_k
+
+
 def process_cld_opd(grd_k):
     keep = np.invert(np.isnan(grd_k))
     num_keep = np.sum(keep)
-    grd_k = np.where(np.invert(keep), 0, grd_k)
-    keep = np.where(keep, np.logical_and(0.1 < grd_k, grd_k < 158.0), False)
-    frac_keep = np.sum(keep)/num_keep
-    if frac_keep < 0.60:
+    keep_vthin = np.where(keep, grd_k < 0.01, False)
+    keep_vthik = np.where(keep, grd_k < 150.0, False)
+    frac_vthin = np.sum(keep_vthin) / num_keep
+    frac_vthik = np.sum(keep_vthik) / num_keep
+    if not (frac_vthin >= 0.10 and frac_vthik >= 0.10):
         return None
+    grd_k = np.where(np.invert(keep), 0, grd_k)
     return grd_k
 
 
-- 
GitLab