From 68786bf00dd9e1402d6172b9936cf208e3d846cf Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Thu, 6 Jul 2023 13:10:58 -0500
Subject: [PATCH] snapshot...

---
 modules/deeplearning/cloud_opd_srcnn_abi.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/modules/deeplearning/cloud_opd_srcnn_abi.py b/modules/deeplearning/cloud_opd_srcnn_abi.py
index 40d2020a..0edffb96 100644
--- a/modules/deeplearning/cloud_opd_srcnn_abi.py
+++ b/modules/deeplearning/cloud_opd_srcnn_abi.py
@@ -713,14 +713,12 @@ class SRCNN:
 
     def run_inference(self, in_file, out_file):
         gc.collect()
+        t0 = time.time()
 
         h5f = h5py.File(in_file, 'r')
 
         refl = get_grid_values_all(h5f, 'refl_0_65um_nom')
         LEN_Y, LEN_X = refl.shape
-        print(LEN_Y, LEN_X)
-
-        t0 = time.time()
         bt = get_grid_values_all(h5f, 'temp_11_0um_nom')
         cld_opd = get_grid_values_all(h5f, 'cld_opd_dcomp')
         refl_sub_lo = get_grid_values_all(h5f, 'refl_0_65um_nom_min_sub')
@@ -729,7 +727,18 @@ class SRCNN:
         t1 = time.time()
         print('read data time: ', (t1 - t0))
 
-        self.run_inference_(bt, refl_sub_lo, refl_sub_hi, refl_sub_std, cld_opd, 2*LEN_Y, 2*LEN_X)
+        cld_opd_sres = self.run_inference_(bt, refl_sub_lo, refl_sub_hi, refl_sub_std, cld_opd, 2*LEN_Y, 2*LEN_X)
+
+        cld_opd_sres_out = np.zeros((LEN_Y, LEN_X), dtype=np.int8)
+        border = int((KERNEL_SIZE - 1) / 2)
+        cld_opd_sres_out[border:LEN_Y - border, border:LEN_X - border] = cld_opd_sres[0, :, :]
+
+        h5f.close()
+
+        if out_file is not None:
+            np.save(out_file, (cld_opd_sres, bt, refl, cld_opd))
+        else:
+            return cld_opd_sres
 
     def run_inference_(self, bt, refl_sub_lo, refl_sub_hi, refl_sub_std, cld_opd, LEN_Y, LEN_X):
 
-- 
GitLab