From 9b3db84964092cfc6d6068413d681ab62395a677 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 2 Jan 2023 13:02:08 -0600 Subject: [PATCH] snapshot... --- modules/deeplearning/icing_fcn.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/deeplearning/icing_fcn.py b/modules/deeplearning/icing_fcn.py index 1803fc46..576e3de0 100644 --- a/modules/deeplearning/icing_fcn.py +++ b/modules/deeplearning/icing_fcn.py @@ -19,6 +19,7 @@ if NumClasses == 2: NumLogits = 1 else: NumLogits = NumClasses +NumFlightLevels = 3 BATCH_SIZE = 128 NUM_EPOCHS = 60 @@ -241,8 +242,7 @@ class IcingIntensityFCN: self.X_img = tf.keras.Input(shape=(None, None, n_chans)) self.inputs.append(self.X_img) - #self.inputs.append(tf.keras.Input(shape=(None, None, 5))) - self.inputs.append(tf.keras.Input(shape=(None, None, 3))) + self.inputs.append(tf.keras.Input(shape=(None, None, NumFlightLevels))) self.flight_level = 0 @@ -362,18 +362,18 @@ class IcingIntensityFCN: nda = h5f[param][nd_idxs,] - # nda[np.logical_and(nda >= 0, nda < 2000)] = 0 - # nda[np.logical_and(nda >= 2000, nda < 4000)] = 1 - # nda[np.logical_and(nda >= 4000, nda < 6000)] = 2 - # nda[np.logical_and(nda >= 6000, nda < 8000)] = 3 - # nda[np.logical_and(nda >= 8000, nda < 15000)] = 4 - - nda[np.logical_and(nda >= 0, nda < 3000)] = 0 - nda[np.logical_and(nda >= 3000, nda < 6000)] = 1 - nda[np.logical_and(nda >= 6000, nda < 15000)] = 2 - - # nda = tf.one_hot(nda, 5).numpy() - nda = tf.one_hot(nda, 3).numpy() + if NumFlightLevels == 5: + nda[np.logical_and(nda >= 0, nda < 2000)] = 0 + nda[np.logical_and(nda >= 2000, nda < 4000)] = 1 + nda[np.logical_and(nda >= 4000, nda < 6000)] = 2 + nda[np.logical_and(nda >= 6000, nda < 8000)] = 3 + nda[np.logical_and(nda >= 8000, nda < 15000)] = 4 + elif NumFlightLevels == 3: + nda[np.logical_and(nda >= 0, nda < 3000)] = 0 + nda[np.logical_and(nda >= 3000, nda < 6000)] = 1 + nda[np.logical_and(nda >= 6000, nda < 15000)] = 2 + + nda = tf.one_hot(nda, NumFlightLevels).numpy() nda = np.expand_dims(nda, axis=1) nda = np.expand_dims(nda, axis=1) -- GitLab