From cd47f29b036ed603fdbbf78457a28ae77a9ccd32 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 6 Mar 2023 10:16:03 -0600
Subject: [PATCH] snapshot...

---
 modules/deeplearning/cnn_cld_frac_mod_res.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/deeplearning/cnn_cld_frac_mod_res.py b/modules/deeplearning/cnn_cld_frac_mod_res.py
index 48b13e47..bf690cf8 100644
--- a/modules/deeplearning/cnn_cld_frac_mod_res.py
+++ b/modules/deeplearning/cnn_cld_frac_mod_res.py
@@ -35,7 +35,7 @@ EARLY_STOP = True
 
 NOISE_TRAINING = False
 NOISE_STDDEV = 0.01
-DO_AUGMENT = False
+DO_AUGMENT = True
 
 DO_SMOOTH = True
 SIGMA = 1.0
@@ -166,6 +166,7 @@ def upsample_mean(grd):
 
 
 def get_grid_cell_mean(grd_k):
+    grd_k = np.where(np.isnan(grd_k), 0, grd_k)
     a = grd_k[:, 0::2, 0::2]
     b = grd_k[:, 1::2, 0::2]
     c = grd_k[:, 0::2, 1::2]
@@ -176,6 +177,7 @@ def get_grid_cell_mean(grd_k):
 
 
 def get_min_max_std(grd_k):
+    grd_k = np.where(np.isnan(grd_k), 0, grd_k)
     a = grd_k[:, 0::2, 0::2]
     b = grd_k[:, 1::2, 0::2]
     c = grd_k[:, 0::2, 1::2]
@@ -354,13 +356,15 @@ class SRCNN:
             tmp = input_data[:, idx, :, :]
 
             lo, hi, std, avg = get_min_max_std(tmp)
+            # std = np.where(np.isnan(std), 0, std)
             lo = normalize(lo, param, mean_std_dct)
             hi = normalize(hi, param, mean_std_dct)
-            std = np.where(np.isnan(std), 0, std)
+            avg = normalize(avg, param, mean_std_dct)
 
             data_norm.append(lo[:, 0:66, 0:66])
             data_norm.append(hi[:, 0:66, 0:66])
-            data_norm.append(std[:, 0:66, 0:66])
+            data_norm.append(avg[:, 0:66, 0:66])
+            # data_norm.append(std[:, 0:66, 0:66])
         # ---------------------------------------------------
         tmp = input_data[:, label_idx, :, :]
         tmp = np.where(np.isnan(tmp), 0, tmp)
-- 
GitLab