diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index dbc05b531554c7dfca9ef302c6c5dd548897de6a..1dcd153085bf54ed69336f3077a8a664c4f35eea 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