From 332e447725a39e015171b0c2a5269a0abb7e0f2f Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Thu, 1 Feb 2024 14:47:54 -0600 Subject: [PATCH] snapshot... --- modules/deeplearning/icing_cnn.py | 52 ------------------------------- 1 file changed, 52 deletions(-) diff --git a/modules/deeplearning/icing_cnn.py b/modules/deeplearning/icing_cnn.py index c1eb18f1..3623e61e 100644 --- a/modules/deeplearning/icing_cnn.py +++ b/modules/deeplearning/icing_cnn.py @@ -1063,58 +1063,6 @@ def run_restore_static(filename_l1b, filename_l2, ckpt_dir_s_path, day_night='DA return labels, prob_avg, cm_avg -def run_evaluate_static_avg(data_dct, ll, cc, ckpt_dir_s_path, day_night='DAY', flight_level=4, - use_flight_altitude=False, prob_thresh=0.5, - satellite='GOES16', domain='FD'): - num_elems = len(cc) - num_lines = len(ll) - cc = np.array(cc) - ll = np.array(ll) - - 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 - if not os.path.isdir(ckpt_dir): - continue - nn = IcingIntensityNN(day_night=day_night, use_flight_altitude=use_flight_altitude) - nn.flight_level = flight_level - nn.setup_eval_pipeline(data_dct, num_lines * num_elems) - nn.build_model() - nn.build_training() - nn.build_evaluation() - nn.do_evaluate(ckpt_dir) - prob_s.append(nn.test_probs) - - num = len(prob_s) - prob_avg = prob_s[0] - for k in range(num-1): - prob_avg += prob_s[k+1] - prob_avg /= num - probs = prob_avg - - if NumClasses == 2: - preds = np.where(probs > prob_thresh, 1, 0) - else: - preds = np.argmax(probs, axis=1) - preds_2d = preds.reshape((num_lines, num_elems)) - - ll, cc = np.meshgrid(ll, cc, indexing='ij') - cc = cc.flatten() - ll = ll.flatten() - - ice_mask = preds == 1 - ice_cc = cc[ice_mask] - ice_ll = ll[ice_mask] - - ice_lons, ice_lats = nav.lc_to_earth(ice_cc, ice_ll) - - return ice_lons, ice_lats, preds_2d - - def run_evaluate_static(data_dct, num_tiles, ckpt_dir_s_path, day_night='DAY', l1b_or_l2='both', prob_thresh=0.5, flight_levels=[0, 1, 2, 3, 4], use_flight_altitude=False): -- GitLab