diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py index 1ce5e6b8965177e5e886fe341e13deeffa0786a6..8dca38935aa27ea5b340f76d41e7295735b8e4d5 100644 --- a/modules/aeolus/aeolus_amv.py +++ b/modules/aeolus/aeolus_amv.py @@ -13,6 +13,7 @@ from metpy.units import units from util.gfs_reader import get_vert_profile_s from amv.intercompare import get_raob_dict_cdf from util.line_plot import do_plot +import pickle amv_file_duration = 60 # minutes @@ -1061,23 +1062,49 @@ def compare_amvs_bestfit(amvs_list, bfs_list, bin_size=200): return bin_ranges, bin_pres, bin_spd, bin_dir -def make_plot(bin_ranges, bin_pres, bin_spd, bin_dir): +def make_plot(): + f = open('/Users/tomrink/amv_raob.pkl', 'rb') + tup_r = pickle.load(f) + f.close() + + f = open('/Users/tomrink/amv_gfs.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] + x_values = [] - num_pres = [] + num_pres_r = [] + num_pres_g = [] num_spd = [] num_dir = [] - pres_mad = [] - pres_bias = [] + pres_mad_r = [] + pres_bias_r = [] + pres_mad_g = [] + pres_bias_g = [] + num_r = 0 + num_g = 0 for i in range(len(bin_ranges)): - x_values.append(np.average(bin_ranges[i])) - num_pres.append(bin_pres[i].shape[0]) - num_spd.append(bin_spd[i].shape[0]) - num_dir.append(bin_dir[i].shape[0]) - pres_mad.append(np.average(np.abs(bin_pres[i]))) - pres_bias.append(np.average(bin_pres[i])) + num_r += bin_pres_r[i].shape[0] + num_g += bin_pres_g[i].shape[0] - do_plot(x_values, [pres_mad, pres_bias], ['mad', 'bias'], ['blue', 'red'], invert=True, flip=True) + 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) + #num_spd.append(bin_spd[i].shape[0]) + #num_dir.append(bin_dir[i].shape[0]) + 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])) + + #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, [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) + #do_plot(x_values, [num_pres_r, num_pres_g], ['RAOB:'+str(num_r), 'GFS:'+str(num_g)], ['blue', 'red'], x_axis_label='Normalized Count', y_axis_label='hPa', invert=True, flip=True) # imports the S4 NOAA output