From 72946544ef27ba05818a1e25229b502b02ea534b Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Thu, 4 Mar 2021 16:19:53 -0600 Subject: [PATCH] snapshot... --- modules/icing/pirep_goes.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index 33cff1e8..56c058a6 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -61,6 +61,8 @@ def run(): lon_s = np.zeros(1) lat_s = np.zeros(1) + last_clvr_file = None + last_h5f = None for idx, time in enumerate(time_keys): if (idx % 4) != 0: continue @@ -70,6 +72,7 @@ def run(): lat, lon, fl, rpt_str = tup lat_s[0] = lat lon_s[0] = lon + cc, ll = nav.earth_to_lc_s(lon_s, lat_s) #images, _, _, idxs = get_images(lon_s, lat_s, time, ['14'], [10], [1]) #if images is not None: @@ -77,14 +80,21 @@ def run(): clvr_ds = get_clavrx_datasource(time) clvr_file = clvr_ds.get_file(time) - - cc, ll = nav.earth_to_lc_s(lon_s, lat_s) - - try: - h5f = h5py.File(clvr_file, 'r') - except Exception: - h5f.close() - print('Problem with file: ', clvr_file) + if clvr_file is None: continue + if last_clvr_file is None: + last_clvr_file = clvr_file + else: + if clvr_file == last_clvr_file: + hf5 = last_h5f + else: + last_h5f.close() + try: + h5f = h5py.File(clvr_file, 'r') + except Exception: + h5f.close() + print('Problem with file: ', clvr_file) + continue + last_h5f = hf5 gvals = get_grid_values(h5f, 'temp_11_0um_nom', ll[0], cc[0], 20) -- GitLab