let's get the Springfest sounding loaded and separated into individual variable arrays, plot T vs height and T vs log(P) import numpy as np import matplotlib.pyplot as plt %matplotlib inline filename = '/scratch/scholar/mebaldwi/EAPS431/20160416_1642Z_Purdue_Oval.txt' data = np.genfromtxt(filename, delimiter=',',skip_header=3) lat=data[:,0] lon=data[:,1] time=data[:,2] height_m=data[:,3] press_mb=data[:,4] temp_C=data[:,5] mix_ratio_gkg=data[:,6] wind_spd_ms=data[:,7] wind_dir_deg=data[:,8] temp_K=temp_C+273.15 height_msl=height_m+190. press_Pa=press_mb*100. theta=temp_K*(1000./press_mb)**0.286 plt.plot(temp_K,height_msl) plt.xlabel('temp K') plt.ylabel('height m') plt.axis([200, 300, 0, 16000])
Stuve code # Stuve chart code x = np.arange(220, 460, 10) y = np.arange(100, 1026, 25) theta_2D, P_2D = np.meshgrid(x, y) T_2D=theta_2D*(P_2D/1000.)**0.286 y = np.arange(40000, 102600, 2500) x = np.array([0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 1.5, 2., 3., 4., 6., 8., 10., 12., 16., 20.]) labels=['0.1', '0.2', '0.4', '0.6', '0.8', '1', '1.5', '2', '3', '4', '6', '8', '10', '12', '16', '20'] x = x/1000. ws_2D, Pws_2D = np.meshgrid(x, y) ws_T_2D=1./(1./273.15-1.844e-4*np.log(ws_2D*Pws_2D/611.3/(ws_2D+0.622))) fig, ax = plt.subplots() ax.set_yscale('log') ax.set_xlabel('temp K') ax.set_ylabel('pressure mb') ax.set_title('Stuve chart') ax.set_xlim(200, 300) ax.set_ylim(1025, 400) ax.minorticks_off() ax.set_xticks(np.arange(200,301,10)) ax.set_yticks([1000,850,700,600,500,400]) ax.set_yticklabels(['1000', '850','700','600','500','400']) ax.grid(True) ax.plot(ws_T_2D,Pws_2D*0.01,color='#a4c2f4',linestyle='dashed') ax.plot(T_2D,P_2D,color='#f6b26b') for i in np.arange(16): ax.text(ws_T_2D[3,i],Pws_2D[3,i]*0.01,labels[i],color='#0000f4',ha='center',weight='bold') ax.text(ws_T_2D[22,i],Pws_2D[22,i]*0.01,labels[i],color='#0000f4',ha='center',weight='bold') fig.set_size_inches(10,8) calculate dewpoint from mixing ratio and pressure mixratio_kgkg=(mix_ratio_gkg+0.0001)/1000. To=273.15 RoverL=1.844e-4 eps=0.622 eo=611.3 td=1./(1/To-RoverL*np.log((mixratio_kgkg*press_Pa/(eo*(mixratio_kgkg+eps))))) |