From ca04a9a9cdd141f6b3df80e0adf821f7e97bc0f7 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Tue, 19 Oct 2021 10:04:54 -0500
Subject: [PATCH] snapshot...

---
 modules/deeplearning/icing_cnn.py | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/deeplearning/icing_cnn.py b/modules/deeplearning/icing_cnn.py
index 5ac23b33..cb98e21c 100644
--- a/modules/deeplearning/icing_cnn.py
+++ b/modules/deeplearning/icing_cnn.py
@@ -1014,6 +1014,8 @@ def run_evaluate_static(h5f, ckpt_dir_s_path, prob_thresh=0.5, satellite='GOES16
 
     ckpt_dir_s = os.listdir(ckpt_dir_s_path)
 
+    nav = get_navigation(satellite, domain)
+
     prob_s = []
     for ckpt in ckpt_dir_s:
         ckpt_dir = ckpt_dir_s_path + ckpt
@@ -1038,21 +1040,28 @@ def run_evaluate_static(h5f, ckpt_dir_s_path, prob_thresh=0.5, satellite='GOES16
         preds = np.where(probs > prob_thresh, 1, 0)
     else:
         preds = np.argmax(probs, axis=1)
+    preds_2d = preds.reshape((len(ll), len(cc)))
+    x_rad = cc * nav.CFAC + nav.COFF
+    y_rad = ll * nav.LFAC + nav.LOFF
 
     ll, cc = np.meshgrid(ll, cc, indexing='ij')
     cc = cc.flatten()
     ll = ll.flatten()
+    lon_s, lat_s = nav.lc_to_earth(cc, ll)
+    lons_2d = lon_s.reshape((len(ll), len(cc)))
+    lats_2d = lat_s.reshape((len(ll), len(cc)))
+
     ice_mask = preds == 1
     ice_cc = cc[ice_mask]
     ice_ll = ll[ice_mask]
 
-    nav = get_navigation(satellite, domain)
-    ice_lons = []
-    ice_lats = []
-    for k in range(ice_cc.shape[0]):
-        lon, lat = nav.lc_to_earth(ice_cc[k], ice_ll[k])
-        ice_lons.append(lon)
-        ice_lats.append(lat)
+    # ice_lons = []
+    # ice_lats = []
+    # for k in range(ice_cc.shape[0]):
+    #     lon, lat = nav.lc_to_earth(ice_cc[k], ice_ll[k])
+    #     ice_lons.append(lon)
+    #     ice_lats.append(lat)
+    ice_lons, ice_lats = nav.lc_to_earth(ice_cc, ice_ll)
 
     return ice_lons, ice_lats
 
-- 
GitLab