From 236d684afa5f98dcc21679cdf8381e37e6c2e156 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Thu, 13 Apr 2023 11:41:54 -0500
Subject: [PATCH] snapshot...

---
 modules/util/viirs_surfrad.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/modules/util/viirs_surfrad.py b/modules/util/viirs_surfrad.py
index 4e024367..2e1fa95c 100644
--- a/modules/util/viirs_surfrad.py
+++ b/modules/util/viirs_surfrad.py
@@ -81,7 +81,7 @@ def process_cld_opd(grd_k):
     keep_cld = np.where(keep, (0.1 < grd_k), False)
     frac_cld = np.sum(keep_cld)/num_keep
     # if not (0.50 < frac_cld < 0.85):
-    if not (0.70 < frac_cld < 1.0):
+    if not (0.60 < frac_cld < 1.0):
         return None
     grd_k = np.where(np.invert(keep), 0, grd_k)  # Convert NaN to 0
     return grd_k
@@ -149,6 +149,12 @@ def run_all(directory, out_directory, day_night='ANY', pattern='clavrx_*.nc', st
                     np.save(out_directory + 'valid_ires_' + str(cnt), valid_i)
                     num_valid_samples = valid_m.shape[0]
 
+                    h, b = np.histogram(valid_i.flatten(), bins=20, range=[0.0, 160.0])
+                    hist_accum_valid_i += h
+                    h, b = np.histogram(valid_m.flatten(), bins=20, range=[0.0, 160.0])
+                    hist_accum_valid_m += h
+                    print(valid_i.shape, valid_m.shape)
+
                 num_train_samples = 0
                 if len(train_tiles_m) > 0:
                     train_i = np.stack(train_tiles_i)
@@ -157,6 +163,12 @@ def run_all(directory, out_directory, day_night='ANY', pattern='clavrx_*.nc', st
                     np.save(out_directory + 'train_mres_' + str(cnt), train_m)
                     num_train_samples = train_m.shape[0]
 
+                    h, b = np.histogram(train_i.flatten(), bins=20, range=[0.0, 160.0])
+                    hist_accum_train_i += h
+                    h, b = np.histogram(train_m.flatten(), bins=20, range=[0.0, 160.0])
+                    hist_accum_train_m += h
+                    print(train_i.shape, train_m.shape)
+
                 valid_tiles_i = []
                 train_tiles_i = []
                 valid_tiles_m = []
@@ -179,6 +191,7 @@ def run_all(directory, out_directory, day_night='ANY', pattern='clavrx_*.nc', st
         np.save(out_directory + 'valid_mres_' + str(cnt), valid_m)
         np.save(out_directory + 'valid_ires_' + str(cnt), valid_i)
         num_valid_samples = valid_m.shape[0]
+
         h, b = np.histogram(valid_i.flatten(), bins=20, range=[0.0, 160.0])
         hist_accum_valid_i += h
         h, b = np.histogram(valid_m.flatten(), bins=20, range=[0.0, 160.0])
@@ -191,6 +204,7 @@ def run_all(directory, out_directory, day_night='ANY', pattern='clavrx_*.nc', st
         np.save(out_directory + 'train_ires_' + str(cnt), train_i)
         np.save(out_directory + 'train_mres_' + str(cnt), train_m)
         num_train_samples = train_m.shape[0]
+
         h, b = np.histogram(train_i.flatten(), bins=20, range=[0.0, 160.0])
         hist_accum_train_i += h
         h, b = np.histogram(train_m.flatten(), bins=20, range=[0.0, 160.0])
-- 
GitLab