From 3914c029ae0d2e2cb831a812192faf90cb7f0252 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Wed, 8 Dec 2021 15:42:07 -0600
Subject: [PATCH] snapshot...

---
 modules/icing/pirep_goes.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index 0f364e24..823c7b15 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -4,7 +4,8 @@ import pickle
 import matplotlib.pyplot as plt
 import os
 from util.util import get_time_tuple_utc, GenericException, add_time_range_to_filename, is_night, is_day, \
-    check_oblique, make_times, find_bin_index, get_timestamp, homedir, write_icing_file, make_for_full_domain_predict
+    check_oblique, make_times, find_bin_index, get_timestamp, homedir, write_icing_file, make_for_full_domain_predict, \
+    make_for_full_domain_predict2
 from util.plot import make_icing_image
 from util.geos_nav import get_navigation, get_lon_lat_2d_mesh
 from util.setup import model_path_day, model_path_night
@@ -2036,6 +2037,8 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
         clvrx_str_time = dto.strftime('%Y-%m-%d_%H:%M')
 
         data_dct, ll, cc = make_for_full_domain_predict(h5f, name_list=train_params, satellite=satellite, domain=domain)
+        # ancil_data_dct, _, _ = make_for_full_domain_predict(h5f, name_list=['cld_height_acha', 'cld_geo_thick'])
+        solzen, satzen = make_for_full_domain_predict2(h5f, satellite=satellite, domain=domain)
         if fidx == 0:
             num_elems = len(cc)
             num_lines = len(ll)
@@ -2044,6 +2047,23 @@ def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=h
 
         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)
+        flt_lvls = list(preds_2d_dct.keys())
+        for flvl in flt_lvls:
+            preds = preds_2d_dct[flvl]
+            keep = np.logical_and(lats_2d > -63.0, lats_2d < 63.0)
+            keep = np.where(keep, satzen < 70, False)
+            if day_night == 'DAY':
+                keep = np.where(keep, solzen < 80, False)
+            np.where(keep, preds, -1)
+
+        for flvl in flt_lvls:
+            probs = probs_2d_dct[flvl]
+            keep = np.logical_or(lats_2d > -63.0, lats_2d < 63.0)
+            keep = np.where(keep, satzen < 70, False)
+            if day_night == 'DAY':
+                keep = np.where(keep, solzen < 80, False)
+            np.where(keep, probs, -1.0)
+
         write_icing_file(clvrx_str_time, output_dir, preds_2d_dct, probs_2d_dct, x_rad, y_rad, lons_2d, lats_2d)
 
         print('Done: ', clvrx_str_time)
-- 
GitLab