From 8f2aa2a5a8b916367a6b9d3e3dd57c017944c0de Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Thu, 5 May 2022 11:42:19 -0500 Subject: [PATCH] snapshot... --- modules/util/util.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/util/util.py b/modules/util/util.py index 53c8c55d..35af7267 100644 --- a/modules/util/util.py +++ b/modules/util/util.py @@ -295,14 +295,20 @@ def get_grid_values_all(h5f, grid_name, scale_factor_name='scale_factor', add_of attr = attrs.get(scale_factor_name) if attr is None: raise GenericException('Attribute: '+scale_factor_name+' not found for variable: '+grid_name) - scale_factor = attr[0] + if np.isscalar(attr): + scale_factor = attr + else: + scale_factor = attr[0] grd_vals = grd_vals * scale_factor if add_offset_name is not None: attr = attrs.get(add_offset_name) if attr is None: raise GenericException('Attribute: '+add_offset_name+' not found for variable: '+grid_name) - add_offset = attr[0] + if np.isscalar(attr): + add_offset = attr + else: + add_offset = attr[0] grd_vals = grd_vals + add_offset if range_name is not None: @@ -317,7 +323,10 @@ def get_grid_values_all(h5f, grid_name, scale_factor_name='scale_factor', add_of attr = attrs.get(fill_value_name) if attr is None: raise GenericException('Attribute: '+fill_value_name+' not found for variable: '+grid_name) - fill_value = attr[0] + if np.isscalar(attr): + fill_value = attr + else: + fill_value = attr[0] grd_vals = np.where(grd_vals == fill_value, np.nan, grd_vals) return grd_vals -- GitLab