Skip to content
Snippets Groups Projects
Commit 8ed654a8 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 2d4d5b82
No related branches found
No related tags found
No related merge requests found
......@@ -624,6 +624,49 @@ def process(ice_dct, no_ice_dct, neg_ice_dct):
return new_ice_dct, new_no_ice_dct, new_neg_ice_dct
def process_boeing(ice_dct, no_ice_dct):
new_no_ice_dct = {}
print('num keys ice, no_ice: ', len(ice_dct), len(no_ice_dct))
no_ice_keys = []
no_ice_tidx = []
for ts in list(no_ice_dct.keys()):
rpts = no_ice_dct[ts]
for idx, tup in enumerate(rpts):
no_ice_keys.append(ts)
no_ice_tidx.append(idx)
# -----------------------------------------------------
no_ice_keys = np.array(no_ice_keys)
no_ice_tidx = np.array(no_ice_tidx)
print('no ice total: ', no_ice_keys.shape[0])
np.random.seed(42)
ridxs = np.random.permutation(np.arange(no_ice_keys.shape[0]))
no_ice_keys = no_ice_keys[ridxs]
no_ice_tidx = no_ice_tidx[ridxs]
no_ice_keys = no_ice_keys[::10]
no_ice_tidx = no_ice_tidx[::10]
print('no ice reduced: ', no_ice_keys.shape[0])
sidxs = np.argsort(no_ice_keys)
no_ice_keys = no_ice_keys[sidxs]
no_ice_tidx = no_ice_tidx[sidxs]
for idx, key in enumerate(no_ice_keys):
rpts = no_ice_dct[key]
tup = rpts[no_ice_tidx[idx]]
n_rpts = new_no_ice_dct.get(key)
if n_rpts is None:
n_rpts = []
new_no_ice_dct[key] = n_rpts
n_rpts.append(tup)
# -------------------------------------------------
return ice_dct, new_no_ice_dct
def analyze2(filename, filename_l1b):
f = h5py.File(filename, 'r')
icing_alt = f['icing_altitude'][:]
......@@ -1659,34 +1702,7 @@ def spatial_filter(icing_dict):
return grd_bins, grd_bins_keys
def spatial_filter2(icing_dict):
keys = icing_dict.keys()
grd_x_hi = lon_space.shape[0] - 1
grd_y_hi = lat_space.shape[0] - 1
grd_bins = np.full((lat_space.shape[0], lon_space.shape[0]), 0)
grd_bins_keys = [[[] for i in range(lon_space.shape[0])] for j in range(lat_space.shape[0])]
for key in keys:
tup = icing_dict.get(key)
lat = tup[0]
lon = tup[1]
lon_idx = np.searchsorted(lon_space, lon)
lat_idx = np.searchsorted(lat_space, lat)
if lon_idx < 0 or lon_idx > grd_x_hi:
continue
if lat_idx < 0 or lat_idx > grd_y_hi:
continue
grd_bins[lat_idx, lon_idx] += 1
grd_bins_keys[lat_idx][lon_idx].append(key)
return grd_bins, grd_bins_keys
def process_boeing(boeing_dct, pirep_dct, threshold=3000):
def remove_common(boeing_dct, pirep_dct, threshold=3000):
boeing_times = list(boeing_dct.keys())
pirep_times = np.array(list(pirep_dct.keys()))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment