From 91ab55a63adba38eee079d901b393aab7f88d90e Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Sun, 13 Dec 2020 12:38:05 -0600 Subject: [PATCH] snapshot... --- modules/aeolus/aeolus_amv.py | 57 +++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py index ead4af05..cde1d41c 100644 --- a/modules/aeolus/aeolus_amv.py +++ b/modules/aeolus/aeolus_amv.py @@ -947,22 +947,59 @@ def compare_amvs_bestfit(amvs_list, bfs_list, bin_size=200): amvs = np.transpose(amvs, axes=[1, 0]) bfs = np.stack(bfs_list, axis=0) - didx = 4 - sidx = 3 - pidx = 2 + good_amvs = amvs + num_good = good_amvs.shape[0] + didx = 6 + sidx = 5 + pidx = 4 - vld_bf = bfs[:, 3] == 0 - keep_idxs = vld_bf + print('Number of AMVs: {0:d}'.format(num_good)) + spd_min = good_amvs[:, sidx].min() + spd_max = good_amvs[:, sidx].max() + print('spd min/max/mean: {0:.2f} {1:.2f} {2:.2f}'.format(spd_min, spd_max, np.average(good_amvs[:, sidx]))) + p_min = good_amvs[:, pidx].min() + p_max = good_amvs[:, pidx].max() + print('pres min/max/mean: {0:.2f} {1:.2f} {2:.2f}'.format(p_min, p_max, np.average(good_amvs[:, pidx]))) + + low = good_amvs[:, pidx] >= 700 + mid = np.logical_and(good_amvs[:, pidx] < 700, good_amvs[:, pidx] > 400) + hgh = good_amvs[:, pidx] <= 400 + + n_low = np.sum(low) + n_mid = np.sum(mid) + n_hgh = np.sum(hgh) + + print('% low: {0:.2f}'.format(100.0*(n_low/num_good))) + print('% mid: {0:.2f}'.format(100.0*(n_mid/num_good))) + print('% hgh: {0:.2f}'.format(100.0*(n_hgh/num_good))) + print('---------------------------') + + print('Low Spd min/max/mean: {0:.2f} {1:.2f} {2:.2f}'.format(good_amvs[low, sidx].min(), good_amvs[low, sidx].max(), good_amvs[low,sidx].mean())) + print('Low Press min/max/mean: {0:.2f} {1:.2f} {2:.2f}'.format(good_amvs[low, pidx].min(), good_amvs[low, pidx].max(), good_amvs[low, pidx].mean())) + print('---------------------------') + + print('Mid Spd min/max/mean: {0:.2f} {1:.2f} {2:.2f}'.format(good_amvs[mid, sidx].min(), good_amvs[mid, sidx].max(), good_amvs[mid, sidx].mean())) + print('Mid Press min/max/mean: {0:.2f} {1:.2f} {2:.2f}'.format(good_amvs[mid, pidx].min(), good_amvs[mid, pidx].max(), good_amvs[mid, pidx].mean())) + print('---------------------------') + + print('Hgh Spd min/max/mean: {0:.2f} {1:.2f} {2:.2f}'.format(good_amvs[hgh, sidx].min(), good_amvs[hgh, sidx].max(), good_amvs[hgh, sidx].mean())) + print('Hgh Press min/max/mean: {0:.2f} {1:.2f} {2:.2f}'.format(good_amvs[hgh, pidx].min(), good_amvs[hgh, pidx].max(), good_amvs[hgh, pidx].mean())) + + # Comparison to Level of Best Fit (LBF) ------------------------------------------------------------------ + # -------------------------------------------------------------------------------------------------------- bin_ranges = get_press_bin_ranges(50, 1050, bin_size=bin_size) - amv_p = amvs[keep_idxs, pidx] + vld_bf = bfs[:, 3] == 0 + keep_idxs = vld_bf + + amv_p = good_amvs[keep_idxs, pidx] bf_p = bfs[keep_idxs, 2] diff = amv_p - bf_p mad = np.average(np.abs(diff)) bias = np.average(diff) print('********************************************************') - print('Number of good best fits: ', bf_p.shape[0]) + print('Number of good best fits to RAOB: ', bf_p.shape[0]) print('press, MAD: {0:.2f}'.format(mad)) print('press, bias: {0:.2f}'.format(bias)) pd_std = np.std(diff) @@ -972,8 +1009,8 @@ def compare_amvs_bestfit(amvs_list, bfs_list, bin_size=200): bin_pres = bin_data_by(diff, amv_p, bin_ranges) - amv_spd = amvs[keep_idxs, sidx] - amv_dir = amvs[keep_idxs, didx] + amv_spd = good_amvs[keep_idxs, sidx] + amv_dir = good_amvs[keep_idxs, didx] bf_spd, bf_dir = spd_dir_from_uv(bfs[keep_idxs, 0], bfs[keep_idxs, 1]) diff = amv_spd * units('m/s') - bf_spd @@ -994,7 +1031,7 @@ def compare_amvs_bestfit(amvs_list, bfs_list, bin_size=200): print('-------------------------------------') bin_dir = bin_data_by(dir_diff, amv_p, bin_ranges) - amv_u, amv_v = uv_from_spd_dir(amvs[keep_idxs, sidx], amvs[keep_idxs, didx]) + amv_u, amv_v = uv_from_spd_dir(good_amvs[keep_idxs, sidx], good_amvs[keep_idxs, didx]) u_diffs = amv_u - (bfs[keep_idxs, 0] * units('m/s')) v_diffs = amv_v - (bfs[keep_idxs, 1] * units('m/s')) -- GitLab