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

temp code

parent e8485669
No related branches found
No related tags found
No related merge requests found
......@@ -322,6 +322,74 @@ def run_best_fit_all(amv_dir, source, product_dir, product, raob_path, gfs_path,
tup = (amvs, bfs, prd)
return tup
def run_best_fit_all_no_product(amv_dir, source, raob_path, gfs_path, full_domain=False):
amv_files = get_datasource(amv_dir, source)
gfs_files = get_datasource(gfs_path, 'GFS')
raob_ds = get_datasource(raob_path, 'RAOB')
raob_files = raob_ds.flist
out_list = []
amvs_list = []
bfs_list = []
rb_list = []
bfs_gfs_list = []
if not full_domain:
for k, file in enumerate(raob_files):
raob_dct = get_raob_dict_cdf(file)
ts = raob_ds.ftimes[k,0]
m_d = match_amvs_to_raobs(raob_dct, ts, amv_files)
if m_d is None:
continue
gfs_file = gfs_files.get_file(ts)[0]
if gfs_file is None:
continue
bf_dct = run_best_fit(m_d, raob_dct, gfs_file)
out_list.append((bf_dct, prd_dct))
for tup in out_list:
ab_dct = tup[0]
keys = list(ab_dct.keys())
for key in keys:
tup = ab_dct.get(key)
amvs_list.append(tup[0])
bfs_list.append(tup[1])
rb_list.append(tup[2])
bfs_gfs_list.append(tup[3])
amvs = np.concatenate(amvs_list)
bfs = np.concatenate(bfs_list)
rbm = np.concatenate(rb_list)
bfs_gfs = np.concatenate(bfs_gfs_list)
tup = (amvs, bfs, bfs_gfs, rbm)
return tup
else:
for k, file in enumerate(raob_files):
raob_dct = get_raob_dict_cdf(file)
ts = raob_ds.ftimes[k,0]
amvs = get_amvs(amv_files, ts)
if amvs is None:
continue
gfs_file = gfs_files.get_file(ts)[0]
if gfs_file is None:
continue
bfs = run_best_fit_gfs(amvs, gfs_file, amv_lat_idx=0, amv_lon_idx=1, amv_prs_idx=4, amv_spd_idx=5, amv_dir_idx=6)
alons = amvs[:, 0]
alats = amvs[:, 1]
out_list.append((amvs, np.array(bfs)))
for tup in out_list:
amvs_list.append(tup[0])
bfs_list.append(tup[1])
amvs = np.concatenate(amvs_list)
bfs = np.concatenate(bfs_list)
tup = (amvs, bfs)
return tup
def get_product_at_locs(raob_to_amv_dct, ts, files, filepath=None):
keys = list(raob_to_amv_dct.keys())
......
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