diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index 38164b7e4f43b9a71c2200d1cf3dc3b86af87019..f79c51ecf8977b4b0386ed773eb53b32f23c7e83 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -91,7 +91,7 @@ def get_grid_values(h5f, grid_name, j_c, i_c, half_width, scale_factor_name='sca return grd_vals -def create_file(filename, data_dct, ds_list): +def create_file(filename, data_dct, ds_list, lon_c, lat_c, time_s): #h5f_expl = h5py.File(a_clvr_file, 'r') hf5 = h5py.File(filename, 'w') @@ -99,6 +99,10 @@ def create_file(filename, data_dct, ds_list): data = data_dct[ds_name] hf5.create_dataset(ds_name, data=data) + hf5.create_dataset('longitude', data=lon_c) + hf5.create_dataset('latitude', data=lat_c) + hf5.create_dataset('time', data=time_s) + hf5.close() @@ -115,6 +119,9 @@ def run(pirep_dct, outfile=None): cnt = 0 miss_a = 0 miss_b = 0 + lon_c = [] + lat_c = [] + time_s = [] for idx, time in enumerate(time_keys): reports = pirep_dct[time] for tup in reports: @@ -149,21 +156,30 @@ def run(pirep_dct, outfile=None): h5f = last_h5f cc, ll = nav.earth_to_lc_s(lon_s, lat_s) + if cc[0] < 0: + continue for didx, ds_name in enumerate(ds_list): gvals = get_grid_values(h5f, ds_name, ll[0], cc[0], 20) if gvals is not None: ds_grd_dct[ds_name].append(gvals) + lon_c.append(lon_s[0]) + lat_c.append(lat_c[0]) + time_s.append(time) cnt += 1 data_dct = {} for ds_name in ds_list: data_dct[ds_name] = np.array(ds_grd_dct[ds_name]) + lon_c = np.array(lon_c) + lat_c = np.array(lat_c) + time_s = np.array(time_s) print('num images: ', cnt, len(time_keys), miss_a, miss_b) - create_file(outfile, data_dct, ds_list) + create_file(outfile, data_dct, ds_list, lon_c, lat_c, time_s) + def analyze(ice_dct, no_ice_dct):