Пример #1
0
    def plot_vertical_heat_flux(self,data,xdata):

        met=data[['theta','wvert','lats','lons']]
        topo=np.asarray(Terrain.get_topo(lats=met['lats'], lons=met['lons']))
        
        v_heatflux = pd.rolling_cov(met.wvert, met.theta, 60, center=True)

        plt.figure()
        plt.plot(xdata,v_heatflux)
        ax=plt.gca()
        ax.set_ylim([-0.5,0.5])
        ax.set_ylabel('Vertical heat flux [K m s-1]',color='b',fontsize=15)
        ax.set_xlabel('Distance from flight start [km]',fontsize=15)
        add_second_y_in(ax,topo,xaxis=xdata, color='r',label='Topography [m]')
        plt.draw()
Пример #2
0
    def plot_tke(self,data,xaxis):

        met=data[['wdir','wspd','wvert','lats','lons']]
        topo=np.asarray(Terrain.get_topo(lats=met['lats'], lons=met['lons']))

        u_comp,v_comp = get_wind_components(met.wspd,met.wdir)
        w_comp=met.wvert
        u_var = pd.rolling_var(u_comp,60,center=True)
        v_var = pd.rolling_var(v_comp,60,center=True)
        w_var = pd.rolling_var(w_comp,60,center=True)

        tke = 0.5*(u_var+v_var+w_var)
        plt.figure()
        plt.plot(xaxis,tke)
        ax=plt.gca()
        ax.set_ylim([0,10])
        plt.xlabel('distance')
        plt.ylabel('TKE [m2 s-2]')
        add_second_y_in(ax,topo,xaxis=xaxis,color='g',label='Topography [m]')
        plt.draw()
Пример #3
0
    def plot_meteo(self,xaxis,dots):

        topo=Terrain.get_topo(lats=self.met['lats'], lons=self.met['lons'])

        varname={    0:{'var':'atemp','name': 'air temperature',
                            'loc':3,'ylim':None,'fmt':False},
                    1:{'var':'dewp','name': 'dew point temp',
                            'loc':3,'ylim':None,'fmt':False},
                    2:{'var':'wdir','name':'wind direction',
                            'loc':(0.05,0.9),'ylim':None,'fmt':True},                            
                    3:{'var':'apres','name': 'air pressure',
                            'loc':(0.05,0.9),'ylim':None,'fmt':False},                        
                    4:{'var':'relh','name':'relative humidity',
                            'loc':(0.05,0.05),'ylim':[80,101],'fmt':True},                            
                    5:{'var':'wspd','name': 'wind speed',
                            'loc':(0.05,0.9),'ylim':None,'fmt':True},
                    6:{'var':'galt','name': 'geopotential alt',
                            'loc':(0.05,0.9),'ylim':None,'fmt':True},
                    7:{'var':'jwlwc','name':'liquid water content',
                            'loc':(0.05,0.9),'ylim':None,'fmt':False},
                    8:{'var':'wvert','name':'vertical velocity',
                            'loc':(0.05,0.9),'ylim':[-2,4],'fmt':True},
                    9:{'var':'palt','name': 'pressure alt',
                            'loc':(0.05,0.9),'ylim':None,'fmt':True}}


        fig, ax = plt.subplots(3,3, sharex=True,figsize=(15,10))
        axs=ax.ravel()
        for i in varname.items():
            item = i[0]            
            var = i[1]['var']
            name = i[1]['name']
            loc = i[1]['loc']
            ylim = i[1]['ylim']
            ax = axs[item-1]
            if item < 2: # air temp and dew point in the same plot
                axs[0].plot(xaxis,self.met[var],label=name)
                if ylim: axs[0].set_ylim(ylim)
                if item == 1:
                    axs[0].grid(True)
                    axs[0].legend(loc=loc,frameon=False)
            else:
                ax.plot(xaxis,self.met[var],label=name)
                if item == 6: 
                    ax2 = ax.twinx()
                    ax2.plot(xaxis,topo,'r')
                    ax2.set_ylabel('topography [m]', color='r')
                    for tl in ax2.get_yticklabels():
                        tl.set_color('r')
                    ax2.grid(False)
                if ylim: ax.set_ylim(ylim)
                ax.grid(True)
                ax.annotate(name, fontsize=16,
                                    xy=loc, 
                                    xycoords='axes fraction')
                if item == 8:
                    ax.set_xlabel('Distance from beginning of flight [km]')

        new_xticks=[xaxis[i] for i in dots]
        adjust_xaxis(axs,new_xticks)
        adjust_yaxis(axs) # --> it's affecting formatter
        l1='Flight level meteorology for '+self.name
        l2='\nStart time: '+self.time[0].strftime('%Y-%m-%d %H:%M')+' UTC'
        l3='\nEnd time: '+self.time[1].strftime('%Y-%m-%d %H:%M')+' UTC'
        fig.suptitle(l1+l2+l3,y=0.98)
        fig.subplots_adjust(bottom=0.08,top=0.9,
                            hspace=0,wspace=0.2)
        plt.draw