diff --git a/modules/deeplearning/cloud_fraction_fcn_abi.py b/modules/deeplearning/cloud_fraction_fcn_abi.py index 9938f546451a02e878f81969cfe8d3ecf15421f7..71b9b6d5fad8d6f632ef325a02e48b5858788ac5 100644 --- a/modules/deeplearning/cloud_fraction_fcn_abi.py +++ b/modules/deeplearning/cloud_fraction_fcn_abi.py @@ -3,7 +3,7 @@ import tensorflow as tf from util.plot_cm import confusion_matrix_values from util.augment import augment_image from util.setup_cloud_fraction import logdir, modeldir, now, ancillary_path -from util.util import EarlyStop, normalize, denormalize, get_grid_values_all, make_tf_callable_generator +from util.util import EarlyStop, normalize, denormalize, scale2, get_grid_values_all, make_tf_callable_generator import glob import os, datetime import numpy as np @@ -289,8 +289,7 @@ class SRCNN: self.test_data_files = None self.test_label_files = None - # self.n_chans = len(data_params_half) + len(data_params_full) + 1 - self.n_chans = 6 + self.n_chans = 5 self.X_img = tf.keras.Input(shape=(None, None, self.n_chans)) @@ -327,15 +326,30 @@ class SRCNN: tmp = normalize(tmp, param, mean_std_dct) data_norm.append(tmp) - for param in sub_fields: - idx = params.index(param) - tmp = input_data[:, idx, :, :] - tmp = tmp[:, slc_y, slc_x] - if param != 'refl_substddev_ch01': - tmp = normalize(tmp, 'refl_0_65um_nom', mean_std_dct) - else: - tmp = np.where(np.isnan(tmp), 0, tmp) - data_norm.append(tmp) + # for param in sub_fields: + # idx = params.index(param) + # tmp = input_data[:, idx, :, :] + # tmp = tmp[:, slc_y, slc_x] + # if param != 'refl_substddev_ch01': + # tmp = normalize(tmp, 'refl_0_65um_nom', mean_std_dct) + # else: + # tmp = np.where(np.isnan(tmp), 0, tmp) + # data_norm.append(tmp) + + rlo = input_data[:, params.index('refl_submin_ch01'), :, :] + rlo = rlo[:, slc_y, slc_x] + rlo = normalize(rlo, 'refl_0_65um_nom', mean_std_dct) + + rhi = input_data[:, params.index('refl_submax_ch01'), :, :] + rhi = rhi[:, slc_y, slc_x] + rhi = normalize(rhi, 'refl_0_65um_nom', mean_std_dct) + refl_rng = rhi - rlo + data_norm.append(refl_rng) + + rstd = input_data[:, params.index('refl_substddev_ch01'), :, :] + rstd = rstd[:, slc_y, slc_x] + rstd = scale2(rstd, 0.0, 20.0) + data_norm.append(rstd) tmp = input_label[:, label_idx_i, :, :] tmp = get_grid_cell_mean(tmp)