From 03e5b31dd77ea01fe67a33d5200ba4ab5ddff6f0 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 6 Nov 2023 11:34:05 -0600
Subject: [PATCH] snapshot...

---
 modules/icing/util.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/icing/util.py b/modules/icing/util.py
index f98eb907..ca68cba6 100644
--- a/modules/icing/util.py
+++ b/modules/icing/util.py
@@ -704,8 +704,8 @@ def write_icing_file_nc4_viirs(clvrx_str_time, output_dir, preds_dct, probs_dct,
 def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=homedir,
                       day_model_path=model_path_day, night_model_path=model_path_night,
                       prob_thresh=0.5, satellite='GOES16', domain='CONUS', day_night='AUTO',
-                      l1b_andor_l2='l2', use_flight_altitude=True, res_fac=1, use_nan=False, has_time=False,
-                      model_type='FCN', use_dnb=False):
+                      l1b_andor_l2='l2', use_flight_altitude=True, res_fac=1, use_nan=False,
+                      has_time=False, model_type='FCN', use_dnb=False, use_max_cth_level=False):
 
     if model_type == 'CNN':
         import deeplearning.icing_cnn as icing_cnn
@@ -842,12 +842,14 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
                 day_grd_dct = {name: None for name in day_train_params}
                 for ds_name in day_train_params:
                     day_grd_dct[ds_name] = np.stack(day_data_dct[ds_name])
-                day_grd_dct['cth_high_avg'] = day_cth_max
+                if use_max_cth_level:
+                    day_grd_dct['cth_high_avg'] = day_cth_max
 
                 preds_day_dct, probs_day_dct = \
                     model_module.run_evaluate_static_2(day_model, day_grd_dct, num_day_tiles, prob_thresh=prob_thresh,
                                                        use_flight_altitude=use_flight_altitude,
-                                                       flight_levels=flight_levels)
+                                                       flight_levels=flight_levels,
+                                                       use_max_cth_level=use_max_cth_level)
                 day_idxs = np.array(day_idxs)
                 for flvl in flight_levels:
                     day_preds = preds_day_dct[flvl]
@@ -872,13 +874,15 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
                 nght_grd_dct = {name: None for name in nght_train_params}
                 for ds_name in nght_train_params:
                     nght_grd_dct[ds_name] = np.stack(nght_data_dct[ds_name])
-                nght_grd_dct['cth_high_avg'] = nght_cth_max
+                if use_max_cth_level:
+                    nght_grd_dct['cth_high_avg'] = nght_cth_max
 
                 preds_nght_dct, probs_nght_dct = \
                     model_module.run_evaluate_static_2(night_model, nght_grd_dct, num_nght_tiles,
                                                        prob_thresh=prob_thresh,
                                                        use_flight_altitude=use_flight_altitude,
-                                                       flight_levels=flight_levels)
+                                                       flight_levels=flight_levels,
+                                                       use_max_cth_level=use_max_cth_level)
                 nght_idxs = np.array(nght_idxs)
                 for flvl in flight_levels:
                     nght_preds = preds_nght_dct[flvl]
-- 
GitLab