From 618c7458cceb54acf05289ad342dc7c1c58354ff Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 19 Apr 2021 11:02:41 -0500
Subject: [PATCH] snapshot...

---
 modules/deeplearning/icing.py | 43 ++++++++++++-----------------------
 1 file changed, 14 insertions(+), 29 deletions(-)

diff --git a/modules/deeplearning/icing.py b/modules/deeplearning/icing.py
index ebe77b82..f960e9e1 100644
--- a/modules/deeplearning/icing.py
+++ b/modules/deeplearning/icing.py
@@ -7,8 +7,6 @@ import numpy as np
 import pickle
 import h5py
 
-from deeplearning.amv_raob import get_bounding_gfs_files, convert_file, get_images, get_interpolated_profile, get_time_tuple_utc, get_profile
-
 from icing.pirep_goes import split_data, normalize
 
 LOG_DEVICE_PLACEMENT = False
@@ -30,26 +28,12 @@ DAY_NIGHT = 'ANY'
 TRIPLET = False
 CONV3D = False
 
-abi_2km_channels = ['14', '08', '11', '13', '15', '16']
-# abi_2km_channels = ['08', '09', '10']
-abi_hkm_channels = []
-# abi_channels = abi_2km_channels + abi_hkm_channels
-abi_channels = abi_2km_channels
-
-abi_mean = {'08': 236.014, '14': 275.229, '02': 0.049, '11': 273.582, '13': 275.796, '15': 272.928, '16': 260.956, '09': 244.502, '10': 252.375}
-abi_std = {'08': 7.598, '14': 20.443, '02': 0.082, '11': 19.539, '13': 20.431, '15': 20.104, '16': 15.720, '09': 9.827, '10': 11.765}
-abi_valid_range = {'02': [0.001, 120], '08': [150, 350], '14': [150, 350], '11': [150, 350], '13': [150, 350], '15': [150, 350], '16': [150, 350], '09': [150, 350], '10': [150, 350]}
-abi_half_width = {'08': 12, '14': 12, '02': 48, '11': 12, '13': 12, '15': 12, '16': 12, '09': 12, '10': 12}
-#abi_half_width = {'08': 6, '14': 6, '02': 24, '11': 6, '13': 6, '15': 6, '16': 6, '09': 6, '10': 6}
-#abi_half_width = {'08': 3, '14': 3, '02': 12, '11': 3, '13': 3, '15': 3, '16': 3, '09': 3, '10': 3}
-abi_stride = {'08': 1, '14': 1, '02': 4, '11': 1, '13': 1, '15': 1, '16': 1, '09': 1, '10': 1}
 img_width = 16
-#img_width = 12
-#img_width = 6
 
+mean_std_file = '/Users/tomrink/data/icing/fovs_mean_std_day.pkl'
 
-train_params_day = ['cld_height_acha', 'cld_geo_thick', 'supercooled_cloud_fraction', 'cld_temp_acha', 'cld_press_acha',
-                    'cld_reff_dcomp', 'cld_opd_dcomp', 'cld_cwp_dcomp', 'iwc_dcomp', 'lwc_dcomp']
+train_params = ['cld_height_acha', 'cld_geo_thick', 'supercooled_cloud_fraction', 'cld_temp_acha', 'cld_press_acha',
+                'cld_reff_dcomp', 'cld_opd_dcomp', 'cld_cwp_dcomp', 'iwc_dcomp', 'lwc_dcomp']
                     #'cloud_phase']
 
 
@@ -159,17 +143,17 @@ class IcingIntensityNN:
         self.num_data_samples = None
         self.initial_learning_rate = None
 
-        n_chans = len(abi_channels)
+        n_chans = len(train_params)
         NUM_PARAMS = 1
         if TRIPLET:
             n_chans *= 3
-        self.X_img = tf.keras.Input(shape=(img_width, img_width, n_chans))
-        #self.X_img = tf.keras.Input(shape=NUM_PARAMS)
+        #self.X_img = tf.keras.Input(shape=(img_width, img_width, n_chans))
+        self.X_img = tf.keras.Input(shape=n_chans)
         #self.X_prof = tf.keras.Input(shape=(NUM_VERT_LEVELS, NUM_VERT_PARAMS))
-        self.X_sfc = tf.keras.Input(shape=2)
+        #self.X_sfc = tf.keras.Input(shape=2)
 
         self.inputs.append(self.X_img)
-        self.inputs.append(self.X_prof)
+        #self.inputs.append(self.X_prof)
 
         self.DISK_CACHE = True
 
@@ -200,7 +184,7 @@ class IcingIntensityNN:
         nd_keys = np.sort(nd_keys)
 
         data = []
-        for param in train_params_day:
+        for param in train_params:
             nda = self.h5f[param][nd_keys, ]
             # nda = normalize(nda, param)
             data.append(nda)
@@ -552,11 +536,12 @@ class IcingIntensityNN:
         self.writer_valid.close()
 
     def build_model(self):
-        flat = self.build_cnn()
-        flat_1d = self.build_1d_cnn()
+        # flat = self.build_cnn()
+        # flat_1d = self.build_1d_cnn()
         # flat = tf.keras.layers.concatenate([flat, flat_1d, flat_anc])
-        flat = tf.keras.layers.concatenate([flat, flat_1d])
-        self.build_dnn(flat)
+        # flat = tf.keras.layers.concatenate([flat, flat_1d])
+        # self.build_dnn(flat)
+        self.build_dnn()
         self.model = tf.keras.Model(self.inputs, self.logits)
 
     def restore(self, ckpt_dir):
-- 
GitLab