for yi in y_p_levels: ax.plot((x_min, x_max), (yi,yi), color = (1.0, 0.8, 0.8)) for x_T in x_T_levels: ax.plot(x_T, y_all_p, color=(1.0, 0.5, 0.5)) for x_theta in x_thetas: ax.plot(x_theta, y_all_p, color=(1.0, 0.7, 0.7)) for x_mixing_ratio in x_mixing_ratios: good = p_all >= 600 # restrict mixing ratio lines to below 600 mb ax.plot(x_mixing_ratio[good], y_all_p[good], color = (0.8, 0.8, 0.6)) n_moist = len(theta_ep_mesh) moist_colors = ((0.6, 0.9, 0.7),)*n_moist ax.contour(x_from_Tp(mesh_T+C_to_K, mesh_p), y_from_p(mesh_p), theta_ep_mesh, theta_ep_levels, colors = moist_colors) ax.axis((x_min, x_max, y_min, y_max)) def format_coord(x, y): T, p = to_thermo(x, y) return "{0:5.1f} C, {1:5.1f} mb".format(float(T), float(p)) ax.format_coord = format_coord ax.plot(x_snd_Td, y_snd_p, linewidth = 2, color = 'g') ax.plot(x_snd_T, y_snd_p, linewidth = 2, color = 'r') plt.show()
for x_T in x_T_levels: ax.plot(x_T, y_all_p, color=(1.0, 0.5, 0.5)) for x_theta in x_thetas: ax.plot(x_theta, y_all_p, color=(1.0, 0.7, 0.7)) for x_mixing_ratio in x_mixing_ratios: good = p_all >= 600 # restrict mixing ratio lines to below 600 mb ax.plot(x_mixing_ratio[good], y_all_p[good], color=(0.8, 0.8, 0.6)) n_moist = len(theta_ep_mesh) moist_colors = ((0.6, 0.9, 0.7), ) * n_moist ax.contour(x_from_Tp(mesh_T + C_to_K, mesh_p), y_from_p(mesh_p), theta_ep_mesh, theta_ep_levels, colors=moist_colors) ax.axis((x_min, x_max, y_min, y_max)) def format_coord(x, y): T, p = to_thermo(x, y) return "{0:5.1f} C, {1:5.1f} mb".format(float(T), float(p)) ax.format_coord = format_coord ax.plot(x_snd_Td, y_snd_p, linewidth=2, color='g') ax.plot(x_snd_T, y_snd_p, linewidth=2, color='r')
# Plot temperature, pressure, theta_dry, and mixing ratios for all given levels for yi in y_P_levels: ax.plot((x_min, x_max), (yi,yi), color = (1., 0.8, 0.8)) for x_T in x_T_levels: ax.plot(x_T, y_all_P, color = (1., 0.5, 0.5)) for x_theta in x_thetas: ax.plot(x_theta, y_all_P, color = (1., 0.7, 0.7)) for x_mixing_ratio in x_mixing_ratios: good = P_all >= 600 # restrict mixing ratio lines to below 600 mb ax.plot(x_mixing_ratio[good], y_all_P[good], color = (0.8, 0.8, 0.6)) n_moist = len(theta_ep_levels) moist_colors = ((0.6, 0.9, 0.7),)*n_moist # define colors for theta_ep contours # Plot 2D grid of theta_ep and theta_e ax.contour(x_from_TP(mesh_T+C_to_K, mesh_P), y_from_P(mesh_P), theta_ep_mesh, theta_ep_levels, colors = moist_colors) ax.contour(x_from_TP(mesh_T+C_to_K, mesh_P), y_from_P(mesh_P), theta_e_mesh, theta_e_levels, colors = 'c') ax.axis((x_min, x_max, y_min, y_max)) # Import real sounding data (as .txt) sounding_data = parse_SPC('test_sounding.txt') snd_T = sounding_data['T'] good_T = (snd_T > -100.) & (snd_T < 60.) snd_P = sounding_data['p'] snd_Td = sounding_data['Td'] x_snd_T = x_from_TP(snd_T+C_to_K, snd_P) x_snd_Td = x_from_TP(snd_Td+C_to_K, snd_P) y_snd_P = y_from_P(snd_P) ax.plot(x_snd_T, y_snd_P, linewidth=2, color='r') ax.plot(x_snd_Td, y_snd_P, linewidth=2, color='g')