Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
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)
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
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)
def plot(self,z,titlestr=None,**kwargs):
"""
Pcolor plot of the slice
"""
if self.clim==None:
self.clim=[]
self.clim.append(np.min(z))
self.clim.append(np.max(z))
# Set the xy limits
xlims=[self.distslice.min(),self.distslice.max()]
ylims=[-self.z_w.max(),-self.z_w.min()]
self.fig,self.ax,self.patches,self.cb=unsurf(self.xye,z.ravel(),xlim=xlims,ylim=ylims,\
clim=self.clim,**kwargs)
self.ax.set_aspect('auto')
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)