From 20db61f04cc3a36f8b2746facccda907c064879b Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Sat, 14 Jan 2023 10:11:33 -0600 Subject: [PATCH] snapshot... --- modules/deeplearning/srcnn_l1b_l2.py | 29 ++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/deeplearning/srcnn_l1b_l2.py b/modules/deeplearning/srcnn_l1b_l2.py index 63d7d474..e919b9b5 100644 --- a/modules/deeplearning/srcnn_l1b_l2.py +++ b/modules/deeplearning/srcnn_l1b_l2.py @@ -59,12 +59,14 @@ label_param = 'cld_opd_dcomp' # label_param = 'cloud_probability' params = ['temp_11_0um_nom', 'temp_12_0um_nom', 'refl_0_65um_nom', label_param] -data_params = ['temp_11_0um_nom', 'refl_0_65um_nom'] +data_params_half = ['temp_11_0um_nom'] +data_params_full = ['refl_0_65um_nom'] # data_params = [] label_idx = params.index(label_param) -print('data_params: ', data_params) +print('data_params_half: ', data_params_half) +print('data_params_full: ', data_params_full) print('label_param: ', label_param) KERNEL_SIZE = 3 # target size: (128, 128) @@ -221,7 +223,7 @@ class SRCNN: self.test_data_nda = None self.test_label_nda = None - self.n_chans = len(data_params) + 1 + self.n_chans = len(data_params_half) + len(data_params_full) + 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)) @@ -254,7 +256,22 @@ class SRCNN: DO_ADD_NOISE = True data_norm = [] - for param in data_params: + for param in data_params_half: + idx = params.index(param) + tmp = input_data[:, idx, :, :] + tmp = tmp.copy() + tmp = np.where(np.isnan(tmp), 0, tmp) + # tmp = smooth_2d(tmp, sigma=1.0) + # Half res upsampled to full res: + tmp = tmp[:, slc_y_2, slc_x_2] + tmp = resample_2d_linear(x_2, y_2, tmp, t, s) + tmp = tmp[:, y_k, x_k] + tmp = normalize(tmp, param, mean_std_dct) + if DO_ADD_NOISE: + tmp = add_noise(tmp, noise_scale=NOISE_STDDEV) + data_norm.append(tmp) + + for param in data_params_full: idx = params.index(param) tmp = input_data[:, idx, :, :] tmp = tmp.copy() @@ -262,10 +279,6 @@ class SRCNN: # tmp = smooth_2d(tmp, sigma=1.0) # Full res: tmp = tmp[:, slc_y, slc_x] - # Half res upsampled to full res: - # tmp = tmp[:, slc_y_2, slc_x_2] - # tmp = resample_2d_linear(x_2, y_2, tmp, t, s) - # tmp = tmp[:, y_k, x_k] tmp = normalize(tmp, param, mean_std_dct) if DO_ADD_NOISE: tmp = add_noise(tmp, noise_scale=NOISE_STDDEV) -- GitLab