From db731111af4e14e6e6e7e440e057d5d5c80f39a4 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Mon, 10 Jun 2024 12:21:02 -0500
Subject: [PATCH] snapshot...

---
 modules/contrail/util.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/contrail/util.py b/modules/contrail/util.py
index c7a0faff..11d09bb1 100644
--- a/modules/contrail/util.py
+++ b/modules/contrail/util.py
@@ -22,9 +22,12 @@ gfs_files = GFSfiles('/Users/tomrink/data/contrail/gfs/')
 # GEOSNavigation needs to be updated to support GOES-18
 # geos_nav = GEOSNavigation()
 
+num_lines = 5424
+num_elems = 5424
+
 
 def load_image(image_path):
-    # Extract date time string from image path
+    # Extract date time string from image filepath
     datetime_regex = '_\\d{8}_\\d{6}'
     datetime_string = re.search(datetime_regex, image_path)
     if datetime_string:
@@ -38,7 +41,7 @@ def load_image(image_path):
 
 
 def get_contrail_mask_image(image, thresh=0.157):
-    image = np.where(image > thresh,1, 0)
+    image = np.where(image > thresh, 1, 0)
     return image
 
 
@@ -134,9 +137,9 @@ def extract(mask_image, image_ts, clavrx_path):
     levels_dict_image = {}
     for k, v in levels_dict_cidx.items():
         cidx_nda = np.array(v)
-        flat_image = np.zeros(5424*5424)
+        flat_image = np.zeros(num_lines*num_elems)
         flat_image[cidx_nda] = 1
-        levels_dict_image[k] = flat_image.reshape(5424, 5424)
+        levels_dict_image[k] = flat_image.reshape(num_lines, num_elems)
 
     # Create a DataFrame for all tuples
     all_df = pd.DataFrame(all_list,
-- 
GitLab