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

remove dead code

parent b2f362f4
No related branches found
No related tags found
No related merge requests found
......@@ -45,73 +45,6 @@ flt_level_ranges[3] = [6000.0, 8000.0]
flt_level_ranges[4] = [8000.0, 15000.0]
def run_make_images(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', ckpt_dir_s_path='/Users/tomrink/tf_model/', prob_thresh=0.5, satellite='GOES16', domain='CONUS',
extent=[-105, -70, 15, 50],
pirep_file='/Users/tomrink/data/pirep/pireps_202109200000_202109232359.csv',
obs_lons=None, obs_lats=None, obs_times=None, obs_alt=None, flight_level=None,
use_flight_altitude=False, day_night='DAY', l1b_andor_l2='l2'):
if pirep_file is not None:
ice_dict, no_ice_dict, neg_ice_dict = setup(pirep_file)
if satellite == 'H08':
clvrx_ds = CLAVRx_H08(clvrx_dir)
else:
clvrx_ds = CLAVRx(clvrx_dir)
clvrx_files = clvrx_ds.flist
alt_lo, alt_hi = 0.0, 15000.0
if flight_level is not None:
alt_lo, alt_hi = flt_level_ranges[flight_level]
train_params = get_training_parameters(day_night=day_night, l1b_andor_l2=l1b_andor_l2)
for fidx, fname in enumerate(clvrx_files):
h5f = h5py.File(fname, 'r')
dto = clvrx_ds.get_datetime(fname)
ts = dto.timestamp()
clvrx_str_time = dto.strftime('%Y-%m-%d_%H:%M')
data_dct, ll, cc = make_for_full_domain_predict(h5f, name_list=train_params, satellite=satellite, domain=domain)
num_elems, num_lines = len(cc), len(ll)
dto, _ = get_time_tuple_utc(ts)
dto_0 = dto - datetime.timedelta(minutes=30)
dto_1 = dto + datetime.timedelta(minutes=30)
ts_0 = dto_0.timestamp()
ts_1 = dto_1.timestamp()
if pirep_file is not None:
_, keep_lons, keep_lats, _ = time_filter_3(ice_dict, ts_0, ts_1, alt_lo, alt_hi)
elif obs_times is not None:
keep = np.logical_and(obs_times >= ts_0, obs_times < ts_1)
keep = np.where(keep, np.logical_and(obs_alt >= alt_lo, obs_alt < alt_hi), False)
keep_lons = obs_lons[keep]
keep_lats = obs_lats[keep]
else:
keep_lons = None
keep_lats = None
ice_lons, ice_lats, preds_2d = icing_cnn.run_evaluate_static_avg(data_dct, ll, cc, ckpt_dir_s_path=ckpt_dir_s_path,
flight_level=flight_level, prob_thresh=prob_thresh,
satellite=satellite, domain=domain,
use_flight_altitude=use_flight_altitude)
make_icing_image(h5f, None, ice_lons, ice_lats, clvrx_str_time, satellite, domain,
ice_lons_vld=keep_lons, ice_lats_vld=keep_lats, extent=extent)
# preds_2d_dct, probs_2d_dct = run_evaluate_static(data_dct, num_lines, num_elems, day_night=day_night,
# ckpt_dir_s_path=ckpt_dir_s_path, prob_thresh=prob_thresh,
# flight_levels=[0],
# use_flight_altitude=use_flight_altitude)
#
# make_icing_image(None, probs_2d_dct[0], None, None, clvrx_str_time, satellite, domain,
# ice_lons_vld=keep_lons, ice_lats_vld=keep_lats, extent=extent)
h5f.close()
print('Done: ', clvrx_str_time)
def run_icing_predict(clvrx_dir='/Users/tomrink/data/clavrx/RadC/', output_dir=homedir,
day_model_path=model_path_day, night_model_path=model_path_night,
prob_thresh=0.5, satellite='GOES16', domain='CONUS', day_night='AUTO',
......
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