From d36a99e09b21bc258cd705839ddb07cb1d6de5fb Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 15 Nov 2021 15:29:13 -0600
Subject: [PATCH] snapshot...

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

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index 3fb50884..39dfbb7c 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -1936,27 +1936,17 @@ def run_make_images(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ckpt_dir_s_pat
         print('Done: ', clvrx_str_time)
 
 
-def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=homedir, model_path=None, prob_thresh=0.5, satellite='GOES16', domain='CONUS', day_night='DAY'):
+def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=homedir, model_path=None, prob_thresh=0.5, satellite='GOES16', domain='CONUS', day_night='DAY', l1b_andor_l2='l2'):
 
     if day_night == 'DAY':
-        train_params_l2 = ['cld_height_acha', 'cld_geo_thick', 'cld_temp_acha', 'cld_press_acha', 'supercooled_cloud_fraction',
-                           'cld_emiss_acha', 'conv_cloud_fraction', 'cld_reff_dcomp', 'cld_opd_dcomp', 'iwc_dcomp', 'lwc_dcomp']
-
-        train_params_l1b = ['temp_10_4um_nom', 'temp_11_0um_nom', 'temp_12_0um_nom', 'temp_13_3um_nom', 'temp_3_75um_nom',
-                            'temp_6_2um_nom', 'temp_6_7um_nom', 'temp_7_3um_nom', 'temp_8_5um_nom', 'temp_9_7um_nom',
-                            'refl_0_47um_nom', 'refl_0_65um_nom', 'refl_0_86um_nom', 'refl_1_38um_nom', 'refl_1_60um_nom']
         if model_path is None:
             model_path = model_path_day
     else:
-        train_params_l2 = ['cld_height_acha', 'cld_geo_thick', 'cld_temp_acha', 'cld_press_acha', 'supercooled_cloud_fraction',
-                           'cld_emiss_acha', 'conv_cloud_fraction', 'cld_reff_acha', 'cld_opd_acha']
-
-        train_params_l1b = ['temp_10_4um_nom', 'temp_11_0um_nom', 'temp_12_0um_nom', 'temp_13_3um_nom', 'temp_3_75um_nom',
-                            'temp_6_2um_nom', 'temp_6_7um_nom', 'temp_7_3um_nom', 'temp_8_5um_nom', 'temp_9_7um_nom']
         if model_path is None:
             model_path = model_path_night
 
-    train_params = train_params_l1b + train_params_l2
+    train_params = get_training_parameters(day_night=day_night, l1b_andor_l2=l1b_andor_l2)
+    train_params = train_params + ['cld_geo_thick', 'cld_height_acha']
 
     if satellite == 'H08':
         clvrx_ds = CLAVRx_H08(clvrx_dir)
@@ -1964,8 +1954,6 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
         clvrx_ds = CLAVRx(clvrx_dir)
     clvrx_files = clvrx_ds.flist
 
-    x_rad, y_rad, lons_2d, lats_2d = None, None, None, None
-
     for fidx, fname in enumerate(clvrx_files):
         h5f = h5py.File(fname, 'r')
         dto = clvrx_ds.get_datetime(fname)
@@ -1976,17 +1964,7 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
             num_elems = len(cc)
             num_lines = len(ll)
             nav = get_navigation(satellite, domain)
-            cc = np.array(cc)
-            ll = np.array(ll)
-            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((num_lines, num_elems))
-            lats_2d = lat_s.reshape((num_lines, num_elems))
+            lons_2d, lats_2d, x_rad, y_rad = get_lon_lat_2d_mesh(nav, ll, cc)
 
         preds_2d_dct, probs_2d_dct = run_evaluate_static_new(data_dct, num_lines, num_elems, day_night=day_night,
                                                              ckpt_dir_s_path=model_path, prob_thresh=prob_thresh)
-- 
GitLab