Пример #1
0
    def plotPhs(self, vname="eta", k=0, con="M2", phsunits="radians", xlims=None, ylims=None, **kwargs):
        """
        Plots the phase of the constituent on a map
        """
        ii = findCon(con, self.frqnames)

        if xlims == None or ylims == None:
            xlims = self.xlims
            ylims = self.ylims

        if len(self.Phs[vname].shape) == 2:
            zP = self.Phs[vname][ii, :]
        else:
            zP = self.Phs[vname][ii, k, :].ravel()

        if phsunits == "radians":
            clim = [0, 2 * np.pi]
            self.fig, self.ax, self.patches, self.cb = unsurf(self.xy, zP, xlim=xlims, ylim=ylims, clim=clim, **kwargs)

        elif phsunits == "degrees":
            clim = [0, 360.0]
            self.fig, self.ax, self.patches, self.cb = unsurf(
                self.xy, zP * 180 / np.pi, xlim=xlims, ylim=ylims, clim=clim, **kwargs
            )
Пример #2
0
    def plotPhs(self,vname='eta',k=0,con='M2',phsunits='radians',xlims=None,ylims=None,**kwargs):
        """
        Plots the phase of the constituent on a map
        """
        ii = findCon(con,self.frqnames)

        if xlims==None or ylims==None:
            xlims=self.xlims
            ylims=self.ylims

        if len(self.Phs[vname].shape)==2:
            zP = self.Phs[vname][ii,:]
        else:
            zP = self.Phs[vname][ii,k,:].ravel()

        if phsunits=='radians':
            clim = [0,2*np.pi]
            self.fig,self.ax,self.patches,self.cb=unsurf(self.xy,zP,xlim=xlims,ylim=ylims,\
                clim=clim,**kwargs)

        elif phsunits=='degrees':
            clim = [0,360.0]
            self.fig,self.ax,self.patches,self.cb=unsurf(self.xy,zP*180/np.pi,xlim=xlims,ylim=ylims,\
                clim=clim,**kwargs)
Пример #3
0
    def plotAmp(self, vname="eta", k=0, con="M2", xlims=None, ylims=None, barotropic=False, cbarpos=None, **kwargs):
        """
        Plots the amplitude of the constituent on a map

        vname: one of 'eta','ubar','vbar','uc','vc',...

        Set vname = 'ellmaj','ellmin','ellang','ellphs' to plot ellipse
        properties
        """
        ii = findCon(con, self.frqnames)

        if self.clim == None:
            self.clim = []
            self.clim.append(np.min(self.Amp))
            self.clim.append(np.max(self.Amp))
        if xlims == None or ylims == None:
            xlims = self.xlims
            ylims = self.ylims

        if vname in ["ellmaj", "ellmin", "ellang", "ellphs"]:
            ell = self.getEllipse(barotropic=barotropic, k=k, con=con)
            if vname == "ellmaj":
                zA = ell[0]
            elif vname == "ellmin":
                zA = ell[1]
            elif vname == "ellang":
                zA = ell[2]
            elif vname == "ellphs":
                zA = ell[3]

        elif len(self.Amp[vname].shape) == 2:
            zA = self.Amp[vname][ii, :]
        else:
            zA = self.Amp[vname][ii, k, :].ravel()

        self.fig, self.ax, self.patches, self.cb = unsurf(
            self.xy, zA, xlim=xlims, ylim=ylims, clim=self.clim, colorbar=False, **kwargs
        )

        # Add a decent looking colorbar
        if not cbarpos == None:
            cbaxes = self.fig.add_axes(cbarpos)
            cb = self.fig.colorbar(self.patches, cax=cbaxes, orientation="vertical")
            # cb.ax.set_title('[$m s^{-1}$]')

        plt.sca(self.ax)

        return self.patches
Пример #4
0
    def plotAmp(self,vname='eta',k=0,con='M2',xlims=None,ylims=None,\
        barotropic=False,cbarpos=None,**kwargs):
        """
        Plots the amplitude of the constituent on a map

        vname: one of 'eta','ubar','vbar','uc','vc',...

        Set vname = 'ellmaj','ellmin','ellang','ellphs' to plot ellipse
        properties
        """
        ii = findCon(con,self.frqnames)

        if self.clim==None:
            self.clim=[]
            self.clim.append(np.min(self.Amp))
            self.clim.append(np.max(self.Amp))
        if xlims==None or ylims==None:
            xlims=self.xlims
            ylims=self.ylims

        if vname in ['ellmaj','ellmin','ellang','ellphs']:
            ell=self.getEllipse(barotropic=barotropic,k=k,con=con)
            if vname=='ellmaj':
                zA=ell[0]
            elif vname=='ellmin':
                zA=ell[1]
            elif vname=='ellang':
                zA=ell[2]
            elif vname=='ellphs':
                zA=ell[3]

        elif len(self.Amp[vname].shape)==2:
            zA = self.Amp[vname][ii,:]
        else:
            zA = self.Amp[vname][ii,k,:].ravel()

        self.fig,self.ax,self.patches,self.cb=unsurf(self.xy,zA,xlim=xlims,ylim=ylims,\
                clim=self.clim,colorbar=False,**kwargs)

        # Add a decent looking colorbar
        if not cbarpos==None:
            cbaxes = self.fig.add_axes(cbarpos)
            cb = self.fig.colorbar(self.patches,cax = cbaxes,orientation='vertical')
            #cb.ax.set_title('[$m s^{-1}$]')

        plt.sca(self.ax)

        return self.patches
Пример #5
0
    def plotMean(self, vname="eta", k=0, xlims=None, ylims=None, **kwargs):
        """
        Plots the amplitude of the constituent on a map
        """

        if self.clim == None:
            self.clim = []
            self.clim.append(np.min(self.Mean))
            self.clim.append(np.max(self.Mean))
        if xlims == None or ylims == None:
            xlims = self.xlims
            ylims = self.ylims

        if len(self.Amp[vname].shape) == 2:
            zA = self.Mean[vname]
        else:
            zA = self.Mean[vname][k, :].ravel()

        self.fig, self.ax, self.patches, self.cb = unsurf(self.xy, zA, xlim=xlims, ylim=ylims, clim=self.clim, **kwargs)
Пример #6
0
    def plotMean(self,vname='eta',k=0,xlims=None,ylims=None,**kwargs):
        """
        Plots the amplitude of the constituent on a map
        """

        if self.clim==None:
            self.clim=[]
            self.clim.append(np.min(self.Mean))
            self.clim.append(np.max(self.Mean))
        if xlims==None or ylims==None:
            xlims=self.xlims
            ylims=self.ylims

        if len(self.Amp[vname].shape)==2:
            zA = self.Mean[vname]
        else:
            zA = self.Mean[vname][k,:].ravel()

        self.fig,self.ax,self.patches,self.cb=unsurf(self.xy,zA,xlim=xlims,ylim=ylims,\
                clim=self.clim,**kwargs)