diff --git a/modules/deeplearning/espcn.py b/modules/deeplearning/espcn.py index 2890ce25b18fb335e12d6a8d6b89de9ebda801af..84ccef7e918188fb79ed56154861e1f92e5763e8 100644 --- a/modules/deeplearning/espcn.py +++ b/modules/deeplearning/espcn.py @@ -49,16 +49,17 @@ f.close() mean_std_dct.update(mean_std_dct_l1b) mean_std_dct.update(mean_std_dct_l2) -emis_params = ['temp_10_4um_nom', 'temp_11_0um_nom', 'temp_12_0um_nom', 'temp_13_3um_nom', 'temp_3_75um_nom', - 'temp_6_7um_nom', 'temp_6_2um_nom', 'temp_7_3um_nom', 'temp_8_5um_nom', 'temp_9_7um_nom'] -l2_params = ['cloud_fraction', 'cld_temp_acha', 'cld_press_acha', 'cld_opd_acha', 'cld_reff_acha'] +# emis_params = ['temp_10_4um_nom', 'temp_11_0um_nom', 'temp_12_0um_nom', 'temp_13_3um_nom', 'temp_3_75um_nom', +# 'temp_6_7um_nom', 'temp_6_2um_nom', 'temp_7_3um_nom', 'temp_8_5um_nom', 'temp_9_7um_nom'] +data_params = ['refl_0_65um_nom', 'temp_11_0um_nom', 'cld_temp_acha', 'cld_press_acha', 'cloud_fraction'] +label_params = ['refl_0_65um_nom', 'temp_11_0um_nom', 'cld_temp_acha', 'cld_press_acha', 'cloud_fraction'] + -# -- Zero out params (Experimentation Only) ------------ -zero_out_params = ['cld_reff_dcomp', 'cld_opd_dcomp', 'iwc_dcomp', 'lwc_dcomp'] DO_ZERO_OUT = False -label_idx = 1 -label_param = l2_params[label_idx] +data_idx, label_idx = 1, 1 +data_param = data_params[data_idx] +label_param = label_params[label_idx] def build_conv2d_block(conv, num_filters, activation, block_name, padding='SAME'): @@ -211,12 +212,12 @@ class ESPCN: self.n_chans = 1 - # self.X_img = tf.keras.Input(shape=(None, None, self.n_chans)) - self.X_img = tf.keras.Input(shape=(36, 36, self.n_chans)) + self.X_img = tf.keras.Input(shape=(None, None, self.n_chans)) + # self.X_img = tf.keras.Input(shape=(36, 36, self.n_chans)) self.inputs.append(self.X_img) - # self.inputs.append(tf.keras.Input(shape=(None, None, self.n_chans))) - self.inputs.append(tf.keras.Input(shape=(36, 36, self.n_chans))) + self.inputs.append(tf.keras.Input(shape=(None, None, self.n_chans))) + # self.inputs.append(tf.keras.Input(shape=(36, 36, self.n_chans))) self.DISK_CACHE = False @@ -247,17 +248,24 @@ class ESPCN: label = label[:, label_idx, :, :] label = np.expand_dims(label, axis=3) + data = data[:, data_idx, :, :] + data = np.expand_dims(data, axis=3) + data = data.astype(np.float32) label = label.astype(np.float32) - data_norm = [] - for k, param in enumerate(emis_params): - tmp = normalize(data[:, k, :, :], param, mean_std_dct) - data_norm.append(tmp) - data = np.stack(data_norm, axis=3) + # data_norm = [] + # for k, param in enumerate(emis_params): + # tmp = normalize(data[:, k, :, :], param, mean_std_dct) + # data_norm.append(tmp) + # data = np.stack(data_norm, axis=3) + # + # if label_param != 'cloud_fraction': + # label = scale(label, label_param, mean_std_dct) + data = normalize(data, data_param, mean_std_dct) if label_param != 'cloud_fraction': - label = scale(label, label_param, mean_std_dct) + label = normalize(label, label_param, mean_std_dct) if is_training and DO_AUGMENT: data_ud = np.flip(data, axis=1)