Пример #1
0
    def plot_variable(self,va,lv,**kwargs):
        self.fig = plt.figure()
        m, x, y  = self.basemap_setup(nc,**kwargs)
        # Scales, colourmaps in here

        data = self.get(va,**kwargs)
        if not 'scale' in kwargs:
            m.contourf(x,y,data)
        else:
            m.contourf(x,y,data,N.arange(*kwargs['scale']))

        if self.C.plot_titles:
            title = utils.string_from_time('title',self.t)
            plt.title(title)
        if self.C.colorbar:
            plt.colorbar(orientation='horizontal')

        # SAVE FIGURE
        datestr = utils.string_from_time('output',self.t)
        lv_na = utils.get_level_naming(lv,va)
        na = (va,lv_na,datestr)
        self.fname = self.create_fname(*na)
        # pdb.set_trace()
        self.save(self.fig,self.output_root,self.fname)
        plt.close()
Пример #2
0
    def plot_variable(self,va,lv,**kwargs):
        self.fig = plt.figure()
        m, x, y  = self.basemap_setup(nc,**kwargs)
        # Scales, colourmaps in here

        data = self.get(va,**kwargs)
        if not 'scale' in kwargs:
            m.contourf(x,y,data)
        else:
            m.contourf(x,y,data,N.arange(*kwargs['scale']))

        if self.C.plot_titles:
            title = utils.string_from_time('title',self.t)
            plt.title(title)
        if self.C.colorbar:
            plt.colorbar(orientation='horizontal')

        # SAVE FIGURE
        datestr = utils.string_from_time('output',self.t)
        lv_na = utils.get_level_naming(lv,va)
        na = (va,lv_na,datestr)
        self.fname = self.create_fname(*na)
        # pdb.set_trace()
        self.save(self.fig,self.output_root,self.fname)
        plt.close()
Пример #3
0
    def plot_streamlines(self,va,lv,**kwargs):
        fig = plt.figure()

        # Scales, colourmaps in here

        # Get data
        u_all = self.get('U10',**kwargs)[:]
        v_all = self.get('V10',**kwargs)[:]

        u = self.cut_2D_array(u_all)
        v = self.cut_2D_array(v_all)
        m, x, y  = self.basemap_setup(**kwargs)
        """ 
        # Density depends on which version
        # Wanting to match 3 km WRF (which had 2.5 density)
        # Should work out dx, dy in __init__ method!
        
        WRF_density = 2.5
        WRF_res = 3.0

        if self.version == 3:
            RUC_res = 13.0
        
        density = WRF_density * RUC_res/WRF_res
        """
        density = 2.5

        #x = N.array(range(u.shape[0]))
        #y = N.array(range(v.shape[1]))
        
        #pdb.set_trace()
        #m.streamplot(x[self.x_dim/2,:],y[:,self.y_dim/2],u,v,density=density,linewidth=0.75,color='k')
        #m.streamplot(x[y.shape[1]/2,:],y[:,x.shape[0]/2],u,v,density=density,linewidth=0.75,color='k')
        #plt.streamplot(x[:,0],y[0,:],u,v)#,density=density,linewidth=0.75,color='k')
        m.streamplot(y[0,:],x[:,0],u,v,density=density,linewidth=0.75,color='k')
        #m.quiver(x,y,u,v)
        
        if self.C.plot_titles:
            title = utils.string_from_time('title',self.t)
            plt.title(title)

        # SAVE FIGURE
        datestr = utils.string_from_time('output',self.t)
        lv_na = utils.get_level_naming(va,lv=lv)
        na = (va,lv_na,datestr)
        self.fname = self.create_fname(*na)
        # pdb.set_trace()
        self.save(fig,self.output_root,self.fname)
        plt.close()
Пример #4
0
    def plot_streamlines(self,va,lv,**kwargs):
        fig = plt.figure()

        # Scales, colourmaps in here

        # Get data
        u_all = self.get('U10',**kwargs)[:]
        v_all = self.get('V10',**kwargs)[:]

        u = self.cut_2D_array(u_all)
        v = self.cut_2D_array(v_all)
        m, x, y  = self.basemap_setup(**kwargs)
        """
        # Density depends on which version
        # Wanting to match 3 km WRF (which had 2.5 density)
        # Should work out dx, dy in __init__ method!

        WRF_density = 2.5
        WRF_res = 3.0

        if self.version == 3:
            RUC_res = 13.0

        density = WRF_density * RUC_res/WRF_res
        """
        density = 2.5

        #x = N.array(range(u.shape[0]))
        #y = N.array(range(v.shape[1]))

        #pdb.set_trace()
        #m.streamplot(x[self.x_dim/2,:],y[:,self.y_dim/2],u,v,density=density,linewidth=0.75,color='k')
        #m.streamplot(x[y.shape[1]/2,:],y[:,x.shape[0]/2],u,v,density=density,linewidth=0.75,color='k')
        #plt.streamplot(x[:,0],y[0,:],u,v)#,density=density,linewidth=0.75,color='k')
        m.streamplot(y[0,:],x[:,0],u,v,density=density,linewidth=0.75,color='k')
        #m.quiver(x,y,u,v)

        if self.C.plot_titles:
            title = utils.string_from_time('title',self.t)
            plt.title(title)

        # SAVE FIGURE
        datestr = utils.string_from_time('output',self.t)
        lv_na = utils.get_level_naming(va,lv=lv)
        na = (va,lv_na,datestr)
        self.fname = self.create_fname(*na)
        # pdb.set_trace()
        self.save(fig,self.output_root,self.fname)
        plt.close()