diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py index b09a240d44016272a9b47b8569296c4724fece1b..9a32208d946de9f29edf5c47925ddbf7f96c6c58 100644 --- a/modules/aeolus/aeolus_amv.py +++ b/modules/aeolus/aeolus_amv.py @@ -1067,6 +1067,8 @@ def compare_amvs_bestfit_driver(all_list, bin_size=200): amvs_list = [] bfs_list = [] + rb_list = [] + gfs_list = [] prd_list = [] for tup in all_list: ab_dct = tup[0] @@ -1077,6 +1079,8 @@ def compare_amvs_bestfit_driver(all_list, bin_size=200): tup = ab_dct.get(key) amvs_list.append(tup[0]) bfs_list.append(tup[1]) + rb_list.append(tup[2]) + gfs_list.append(tup[3]) keys = list(pr_dct.keys()) for key in keys: @@ -1101,6 +1105,8 @@ def compare_amvs_bestfit_driver(all_list, bin_size=200): amvs = np.concatenate(amvs_list) bfs = np.concatenate(bfs_list) + rbm = np.concatenate(rb_list) + gfs_bfs = np.concatenate(gfs_list) prd = np.concatenate(prd_list) thin = np.logical_and(prd[:, 2] > 0, prd[:, 2] < 1) @@ -1236,59 +1242,41 @@ def compare_amvs_bestfit(amvs, bfs, bin_size=200): return bin_ranges, bin_pres, bin_spd, bin_dir -def make_plot(): - # f = open('/Users/tomrink/amv_raob.pkl', 'rb') - f = open('/Users/tomrink/amv_bf_gfs_all_linear.pkl', 'rb') - tup_r = pickle.load(f) - f.close() +def make_plot(bin_ranges, bin_values): - f = open('/Users/tomrink/amv_bf_gfs_all_nearest.pkl', 'rb') - tup_g = pickle.load(f) - f.close() - - bin_ranges = tup_r[0] # same for all - bin_pres_r = tup_r[1] - bin_pres_g = tup_g[1] - bin_spd_r = tup_r[2] - bin_spd_g = tup_g[2] + bin_vals_r = bin_values[0] + bin_vals_g = bin_values[1] x_values = [] - num_pres_r = [] - num_pres_g = [] - num_spd = [] - num_dir = [] - pres_mad_r = [] - pres_bias_r = [] - pres_mad_g = [] - pres_bias_g = [] - spd_mad_r = [] - spd_bias_r = [] - spd_mad_g = [] - spd_bias_g = [] + num_vals_r = [] + num_vals_g = [] + mad_r = [] + bias_r = [] + mad_g = [] + bias_g = [] + num_r = 0 num_g = 0 for i in range(len(bin_ranges)): - num_r += bin_pres_r[i].shape[0] - num_g += bin_pres_g[i].shape[0] + num_r += bin_vals_r[i].shape[0] + num_g += bin_vals_g[i].shape[0] for i in range(len(bin_ranges)): x_values.append(np.average(bin_ranges[i])) - num_pres_r.append((bin_pres_r[i].shape[0])/num_r) - num_pres_g.append((bin_pres_g[i].shape[0])/num_g) - pres_mad_r.append(np.average(np.abs(bin_pres_r[i]))) - pres_bias_r.append(np.average(bin_pres_r[i])) - pres_mad_g.append(np.average(np.abs(bin_pres_g[i]))) - pres_bias_g.append(np.average(bin_pres_g[i])) + num_vals_r.append((bin_vals_r[i].shape[0])/num_r) + num_vals_g.append((bin_vals_g[i].shape[0])/num_g) + + mad_r.append(np.average(np.abs(bin_vals_r[i]))) + bias_r.append(np.average(bin_vals_r[i])) + + mad_g.append(np.average(np.abs(bin_vals_g[i]))) + bias_g.append(np.average(bin_vals_g[i])) - spd_mad_r.append(np.average(np.abs(bin_spd_r[i]))) - spd_bias_r.append(np.average(bin_spd_r[i])) - spd_mad_g.append(np.average(np.abs(bin_spd_g[i]))) - spd_bias_g.append(np.average(bin_spd_g[i])) - do_plot(x_values, [pres_mad_r, pres_mad_g], ['GFS_linear', 'GFS_nearest'], ['blue', 'red'], title='ACHA - BestFit', x_axis_label='MAD', y_axis_label='hPa', invert=True, flip=True) + do_plot(x_values, [mad_r, mad_g], ['GFS_linear', 'GFS_nearest'], ['blue', 'red'], title='ACHA - BestFit', x_axis_label='MAD', y_axis_label='hPa', invert=True, flip=True) #do_plot(x_values, [pres_mad_r, pres_mad_g], ['RAOB', 'GFS'], ['blue', 'red'], title='ACHA - BestFit', x_axis_label='MAD', y_axis_label='hPa', invert=True, flip=True) #do_plot(x_values, [spd_mad_r, spd_mad_g], ['RAOB', 'GFS'], ['blue', 'red'], title='ACHA - BestFit', x_axis_label='MAE (m/s)', y_axis_label='hPa', invert=True, flip=True) #do_plot(x_values, [pres_bias_r, pres_bias_g], ['RAOB', 'GFS'], ['blue', 'red'], title='ACHA - BestFit', x_axis_label='BIAS', y_axis_label='hPa', invert=True, flip=True)