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

snapshot...

parent c7af42c8
No related branches found
No related tags found
No related merge requests found
...@@ -626,6 +626,7 @@ def pirep_info(pirep_dct): ...@@ -626,6 +626,7 @@ def pirep_info(pirep_dct):
lon_space_hdeg = np.linspace(-180, 180, 721) lon_space_hdeg = np.linspace(-180, 180, 721)
lat_space_hdeg = np.linspace(-90, 90, 361) lat_space_hdeg = np.linspace(-90, 90, 361)
hgt_space_3000 = np.linspace(0, 15000, 3000)
def check_no_overlap(lon, lat, ts, grd_bins, t_delta=600.0): def check_no_overlap(lon, lat, ts, grd_bins, t_delta=600.0):
...@@ -649,6 +650,31 @@ def check_no_overlap(lon, lat, ts, grd_bins, t_delta=600.0): ...@@ -649,6 +650,31 @@ def check_no_overlap(lon, lat, ts, grd_bins, t_delta=600.0):
return False return False
def check_no_overlap_alt(lon, lat, hgt, ts, grd_bins, t_delta=600.0):
grd_x_hi = lon_space_hdeg.shape[0] - 1
grd_y_hi = lat_space_hdeg.shape[0] - 1
grd_z_hi = hgt_space_3000.shape[0] - 1
lon_idx = np.searchsorted(lon_space_hdeg, lon)
lat_idx = np.searchsorted(lat_space_hdeg, lat)
hgt_idx = np.searchsorted(hgt_space_3000, hgt)
if lon_idx < 0 or lon_idx > grd_x_hi:
return False
if lat_idx < 0 or lat_idx > grd_y_hi:
return False
if hgt_idx < 0 or hgt_idx > grd_z_hi:
return False
last_ts = grd_bins[hgt_idx, lat_idx, lon_idx]
if ts - last_ts > t_delta:
grd_bins[hgt_idx, lat_idx, lon_idx] = ts
return True
else:
return False
# This mostly reduces some categories for a degree of class balancing and removes no intensity reports # This mostly reduces some categories for a degree of class balancing and removes no intensity reports
def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600): def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
t_delta = 600 # seconds t_delta = 600 # seconds
...@@ -777,6 +803,7 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600): ...@@ -777,6 +803,7 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
all_which = all_which[sidxs] all_which = all_which[sidxs]
grd_bins = np.full((lat_space_hdeg.shape[0], lon_space_hdeg.shape[0]), -(t_delta+1)) grd_bins = np.full((lat_space_hdeg.shape[0], lon_space_hdeg.shape[0]), -(t_delta+1))
#grd_bins = np.full((hgt_space_3000.shape[0], lat_space_hdeg.shape[0], lon_space_hdeg.shape[0]), -(t_delta+1))
cnt_i = 0 cnt_i = 0
cnt_ni = 0 cnt_ni = 0
for idx, key in enumerate(all_keys): for idx, key in enumerate(all_keys):
...@@ -789,8 +816,9 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600): ...@@ -789,8 +816,9 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
rpts = ice_dct[key] rpts = ice_dct[key]
tup = rpts[all_tidx[idx]] tup = rpts[all_tidx[idx]]
lat, lon = tup[0], tup[1] lat, lon, falt = tup[0], tup[1], tup[2]
#if not check_no_overlap_alt(lon, lat, falt, key, grd_bins, t_delta=t_delta):
if not check_no_overlap(lon, lat, key, grd_bins, t_delta=t_delta): if not check_no_overlap(lon, lat, key, grd_bins, t_delta=t_delta):
continue continue
...@@ -817,13 +845,15 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600): ...@@ -817,13 +845,15 @@ def process(ice_dct, no_ice_dct, neg_ice_dct, t_delta=600):
neg_ice_tidx = np.array(neg_ice_tidx) neg_ice_tidx = np.array(neg_ice_tidx)
print('neg ice total: ', neg_ice_keys.shape[0]) print('neg ice total: ', neg_ice_keys.shape[0])
#grd_bins = np.full((hgt_space_3000.shape[0], lat_space_hdeg.shape[0], lon_space_hdeg.shape[0]), -(t_delta+1))
grd_bins = np.full((lat_space_hdeg.shape[0], lon_space_hdeg.shape[0]), -(t_delta+1)) grd_bins = np.full((lat_space_hdeg.shape[0], lon_space_hdeg.shape[0]), -(t_delta+1))
cnt = 0 cnt = 0
for idx, key in enumerate(neg_ice_keys): for idx, key in enumerate(neg_ice_keys):
rpts = neg_ice_dct[key] rpts = neg_ice_dct[key]
tup = rpts[neg_ice_tidx[idx]] tup = rpts[neg_ice_tidx[idx]]
lat, lon = tup[0], tup[1] lat, lon, falt = tup[0], tup[1], tup[2]
#if not check_no_overlap_alt(lon, lat, falt, key, grd_bins, t_delta=t_delta):
if not check_no_overlap(lon, lat, key, grd_bins, t_delta=t_delta): if not check_no_overlap(lon, lat, key, grd_bins, t_delta=t_delta):
continue continue
cnt += 1 cnt += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment