From 92e920e010f40eb9e25a5b7f8a73639c49269eac Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Sat, 26 Feb 2022 10:04:08 -0600
Subject: [PATCH] snapshot...

---
 modules/util/util.py | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/modules/util/util.py b/modules/util/util.py
index 54262b30..ce3b86dd 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -634,6 +634,41 @@ def make_for_full_domain_predict2(h5f, satellite='GOES16', domain='FD', res_fac=
 # -------------------------------------------------------------------------------------------
 
 
+def prepare_evaluate(h5f, name_list, satellite='GOES16', domain='FD'):
+
+    geos, xlen, xmin, xmax, ylen, ymin, ymax = get_cartopy_crs(satellite, domain)
+    j_0, i_0 = 0, 0
+    if satellite == 'H08':
+        xlen = taiwan_lenx
+        ylen = taiwan_leny
+        i_0 = taiwan_i0
+        j_0 = taiwan_j0
+
+    grd_dct_n = {name: [] for name in name_list}
+
+    cnt_a = 0
+    for ds_name in name_list:
+        gvals = get_grid_values(h5f, ds_name, j_0, i_0, None, num_j=ylen, num_i=xlen)
+        if gvals is not None:
+            grd_dct_n[ds_name] = gvals
+            cnt_a += 1
+
+    if cnt_a > 0 and cnt_a != len(name_list):
+        raise GenericException('weirdness')
+
+    solzen = get_grid_values(h5f, 'solar_zenith_angle', j_0, i_0, None, num_j=ylen, num_i=xlen)
+    satzen = get_grid_values(h5f, 'sensor_zenith_angle', j_0, i_0, None, num_j=ylen, num_i=xlen)
+
+    ll = [j_0 + j for j in range(ylen)]
+    cc = [i_0 + i for i in range(xlen)]
+
+    grd_dct = {name: None for name in name_list}
+    for ds_name in name_list:
+        grd_dct[ds_name] = np.stack(grd_dct_n[ds_name])
+
+    return grd_dct, solzen, satzen, ll, cc
+
+
 flt_level_ranges_str = {k: None for k in range(5)}
 flt_level_ranges_str[0] = '0_2000'
 flt_level_ranges_str[1] = '2000_4000'
-- 
GitLab