From 796c314776725511431faf6f27f2ef6192184665 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 11 Oct 2021 10:34:36 -0500 Subject: [PATCH] make get_grid_values a little more flexible --- modules/icing/pirep_goes.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index 785be5bc..6676e8e6 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -129,7 +129,7 @@ def get_goes_datasource(timestamp): return ds -def get_grid_values(h5f, grid_name, j_c, i_c, half_width, scale_factor_name='scale_factor', add_offset_name='add_offset', +def get_grid_values(h5f, grid_name, j_c, i_c, half_width, num_j=None, num_i=None, scale_factor_name='scale_factor', add_offset_name='add_offset', fill_value_name='_FillValue', range_name='actual_range', fill_value=None): hfds = h5f[grid_name] attrs = hfds.attrs @@ -138,15 +138,21 @@ def get_grid_values(h5f, grid_name, j_c, i_c, half_width, scale_factor_name='sca 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 + if half_width is not None: + 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 = i_c+half_width+1 - if j_r >= ylen or i_r >= xlen: - return None + j_r = j_c+half_width+1 + i_r = i_c+half_width+1 + if j_r >= ylen or i_r >= xlen: + return None + else: + j_l = j_c + j_r = j_c + num_j + 1 + i_l = i_c + i_r = i_c + num_i + 1 grd_vals = hfds[j_l:j_r, i_l:i_r] if fill_value is not None: -- GitLab