From 00b61330f35bf394a96aa4a9cf012bdb42ed8d1c Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 27 Sep 2021 15:14:35 -0500
Subject: [PATCH] match, where appropriate apply qc icing and no icing

---
 modules/icing/pirep_goes.py | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index 20166a07..2c70b4ed 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -820,11 +820,14 @@ def apply_qc_icing_pireps(icing_alt, cld_top_hgt, cld_phase, cld_opd, cld_mask,
 
 
 def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_phase, cld_opd, cld_mask, bt_11um, solzen, satzen, day_night='ANY'):
-    opd_thick_threshold = 2
-    opd_thin_threshold = 0.1
+
     if day_night == 'DAY':
         opd_thick_threshold = 20
         opd_thin_threshold = 1
+    elif day_night == 'NIGHT' or day_night == 'ANY':
+        opd_thick_threshold = 2
+        opd_thin_threshold = 0.1
+
     closeness = 100.0  # meters
     num_obs = len(icing_alt)
     cld_mask = cld_mask.reshape((num_obs, -1))
@@ -843,6 +846,9 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_phase, cld_opd, cld_mas
             continue
         elif day_night == 'DAY' and not is_day(solzen[i,]):
             continue
+        elif day_night == 'ANY':
+            if not (is_day(solzen[i,]) or is_night(solzen[i,])):
+                continue
 
         keep_0 = np.logical_or(cld_mask[i,] == 2, cld_mask[i,] == 3)  # cloudy
         keep_1 = np.invert(np.isnan(cld_top_hgt[i,]))
@@ -856,22 +862,7 @@ def apply_qc_no_icing_pireps(icing_alt, cld_top_hgt, cld_phase, cld_opd, cld_mas
         # Test1
         keep = np.where(keep, cld_top_hgt[i,] > icing_alt[i], False)
 
-        # # Test2
-        # keep = np.where(keep,
-        #     ((cld_phase[i,] == 4) &
-        #         np.logical_and(cld_top_hgt[i,]+closeness > icing_alt[i], cld_top_hgt[i,]-closeness < icing_alt[i])),
-        #              False)
-        #
-        # # Test4
-        # keep = np.where(keep, ((cld_phase[i,] == 4) & (cld_opd[i,] < opd_thin_threshold) & (cld_top_hgt[i,] > icing_alt[i])), False)
-        #
-        # # Test5
-        # keep = np.where(keep, (bt_11um[i,] > 270.0), False)
-        #
-        # # Test6
-        # keep = np.where(keep, (bt_11um[i,] < 228.0), False)
-        #
-        # # Test3
+        # Test3
         keep = np.where(keep, np.invert((cld_opd[i,] >= opd_thick_threshold) & (cld_phase[i,] == 4) & (cld_top_hgt[i,] > icing_alt[i])), False)
 
         mask.append(keep)
-- 
GitLab