From ad6e9c5784e70a694df9da01f00fd3e125d4cd2c Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Fri, 5 Mar 2021 10:20:17 -0600
Subject: [PATCH] snapshot...

---
 modules/icing/pirep_goes.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index dbc05b53..1dcd1530 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -35,8 +35,17 @@ def get_clavrx_datasource(timestamp):
 def get_grid_values(h5f, grid_name, j_c, i_c, half_width, scale_factor_name='scale_factor', add_offset_name='add_offset'):
     hfds = h5f[grid_name]
     attrs = hfds.attrs
-
-    grd_vals = hfds[j_c-half_width:j_c+half_width+1, i_c-half_width:i_c+half_width+1]
+    ylen, xlen = hfds.shape
+    j_l = j_c-half_width
+    i_l = i_c-half_width
+    if j_l < 0 or i_l < 0:
+        return None
+    j_r = j_c+half_width+1
+    i_r = j_c+half_width+1
+    if j_r >= ylen or i_r >= xlen:
+        return None
+
+    grd_vals = hfds[j_l:j_r, i_l:i_r]
     grd_vals = np.where(grd_vals == -999, np.nan, grd_vals)
     grd_vals = np.where(grd_vals == -32768, np.nan, grd_vals)
 
@@ -66,6 +75,8 @@ def run():
     obs_times = []
     obs_lons = []
     obs_lats = []
+    temp_10_4um_nom = []
+    cld_height_acha = []
 
     for idx, time in enumerate(time_keys):
         reports = ice_dict[time]
@@ -102,4 +113,5 @@ def run():
             obs_lats.append(lat)
 
             cc, ll = nav.earth_to_lc_s(lon_s, lat_s)
-            gvals = get_grid_values(h5f, 'temp_10_4um_nom', ll[0], cc[0], 20)
\ No newline at end of file
+            gvals = get_grid_values(h5f, 'temp_10_4um_nom', ll[0], cc[0], 20)
+            gvals = get_grid_values(h5f, 'cld_height_acha', ll[0], cc[0], 20)
\ No newline at end of file
-- 
GitLab