From 577699791c0ce5137fdabcf2c51fa906ad016a43 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Wed, 1 Dec 2021 14:55:11 -0600
Subject: [PATCH] minor

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

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index 98e51883..9c32175e 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -1811,47 +1811,55 @@ def tiles_info(filename):
 def analyze(preds_file, truth_file='/Users/tomrink/data/icing_ml/tiles_202109240000_202111212359_l2_test_v3_DAY.h5'):
     h5f = h5py.File(truth_file, 'r')
     nda = h5f['flight_altitude'][:]
+    iint = h5f['icing_intensity'][:]
     cld_hgt = h5f['cld_height_acha'][:]
     cld_dz = h5f['cld_geo_thick'][:]
     cld_tmp = h5f['cld_temp_acha'][:]
 
+    iint = np.where(iint == -1, 0, iint)
+    iint = np.where(iint != 0, 1, iint)
+
     nda[np.logical_and(nda >= 0, nda < 2000)] = 0
     nda[np.logical_and(nda >= 2000, nda < 4000)] = 1
     nda[np.logical_and(nda >= 4000, nda < 6000)] = 2
     nda[np.logical_and(nda >= 6000, nda < 8000)] = 3
     nda[np.logical_and(nda >= 8000, nda < 15000)] = 4
 
-    labels, prob_avg, cm_avg = pickle.load(open(preds_file, 'rb'))
-
     print(np.sum(nda == 0), np.sum(nda == 1), np.sum(nda == 2), np.sum(nda == 3), np.sum(nda == 4))
     print('---------------------------')
 
     print('level 0: ')
-    print(np.nanmean(cld_dz[(nda == 0)]), np.nanmean(cld_hgt[(nda == 0)]))
+    print(np.nanmean(cld_dz[(nda == 0) & (iint == 0)]), np.nanmean(cld_hgt[(nda == 0) & (iint == 0)]))
+    print(np.nanmean(cld_dz[(nda == 0) & (iint == 1)]), np.nanmean(cld_hgt[(nda == 0) & (iint == 1)]))
     print('------------')
 
     print('level 1: ')
-    print(np.nanmean(cld_dz[(nda == 1)]), np.nanmean(cld_hgt[(nda == 1)]))
+    print(np.nanmean(cld_dz[(nda == 1) & (iint == 0)]), np.nanmean(cld_hgt[(nda == 1) & (iint == 0)]))
+    print(np.nanmean(cld_dz[(nda == 1) & (iint == 1)]), np.nanmean(cld_hgt[(nda == 1) & (iint == 1)]))
     print('------------')
 
     print('level 2: ')
-    print(np.nanmean(cld_dz[(nda == 2)]), np.nanmean(cld_hgt[(nda == 2)]))
+    print(np.nanmean(cld_dz[(nda == 2) & (iint == 0)]), np.nanmean(cld_hgt[(nda == 2) & (iint == 0)]))
+    print(np.nanmean(cld_dz[(nda == 2) & (iint == 1)]), np.nanmean(cld_hgt[(nda == 2) & (iint == 1)]))
     print('------------')
 
     print('level 3: ')
-    print(np.nanmean(cld_dz[(nda == 3)]), np.nanmean(cld_hgt[(nda == 3)]))
+    print(np.nanmean(cld_dz[(nda == 3) & (iint == 0)]), np.nanmean(cld_hgt[(nda == 3) & (iint == 0)]))
+    print(np.nanmean(cld_dz[(nda == 3) & (iint == 1)]), np.nanmean(cld_hgt[(nda == 3) & (iint == 1)]))
     print('------------')
 
     print('level 4: ')
-    print(np.nanmean(cld_dz[(nda == 4)]), np.nanmean(cld_hgt[(nda == 4)]))
+    print(np.nanmean(cld_dz[(nda == 4) & (iint == 0)]), np.nanmean(cld_hgt[(nda == 4) & (iint == 0)]))
+    print(np.nanmean(cld_dz[(nda == 4) & (iint == 1)]), np.nanmean(cld_hgt[(nda == 4) & (iint == 1)]))
 
+    print('No icing:       ', np.histogram(nda[iint == 0], bins=5)[0])
+    print('---------------------------')
+    print('Icing:          ', np.histogram(nda[iint == 1], bins=5)[0])
+    print('-----------------------------')
     print('----------------------------')
     print('-----------------------------')
 
-    print('No icing:       ', np.histogram(nda[labels == 0], bins=5)[0])
-    print('---------------------------')
-    print('Icing:          ', np.histogram(nda[labels == 1], bins=5)[0])
-    print('-----------------------------')
+    labels, prob_avg, cm_avg = pickle.load(open(preds_file, 'rb'))
 
     preds = np.where(prob_avg > 0.5, 1, 0)
 
-- 
GitLab