From 99cc43def3461facbe24fcbca61236465df311b5 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Fri, 20 May 2022 14:38:27 -0500
Subject: [PATCH] add method to scale data

---
 modules/deeplearning/unet_l1b_l2.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/modules/deeplearning/unet_l1b_l2.py b/modules/deeplearning/unet_l1b_l2.py
index 6235b947..06d7a55d 100644
--- a/modules/deeplearning/unet_l1b_l2.py
+++ b/modules/deeplearning/unet_l1b_l2.py
@@ -1,7 +1,7 @@
 import glob
 import tensorflow as tf
 from util.setup import logdir, modeldir, cachepath, now, ancillary_path, home_dir
-from util.util import EarlyStop, normalize, make_for_full_domain_predict
+from util.util import EarlyStop, normalize, scale, make_for_full_domain_predict
 import os, datetime
 import numpy as np
 import pickle
@@ -26,7 +26,7 @@ BATCH_SIZE = 128
 NUM_EPOCHS = 60
 
 TRACK_MOVING_AVERAGE = False
-EARLY_STOP = True
+EARLY_STOP = False
 
 TRIPLET = False
 CONV3D = False
@@ -54,11 +54,14 @@ 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_9um_nom',
                'temp_6_7um_nom']
+l2_params = ['cloud_fraction', 'cld_temp_acha', 'cld_press_acha']
 
 # -- Zero out params (Experimentation Only) ------------
 zero_out_params = ['cld_reff_dcomp', 'cld_opd_dcomp', 'iwc_dcomp', 'lwc_dcomp']
 DO_ZERO_OUT = False
 
+label_param = l2_params[1]
+
 
 def build_conv2d_block(conv, num_filters, activation, block_name, padding='SAME'):
     with tf.name_scope(block_name):
@@ -240,7 +243,7 @@ class UNET:
             data_norm.append(tmp)
         data = np.stack(data_norm, axis=3)
 
-        # label = normalize(label, 'M15', mean_std_dct)
+        label = scale(label, label_param, mean_std_dct)
 
         if is_training and DO_AUGMENT:
             data_ud = np.flip(data, axis=1)
@@ -358,14 +361,14 @@ class UNET:
         self.test_data_files = test_data_files
         self.test_label_files = test_label_files
 
-        trn_idxs = np.arange(10503)
+        trn_idxs = np.arange(20925)
         np.random.shuffle(trn_idxs)
-        tst_idxs = np.arange(1167)
+        tst_idxs = np.arange(2325)
 
         self.get_train_dataset(trn_idxs)
         self.get_test_dataset(tst_idxs)
 
-        self.num_data_samples = 10503
+        self.num_data_samples = 20925
 
         print('datetime: ', now)
         print('training and test data: ')
-- 
GitLab