From 50e98493c958ca662feed2d023b8c0711f36bdd0 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Tue, 2 Aug 2022 12:37:37 -0500
Subject: [PATCH] snapshot...

---
 modules/util/viirs_l1b_l2.py | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/modules/util/viirs_l1b_l2.py b/modules/util/viirs_l1b_l2.py
index bf7fc59b..c529e465 100644
--- a/modules/util/viirs_l1b_l2.py
+++ b/modules/util/viirs_l1b_l2.py
@@ -15,8 +15,9 @@ emis_params = ['temp_10_4um_nom', 'temp_11_0um_nom', 'temp_12_0um_nom', 'temp_13
 # data_params = refl_params + emis_params
 data_params = emis_params
 
-l2_params = ['cloud_fraction', 'cld_temp_acha', 'cld_press_acha', 'cld_opd_acha', 'cld_reff_acha']
+l2_params = ['refl_0_65um_nom', 'temp_11_0um_nom', 'cld_temp_acha', 'cld_press_acha', 'cloud_fraction', 'cld_opd_acha', 'cld_reff_acha']
 label_params = l2_params
+data_params = l2_params
 
 # data_params = ['cloud_fraction']
 # label_params = ['cloud_fraction']
@@ -32,6 +33,7 @@ def run_all(directory, out_directory):
     for p in os.scandir(directory):
         if not p.is_dir():
             continue
+        print(p.name)
 
         data_files = glob.glob(directory + p.name+'/'+'clavrx_snpp_viirs*.uwssec*.h5')
         # data_files = glob.glob(directory + p.name + '/' + 'VNP02MOD*.uwssec.nc')
@@ -87,15 +89,12 @@ def run_all(directory, out_directory):
                     continue
 
                 num = len(data_tiles)
+                n_vld = int(num * 0.1)
 
-                [label_valid_tiles.append(label_tiles[k]) for k in range(4)]
-                [label_train_tiles.append(label_tiles[k]) for k in range(4, num)]
-                [data_valid_tiles.append(data_tiles[k]) for k in range(4)]
-                [data_train_tiles.append(data_tiles[k]) for k in range(4, num)]
-                # [label_valid_tiles.append(label_tiles[k]) for k in range(2)]
-                # [label_train_tiles.append(label_tiles[k]) for k in range(2, num)]
-                # [data_valid_tiles.append(data_tiles[k]) for k in range(2)]
-                # [data_train_tiles.append(data_tiles[k]) for k in range(2, num)]
+                [label_valid_tiles.append(label_tiles[k]) for k in range(n_vld)]
+                [label_train_tiles.append(label_tiles[k]) for k in range(n_vld, num)]
+                [data_valid_tiles.append(data_tiles[k]) for k in range(n_vld)]
+                [data_train_tiles.append(data_tiles[k]) for k in range(n_vld, num)]
 
             if f_cnt == 40:
                 cnt += 1
@@ -115,6 +114,8 @@ def run_all(directory, out_directory):
                 data_valid_tiles = []
                 data_train_tiles = []
 
+                print('   file # done: ', cnt)
+
                 f_cnt = 0
             else:
                 f_cnt += 1
@@ -160,9 +161,6 @@ def run(data_h5f, label_h5f, data_tiles, label_tiles, mod_tile_width=64, kernel_
     factor = int(img_num_pixels / mod_num_pixels)
     img_tile_width = mod_tile_width * factor
 
-    # mod_num_y_tiles = int(mod_num_lines / mod_tile_width)
-    # mod_num_x_tiles = int(mod_num_pixels / mod_tile_width)
-
     l1b_grd_s = []
     l2_grd_s = []
 
-- 
GitLab