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

minor...

parent d59efe79
No related branches found
No related tags found
No related merge requests found
...@@ -458,160 +458,6 @@ def process_2(ice_dct, no_ice_dct, neg_ice_dct): ...@@ -458,160 +458,6 @@ def process_2(ice_dct, no_ice_dct, neg_ice_dct):
return new_ice_dct, new_no_ice_dct, new_neg_ice_dct return new_ice_dct, new_no_ice_dct, new_neg_ice_dct
def process_1(ice_dct, no_ice_dct, neg_ice_dct):
new_ice_dct = {}
new_no_ice_dct = {}
new_neg_ice_dct = {}
last_file = None
ice_files_5_6 = []
ice_times_5_6 = []
ice_keys_5_6 = []
ice_files_1 = []
ice_times_1 = []
ice_keys_1 = []
ice_files_4 = []
ice_times_4 = []
ice_keys_4 = []
ice_files_3 = []
ice_times_3 = []
ice_keys_3 = []
ice_files_2 = []
ice_times_2 = []
ice_keys_2 = []
print('num keys ice, no_ice, neg_ice: ', len(ice_dct), len(no_ice_dct), len(neg_ice_dct))
for ts in list(ice_dct.keys()):
try:
ds = get_goes_datasource(ts)
goes_file, t_0, _ = ds.get_file(ts)
if goes_file is not None and goes_file != last_file:
rpts = ice_dct[ts]
for tup in rpts:
if tup[3] == 5 or tup[3] == 6:
ice_files_5_6.append(goes_file)
ice_times_5_6.append(t_0)
ice_keys_5_6.append(ts)
elif tup[3] == 1:
ice_files_1.append(goes_file)
ice_times_1.append(t_0)
ice_keys_1.append(ts)
elif tup[3] == 4:
ice_files_4.append(goes_file)
ice_times_4.append(t_0)
ice_keys_4.append(ts)
elif tup[3] == 3:
ice_files_3.append(goes_file)
ice_times_3.append(t_0)
ice_keys_3.append(ts)
else:
ice_files_2.append(goes_file)
ice_times_2.append(t_0)
ice_keys_2.append(ts)
last_file = goes_file
except Exception:
continue
last_file = None
no_ice_files = []
no_ice_times = []
no_ice_keys = []
for ts in list(no_ice_dct.keys()):
try:
ds = get_goes_datasource(ts)
goes_file, t_0, _ = ds.get_file(ts)
if goes_file is not None and goes_file != last_file:
rpts = no_ice_dct[ts]
for tup in rpts:
no_ice_files.append(goes_file)
no_ice_times.append(t_0)
no_ice_keys.append(ts)
last_file = goes_file
except Exception:
continue
last_file = None
neg_ice_files = []
neg_ice_times = []
neg_ice_keys = []
for ts in list(neg_ice_dct.keys()):
try:
ds = get_goes_datasource(ts)
goes_file, t_0, _ = ds.get_file(ts)
if goes_file is not None and goes_file != last_file:
rpts = neg_ice_dct[ts]
for tup in rpts:
neg_ice_files.append(goes_file)
neg_ice_times.append(t_0)
neg_ice_keys.append(ts)
last_file = goes_file
except Exception:
continue
ice_times_5_6 = np.array(ice_times_5_6)
ice_keys_5_6 = np.array(ice_keys_5_6)
print('5_6: ', ice_times_5_6.shape)
ice_times_4 = np.array(ice_times_4)
ice_keys_4 = np.array(ice_keys_4)
print('4: ', ice_times_4.shape)
ice_times_3 = np.array(ice_times_3)
ice_keys_3 = np.array(ice_keys_3)
print('3: ', ice_times_3.shape)
ice_times_2 = np.array(ice_times_2)
ice_keys_2 = np.array(ice_keys_2)
print('2: ', ice_times_2.shape)
np.random.seed(42)
np.random.shuffle(ice_times_2)
np.random.seed(42)
np.random.shuffle(ice_keys_2)
ice_keys_2 = ice_keys_2[0:30000]
ice_times_1 = np.array(ice_times_1)
ice_keys_1 = np.array(ice_keys_1)
print('1: ', ice_times_1.shape)
ice_times = np.concatenate([ice_times_5_6, ice_times_1, ice_times_2, ice_times_3, ice_times_4])
ice_keys = np.concatenate([ice_keys_5_6, ice_keys_1, ice_keys_2, ice_keys_3, ice_keys_4])
uniq_sorted = np.unique(ice_times)
uniq_sorted_keys = np.unique(ice_keys)
print(ice_times.shape, uniq_sorted.shape)
print(ice_keys.shape, uniq_sorted_keys.shape)
uniq_sorted_keys = uniq_sorted_keys.tolist()
for key in uniq_sorted_keys:
new_ice_dct[key] = ice_dct[key]
no_ice_times = np.array(no_ice_times)
neg_ice_times = np.array(neg_ice_times)
print('no ice: ', no_ice_times.shape)
print('neg ice: ', neg_ice_times.shape)
no_ice_keys = np.array(no_ice_keys)
np.random.seed(42)
np.random.shuffle(no_ice_keys)
no_ice_keys = no_ice_keys[0:50000]
uniq_sorted_no_ice = np.unique(no_ice_keys)
print(no_ice_keys.shape, uniq_sorted_no_ice.shape)
uniq_sorted_no_ice = uniq_sorted_no_ice.tolist()
for key in uniq_sorted_no_ice:
new_no_ice_dct[key] = no_ice_dct[key]
neg_ice_keys = np.array(neg_ice_keys)
np.random.seed(42)
np.random.shuffle(neg_ice_keys)
neg_ice_keys = neg_ice_keys[0:5000]
uniq_sorted_neg_ice = np.unique(neg_ice_keys)
print(neg_ice_keys.shape, uniq_sorted_neg_ice.shape)
for key in uniq_sorted_neg_ice:
new_neg_ice_dct[key] = neg_ice_dct[key]
return new_ice_dct, new_no_ice_dct, new_neg_ice_dct
def analyze2(filename, filename_l1b): def analyze2(filename, filename_l1b):
f = h5py.File(filename, 'r') f = h5py.File(filename, 'r')
icing_alt = f['icing_altitude'][:] icing_alt = f['icing_altitude'][:]
...@@ -641,6 +487,7 @@ def analyze2(filename, filename_l1b): ...@@ -641,6 +487,7 @@ def analyze2(filename, filename_l1b):
plt.show() plt.show()
# --------------------------------------------
x_a = 10 x_a = 10
x_b = 30 x_b = 30
y_a = x_a y_a = x_a
......
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