From 05cb9262adb63377aa90988c6619daeb3a83c411 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Thu, 22 Dec 2022 10:46:58 -0600
Subject: [PATCH] snapshot...

---
 modules/icing/pirep_goes.py | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index cbbf5797..0c3ba10f 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -863,6 +863,7 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
 
 def analyze2(filename, filename_l1b):
     f = h5py.File(filename, 'r')
+    f_l1b = h5py.File(filename_l1b, 'r')
     iint = f['icing_intensity'][:]
     icing_alt = f['flight_altitude'][:]
     cld_top_hgt = f['cld_height_acha'][:, :, :]
@@ -874,29 +875,37 @@ def analyze2(filename, filename_l1b):
     # cld_opd = f['cld_opd_dcomp'][:, :, :]
     # solzen = f['solar_zenith_angle'][:, :, :]
 
+    bt_10_4 = f_l1b['temp_10_4um_nom'][:, :, :]
+
     cth = np.reshape(cld_top_hgt, [iint.size, -1])
     ctt = np.reshape(cld_top_tmp, [iint.size, -1])
     scf = np.reshape(sc_cld_frac, [iint.size, -1])
-    cth = np.nanmedian(cth, axis=1)
-    ctt = np.nanmedian(ctt, axis=1)
+    bt = np.reshape(bt_10_4, [iint.size, -1])
+    # cth = np.nanmedian(cth, axis=1)
+    # ctt = np.nanmedian(ctt, axis=1)
     scf = np.nanmedian(scf, axis=1)
-    #cth = np.nanmax(cth, axis=1)
-    #ctt = np.nanmax(ctt, axis=1)
+    bt = np.nanmedian(bt, axis=1)
+    cth = np.nanmax(cth, axis=1)
+    ctt = np.nanmax(ctt, axis=1)
+    #scf = np.nanmax(scf, axis=1)
     #cth = np.nanmin(cth, axis=1)
     #ctt = np.nanmin(ctt, axis=1)
+    #scf = np.nanmin(scf, axis=1)
     print(cth.shape, ctt.shape)
 
-    keep_0 = icing_alt < 6000.0
+    keep_0 = icing_alt < 15000.0
     keep_1 = cth < 6000.0
     keep_2 = ctt < 274.5
     keep_3 = np.logical_and(icing_alt > cth - 1000.0, icing_alt < cth + 1000.0)
     # keep = keep_0 & keep_1 & keep_2 & keep_3
-    keep = keep_0 & keep_1 & keep_2
+    # keep = keep_0 & keep_1 & keep_2
+    keep = keep_0 & keep_2
     icing_alt = icing_alt[keep]
     iint = iint[keep]
     cth = cth[keep]
     ctt = ctt[keep]
     scf = scf[keep]
+    bt = bt[keep]
     print(iint.shape, cth.shape)
     iint = np.where(iint == -1, 0, iint)
     iint = np.where(iint != 0, 1, iint)
@@ -905,7 +914,11 @@ def analyze2(filename, filename_l1b):
     print('num no ice: ', np.sum(no_ice))
     print('num ice:    ', np.sum(ice))
 
+    f.close()
+    f_l1b.close()
+
     return icing_alt[no_ice], icing_alt[ice], cth[no_ice], cth[ice], ctt[no_ice], ctt[ice], scf[no_ice], scf[ice]
+    #return icing_alt[no_ice], icing_alt[ice], cth[no_ice], cth[ice], ctt[no_ice], ctt[ice], bt[no_ice], bt[ice]
 
 
 # --------------------------------------------
-- 
GitLab