diff --git a/modules/deeplearning/icing_fcn.py b/modules/deeplearning/icing_fcn.py index 378f8725774e95c196b729ede4de710c155f15bc..ac97090cfae90085854bf42a273abf14bc36d013 100644 --- a/modules/deeplearning/icing_fcn.py +++ b/modules/deeplearning/icing_fcn.py @@ -130,26 +130,28 @@ def build_residual_block_1x1(input_layer, num_filters, activation, block_name, p class IcingIntensityFCN: - def __init__(self, day_night='DAY', l1b_or_l2='both', use_flight_altitude=False, gpu_device=0, datapath=None): - - if day_night == 'DAY': - self.train_params_l1b = train_params_l1b_day - self.train_params_l2 = train_params_l2_day - if l1b_or_l2 == 'both': - self.train_params = train_params_l1b_day + train_params_l2_day - elif l1b_or_l2 == 'l1b': - self.train_params = train_params_l1b_day - elif l1b_or_l2 == 'l2': - self.train_params = train_params_l2_day - else: - self.train_params_l1b = train_params_l1b_night - self.train_params_l2 = train_params_l2_night - if l1b_or_l2 == 'both': - self.train_params = train_params_l1b_night + train_params_l2_night - elif l1b_or_l2 == 'l1b': - self.train_params = train_params_l1b_night - elif l1b_or_l2 == 'l2': - self.train_params = train_params_l2_night + def __init__(self, day_night='DAY', l1b_or_l2='both', satellite='GOES16', use_flight_altitude=False, datapath=None): + + # if day_night == 'DAY': + # self.train_params_l1b = train_params_l1b_day + # self.train_params_l2 = train_params_l2_day + # if l1b_or_l2 == 'both': + # self.train_params = train_params_l1b_day + train_params_l2_day + # elif l1b_or_l2 == 'l1b': + # self.train_params = train_params_l1b_day + # elif l1b_or_l2 == 'l2': + # self.train_params = train_params_l2_day + # else: + # self.train_params_l1b = train_params_l1b_night + # self.train_params_l2 = train_params_l2_night + # if l1b_or_l2 == 'both': + # self.train_params = train_params_l1b_night + train_params_l2_night + # elif l1b_or_l2 == 'l1b': + # self.train_params = train_params_l1b_night + # elif l1b_or_l2 == 'l2': + # self.train_params = train_params_l2_night + + self.train_params = get_training_parameters(day_night=day_night, l1b_andor_l2=l1b_or_l2, satellite=satellite) self.train_data = None self.train_label = None @@ -189,7 +191,6 @@ class IcingIntensityFCN: self.accuracy = None self.loss = None self.pred_class = None - self.gpu_device = gpu_device self.variable_averages = None self.global_step = None @@ -1097,7 +1098,7 @@ class IcingIntensityFCN: def run_restore_static(filename_l1b, filename_l2, ckpt_dir_s_path, day_night='DAY', l1b_or_l2='both', - use_flight_altitude=False, flight_level=0): + satellite='GOES16', use_flight_altitude=False, flight_level=0): ckpt_dir_s = os.listdir(ckpt_dir_s_path) cm_s = [] prob_s = [] @@ -1107,7 +1108,7 @@ def run_restore_static(filename_l1b, filename_l2, ckpt_dir_s_path, day_night='DA ckpt_dir = ckpt_dir_s_path + ckpt if not os.path.isdir(ckpt_dir): continue - nn = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_or_l2, use_flight_altitude=use_flight_altitude) + nn = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_or_l2, satellite=satellite, use_flight_altitude=use_flight_altitude) nn.flight_level = flight_level nn.run_restore(filename_l1b, filename_l2, ckpt_dir) cm_s.append(tf.math.confusion_matrix(nn.test_labels.flatten(), nn.test_preds.flatten())) @@ -1179,8 +1180,8 @@ def run_evaluate_static_avg(data_dct, ll, cc, ckpt_dir_s_path, day_night='DAY', 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): +def run_evaluate_static(data_dct, num_tiles, ckpt_dir_s_path, day_night='DAY', l1b_or_l2='both', satellite='GOES16', + prob_thresh=0.5, flight_levels=[0, 1, 2, 3, 4], use_flight_altitude=False): ckpt_dir_s = os.listdir(ckpt_dir_s_path) ckpt_dir = ckpt_dir_s_path + ckpt_dir_s[0] @@ -1191,7 +1192,7 @@ def run_evaluate_static(data_dct, num_tiles, ckpt_dir_s_path, day_night='DAY', l probs_dct = {flvl: None for flvl in flight_levels} preds_dct = {flvl: None for flvl in flight_levels} - nn = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_or_l2, use_flight_altitude=use_flight_altitude) + nn = IcingIntensityFCN(day_night=day_night, l1b_or_l2=l1b_or_l2, satellite=satellite, use_flight_altitude=use_flight_altitude) nn.num_data_samples = num_tiles nn.build_model() nn.build_training()