本文整理汇总了Python中matplotlib.pyplot.barbs函数的典型用法代码示例。如果您正苦于以下问题:Python barbs函数的具体用法?Python barbs怎么用?Python barbs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了barbs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: plot_sfwind
def plot_sfwind():
print(" 10M WIND")
# Set Figure Size (1000 x 800)
plt.figure(figsize=(width,height),frameon=False)
# Convert winds from m/s to kts and then draw barbs
u_wind_kts = u_wind_ms[time] * 1.94384449
v_wind_kts = v_wind_ms[time] * 1.94384449
windmag = np.power(np.power(u_wind_kts,2)+np.power(v_wind_kts,2), 0.5)
WIND_LEVS = range(10,46,2)
W=plt.contourf(x,y,windmag,WIND_LEVS,extend='max')
plt.barbs(x_th,y_th,u_wind_kts[::thin,::thin],\
v_wind_kts[::thin,::thin], length=5,\
sizes={'spacing':0.2},pivot='middle')
# Convert Surface Pressure to Mean Sea Level Pressure
stemps = temps[time]+6.5*nc.variables['HGT'][time]/1000.
mslp = nc.variables['PSFC'][time]*np.exp(9.81/(287.0*stemps)*nc.variables['HGT'][time])*0.01 + (6.7 * nc.variables['HGT'][time] / 1000)
# Contour the pressure
#PLEVS = range(900,1050,5)
#P=plt.contour(x,y,mslp,PLEVS,V=2,colors='k',linewidths=1.5)
#plt.clabel(P,inline=1,fontsize=8,fmt='%1.0f',inline_spacing=1)
title = 'Sfc MSLP (mb), 10m Wind (kts)'
prodid = 'wind'
units = "kts"
drawmap(W, title, prodid, units)
开发者ID:lmadaus,项目名称:old_wrf_plotting_scripts,代码行数:34,代码来源:plot_wrf_maps.py
示例2: mapWind
def mapWind(nest, time):
"""Creates a map of the domain, showing
wind barbs for the given time
"""
nc = openWRF(nest)
nc1 = openWRF(nest + 1)
Nx, Ny, _Nz, longitude, latitude, _dx, _dy, _x, _y = getDimensions(nc)
m = _getMapForNC(nc, False, _getDL(nest), 100)
_makeDots(m)
u10 = nc.variables["U10"][time, :, :]
v10 = nc.variables["V10"][time, :, :]
# Use data from every 10th grid point
windx = 1 + Nx / 10
windy = 1 + Ny / 10
lat10 = np.zeros((windy, windx))
lon10 = np.zeros((windy, windx))
uwind = np.zeros((windy, windx))
vwind = np.zeros((windy, windx))
for j in range(windy):
for i in range(windx):
uwind[j, i] = 0.5 * (u10[j * 10, i * 10] + u10[j * 10, i * 10 + 1])
# print 'u: ' + str(uwind[j,i])
vwind[j, i] = 0.5 * (v10[j * 10, i * 10] + v10[j * 10 + 1, i * 10])
# print 'v: ' + str(vwind[j,i])
lat10[j, i] = latitude[j * 10, i * 10]
lon10[j, i] = longitude[j * 10, i * 10]
x10, y10 = m(lon10, lat10)
plt.barbs(x10, y10, uwind, vwind, barb_increments=barb_increments, linewidth=1.0, color="green")
if nc1 is not None:
_plotBorder(nc1, m, "black")
plt.show()
plt.close()
开发者ID:johnrobertlawson,项目名称:oldcrapscripts,代码行数:34,代码来源:mapWRF.py
示例3: plot_srhel
def plot_srhel():
print(" SR Helicity")
# Set Figure Size (1000 x 800)
plt.figure(figsize=(width,height),frameon=False)
P = nc.variables['P']
PB = nc.variables['PB']
UU = nc.variables['U']
VV = nc.variables['V']
PH = nc.variables['PH']
PHB = nc.variables['PHB']
# Need pressures, temps and mixing ratios
PR = P[time] + PB[time]
PHT = np.add(PH[time],PHB[time])
ZH = np.divide(PHT, 9.81)
U = UU[time]
V = VV[time]
for j in range(len(U[1,:,1])):
curcol_c = []
curcol_Umo = []
curcol_Vmo = []
for i in range(len(V[1,1,:])):
sparms = severe.SRHEL_CALC(U[:,j,i], V[:,j,i], ZH[:,j,i], PR[:,j,i])
curcol_c.append(sparms[0])
curcol_Umo.append(sparms[1])
curcol_Vmo.append(sparms[2])
np_curcol_c = np.array(curcol_c)
np_curcol_Umo = np.array(curcol_Umo)
np_curcol_Vmo = np.array(curcol_Vmo)
if j == 0:
srhel = np_curcol_c
U_srm = np_curcol_Umo
V_srm = np_curcol_Vmo
else:
srhel = np.row_stack((srhel, np_curcol_c))
U_srm = np.row_stack((U_srm, np_curcol_Umo))
V_srm = np.row_stack((V_srm, np_curcol_Vmo))
#print " SRHEL: ", np.shape(srhel)
# Now plot
SRHEL_LEVS = range(50,800,50)
srhel = np.nan_to_num(srhel)
SRHEL=plt.contourf(x,y,srhel,SRHEL_LEVS)
u_mo_kts = U_srm * 1.94384449
v_mo_kts = V_srm * 1.94384449
plt.barbs(x_th,y_th,u_mo_kts[::thin,::thin],\
v_mo_kts[::thin,::thin], length=5,\
sizes={'spacing':0.2},pivot='middle')
title = '0-3 km SRHelicity, Storm Motion (kt)'
prodid = 'hlcy'
units = "m" + u'\u00B2' + '/s' + u'\u00B2'
drawmap(SRHEL, title, prodid, units)
开发者ID:lmadaus,项目名称:old_wrf_plotting_scripts,代码行数:58,代码来源:plot_wrf_maps.py
示例4: windbarbs
def windbarbs(self,nc,time,y,x,P,thin_locs,n=45.0,color='black'):
uwind = 0.5*(nc.variables['U'][time,:,y,x]+nc.variables['U'][time,:,y,x+1])
vwind = 0.5*(nc.variables['V'][time,:,y,x]+nc.variables['V'][time,:,y+1,x])
zmax = len(uwind[thin_locs])
delta = 1
baraxis = [n for _j in range(0,zmax,delta)]
# pdb.set_trace()
plt.barbs(baraxis,P[thin_locs],uwind[thin_locs],vwind[thin_locs],
barb_increments=self.barb_increments, linewidth = .75,color=color)
开发者ID:nishadhka,项目名称:WEM,代码行数:9,代码来源:skewt.py
示例5: plot_vector_barbs
def plot_vector_barbs(velocity_radial_f, azimuth, ranges, r, e, u, v):
ran, theta = np.meshgrid(ranges[r], azimuth[e,:])
plt.figure()
plt.subplot(111, polar=True)
plt.barbs(u[e,:,r], v[e,:,r], ran, theta)
plt.show()
#plt.savefig('Radar_Qxb_Band_S - Barbs ({:.2f} km Range) ME.png'.format((r*1498)/1000.), format='png')
plt.close()
开发者ID:mikhailpedrosa,项目名称:radar_wind,代码行数:10,代码来源:graphical.py
示例6: windbarbs_real
def windbarbs_real(self,uwind,vwind,P,delta=3,color='red',n=37.5):
# Is wind in kt or m/s? .... uwind*
those = N.where(uwind==-9999) # Find nonsense values
uwind = N.delete(uwind,those)
vwind = N.delete(vwind,those)
P = N.delete(P,those)
zmax = len(uwind)
# n is x-ax position on skewT for barbs.
baraxis = [n for _j in range(0,zmax,delta)]
plt.barbs(baraxis,P[0:zmax:delta],uwind[0:zmax:delta],vwind[0:zmax:delta],
barb_increments=self.barb_increments, linewidth = .75, barbcolor = color, flagcolor = color)
开发者ID:nishadhka,项目名称:WEM,代码行数:11,代码来源:skewt.py
示例7: test_barb_limits
def test_barb_limits():
ax = plt.axes()
x = np.linspace(-5, 10, 20)
y = np.linspace(-2, 4, 10)
y, x = np.meshgrid(y, x)
trans = mtransforms.Affine2D().translate(25, 32) + ax.transData
plt.barbs(x, y, np.sin(x), np.cos(y), transform=trans)
# The calculated bounds are approximately the bounds of the original data,
# this is because the entire path is taken into account when updating the
# datalim.
assert_array_almost_equal(ax.dataLim.bounds, (20, 30, 15, 6), decimal=1)
开发者ID:ykwon0407,项目名称:cs231_2015,代码行数:11,代码来源:test_collections.py
示例8: plot_vector_barbs
def plot_vector_barbs(radar, r, u, v):
azimuth = radar.azimuth['data'].reshape(10,360)
rang = radar.range['data']
velocity_radial = radar.fields['velocity']['data'].reshape(10,360,253)
theta, ran = np.meshgrid(azimuth[3,:], rang[r])
plt.figure()
plt.subplot(111, polar=True)
plt.barbs(theta, ran, u[3,:,r], v[3,:,r], velocity_radial[3,:,r])
plt.show()
#plt.savefig('Radar_Qxb_Band_S - Barbs ({:.2f} km Range).png'.format((r*1490)/1000.), format='png')
plt.close()
开发者ID:mikhailpedrosa,项目名称:radar_wind-field,代码行数:13,代码来源:graphical.py
示例9: _windbarbs
def _windbarbs(nc, time, y, x, P, thin_locs, n=45.0, color="black"):
uwind = 0.5 * (nc.variables["U"][time, :, y, x] + nc.variables["U"][time, :, y, x + 1])
vwind = 0.5 * (nc.variables["V"][time, :, y, x] + nc.variables["V"][time, :, y + 1, x])
zmax = len(uwind[thin_locs])
delta = 1
baraxis = [n for _j in range(0, zmax, delta)]
plt.barbs(
baraxis,
P[thin_locs],
uwind[thin_locs],
vwind[thin_locs],
barb_increments=barb_increments,
linewidth=0.75,
color=color,
)
开发者ID:johnrobertlawson,项目名称:oldcrapscripts,代码行数:15,代码来源:skewT.py
示例10: _make_barb
def _make_barb(self, temperature, theta, speed, angle):
"""Add the barb to the plot at the specified location."""
u, v = self._uv(speed, angle)
if 0 < speed < _BARB_BINS[0]:
# Plot the missing barbless 1-2 knots line.
length = self._kwargs['length']
pivot_points = dict(tip=0.0, middle=-length / 2.)
pivot = self._kwargs.get('pivot', 'tip')
offset = pivot_points[pivot]
verts = [(0.0, offset), (0.0, length + offset)]
rangle = math.radians(-angle)
verts = mtransforms.Affine2D().rotate(rangle).transform(verts)
codes = [Path.MOVETO, Path.LINETO]
path = Path(verts, codes)
size = length ** 2 / 4
xy = np.array([[temperature, theta]])
barb = PathCollection([path], (size,), offsets=xy,
transOffset=self._transform,
**self._custom_kwargs)
barb.set_transform(mtransforms.IdentityTransform())
self.axes.add_collection(barb)
else:
barb = plt.barbs(temperature, theta, u, v,
transform=self._transform, **self._kwargs)
return barb
开发者ID:SciTools,项目名称:tephi,代码行数:25,代码来源:isopleths.py
示例11: plot_dwp
def plot_dwp():
print " DEWPOINT"
# Set Figure Size (1000 x 800)
plt.figure(figsize=(width,height),frameon=False)
qhum = nc.variables['Q2']
# Convert Surface Pressure to Mean Sea Level Pressure
stemps = temps[time]+6.5*nc.variables['HGT'][time]/1000.
mslp = psfc[time]*np.exp(9.81/(287.0*stemps)*nc.variables['HGT'][time])*0.01
# Find saturation vapor pressure
es = 6.112 * np.exp(17.67 * temps[time]/(temps[time] + 243.5))
w = qhum[time]/(1-qhum[time])
e = (w * psfc[time] / (.622 + w)) / 100
Td_C = (243.5 * np.log(e/6.112))/(17.67-np.log(e/6.112))
Td_F = (Td_C * 9 / 5) + 32
DP_LEVS = range(-10,85,1)
DP_CLEVS = range(40,90,10)
# Contour and fill the dewpoint temperature
Td=plt.contourf(x,y,Td_F,DP_LEVS,cmap=coltbls.dewpoint1(),extend='min')
Td_lev = plt.contour(x,y,Td_F,DP_CLEVS,colors='k',linewidths=.5)
plt.clabel(Td_lev,inline=1,fontsize=7,fmt='%1.0f',inline_spacing=1)
# Contour the pressure
# P=plt.contour(x,y,mslp,V=2,colors='k',linewidths=1.5)
# plt.clabel(P,inline=1,fontsize=8,fmt='%1.0f',inline_spacing=1)
#plt.clabel(T,inline=1,fontsize=10)
# Convert winds from m/s to kts and then draw barbs
u_wind_kts = u_wind_ms[time] * 1.94384449
v_wind_kts = v_wind_ms[time] * 1.94384449
plt.barbs(x_th,y_th,u_wind_kts[::thin,::thin],\
v_wind_kts[::thin,::thin], length=5,\
sizes={'spacing':0.2},pivot='middle')
title = 'Surface Dwp, 10m Wind (kts)'
prodid = 'dewp'
units = u"\u00B0" + "F"
drawmap(Td, title, prodid, units)
开发者ID:lmadaus,项目名称:old_wrf_plotting_scripts,代码行数:44,代码来源:plot_wrf_maps.py
示例12: plot_thte
def plot_thte():
"""Plot surface theta-e map"""
print " THETA-E"
plt.figure(figsize=(width,height),frameon=False)
qhum = nc.variables['Q2']
thte = (temps[time] + qhum[time] * 2500000.0/1004.0) * (100000/psfc[time]) ** (287.0/1004.0)
THTE_LEVS = range(270,360,5)
THTE = plt.contourf(x,y,thte,THTE_LEVS,cmap=coltbls.thetae(),extend='max')
u_wind_kts = u_wind_ms[time] * 1.94384449
v_wind_kts = v_wind_ms[time] * 1.94384449
plt.barbs(x_th,y_th,u_wind_kts[::thin,::thin],\
v_wind_kts[::thin,::thin], length=5,\
sizes={'spacing':0.2},pivot='middle')
title = 'Theta-e, 10 m Wind (kt)'
prodid = 'thte'
units = 'K'
drawmap(THTE, title, prodid, units)
开发者ID:lmadaus,项目名称:old_wrf_plotting_scripts,代码行数:21,代码来源:plot_wrf_maps.py
示例13: plot_surface
def plot_surface():
print(" SURFACE")
# Set Figure Size (1000 x 800)
plt.figure(figsize=(width,height),frameon=False)
# Convert Surface Pressure to Mean Sea Level Pressure
stemps = temps[time]+6.5*nc.variables['HGT'][time]/1000.
mslp = nc.variables['PSFC'][time]*np.exp(9.81/(287.0*stemps)*nc.variables['HGT'][time])*0.01 + (6.7 * nc.variables['HGT'][time] / 1000)
# Convert Celsius Temps to Fahrenheit
ftemps = (9./5.)*(temps[time]-273) + 32
T_LEVS = range(-10,125,5)
# Contour and fill the temperature
T=plt.contourf(x,y,ftemps,T_LEVS,cmap=coltbls.sftemp())
# Contour the pressure
P=plt.contour(x,y,mslp,V=2,colors='k',linewidths=1.5)
plt.clabel(P,inline=1,fontsize=8,fmt='%1.0f',inline_spacing=1)
#plt.clabel(T,inline=1,fontsize=10)
# Convert winds from m/s to kts and then draw barbs
u_wind_kts = u_wind_ms[time] * 1.94384449
v_wind_kts = v_wind_ms[time] * 1.94384449
plt.barbs(x_th,y_th,u_wind_kts[::thin,::thin],\
v_wind_kts[::thin,::thin], length=5,\
sizes={'spacing':0.2},pivot='middle')
title = 'Sfc Temp, MSLP (mb), 10m Wind (kts)'
prodid = 'pmsl'
units = u"\u00B0" + "F"
drawmap(T, title, prodid, units)
开发者ID:lmadaus,项目名称:old_wrf_plotting_scripts,代码行数:37,代码来源:plot_wrf_maps.py
示例14: Fill
## W-Component vertical Wind Contour Fill (colored)
plt.contourf(x,y,masked_W,cmap='bwr',levels=np.arange(-5,5.1,.5),extend='both')
cbar_loc = plt.colorbar(shrink=.8,ticks= np.arange(-5,5.1,1))
cbar_loc.ax.set_ylabel('Vertical Velocity Wind on model level 7 (m/s)\n Approx. '+str(int(center_valley_height))+' meters',fontsize=20)
cbar_loc.ax.tick_params(labelsize=20)
## Contour Lake Outline
plt.contour(x,y,landmask, [0,1], linewidths=3, colors="b")
#plt.contour(x,y,HGT)
#plt.contourf(x,y,HGT,cmap=cmapgrey) # transparent greay if plotted on top
## Wind Barbs surface
plt.barbs(x[::3,::3],y[::3,::3],masked_U10[::3,::3],masked_V10[::3,::3],
length=6,
barb_increments=dict(half=1, full=2, flag=10),
sizes=dict(emptybarb=.1),
zorder=40)
plt.title('Surface wind barbs with \n vertical velocity on model level 7 (~2300 m)')
else:
## W-Component vertical Wind Contour Fill (colored)
plt.contourf(x,y,masked_W,cmap='bwr',levels=np.arange(-5,5.1,.5),extend='both')
cbar_loc = plt.colorbar(shrink=.8,ticks= np.arange(-5,5.1,1))
cbar_loc.ax.set_ylabel('Vertical Velocity Wind on model level '+str(model_level)+' (m/s)\n Approx. '+str(int(center_valley_height))+' meters',fontsize=20)
cbar_loc.ax.tick_params(labelsize=20)
## Contour Lake Outline
plt.contour(x,y,landmask, [0,1], linewidths=3, colors="b")
#plt.contour(x,y,HGT)
开发者ID:LeiNate-ZHU,项目名称:Ute_WRF,代码行数:31,代码来源:plot_barbs_W.py
示例15: Temperature
# Total Irradiance
dataTi=dataKis+dataKil
#====== Plot Temperature
plt.subplot(2,2,1)
plt.title('Surface Temperature (K)')
# contour land
CL1=plt.contour(lons,lats,dataLand,levels=[0],colors = 'k')
# contour Temperature
CT1=plt.contourf(lons,lats,dataT2m,cmap=get_cmap('BuRd'))# filed contour
plt.colorbar(CT1)
# wind barbs
Cwind1=plt.barbs(X,Y,U,V,length=Lbarbs, barbcolor=['k'],pivot='middle',sizes=dict(emptybarb=0))
#====== Plot Humidity
plt.subplot(2,2,2)
plt.title('Relative Humidity (%)')
# contour land
CL2=plt.contour(lons,lats,dataLand,levels=[0],colors = 'k')
# contour humidity
CH2=plt.contourf(lons,lats,dataH2m,cmap=get_cmap('Blues'))# contour line
plt.colorbar(CH2)
# wind barbs
Cwind2=plt.barbs(X,Y,U,V,length=Lbarbs, barbcolor=['k'],pivot='middle',sizes=dict(emptybarb=0))
#====== Plot Precipitation
开发者ID:TomCMM,项目名称:Arps,代码行数:31,代码来源:plot_gfs_grib.py
示例16: plot_wind_barbs
def plot_wind_barbs(axes, z, p, u, v):
for i in np.arange(0,len(z)):
if (p[i] > pt_plot):
plt.barbs(0,p[i],u[i],v[i], length=5, linewidth=.5)
开发者ID:JorgeGacitua,项目名称:pyMeteo,代码行数:4,代码来源:skewt.py
示例17:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-20, 20, 8)
y = np.linspace( 0, 20, 8)
# make 2D coordinates
X, Y = np.meshgrid(x, y)
U, V = X + 25, Y - 35
# plot the barbs
plt.subplot(1,2,1)
plt.barbs(X, Y, U, V, flagcolor='green', alpha=0.75)
plt.grid(True, color='gray')
# compare that with quiver / arrows
plt.subplot(1,2,2)
plt.quiver(X, Y, U, V, facecolor='red', alpha=0.75)
# misc settings
plt.grid(True, color='grey')
plt.show()
开发者ID:EricDoug,项目名称:python-data-viz-cookbook,代码行数:24,代码来源:ch08_rec02_barbsquivers.py
示例18: Speed
cbar_loc = plt.colorbar(shrink=.8,pad=.01,ticks= np.arange(-8,8.1,1),extend='both')
cbar_loc.ax.set_ylabel('Wind Speed (m/s)')
"""
# contourf
plt.contourf(x,y,masked_V10,cmap='BrBG',levels=np.arange(-8,8.1,.5),extend='both')
cbar_loc = plt.colorbar(shrink=.8,pad=.01,ticks= np.arange(-8,8.1,1))
cbar_loc.ax.set_ylabel('10-m V Wind (m/s)')
plt.contour(x,y,landmask, [0,1], linewidths=1, colors="b")
#plt.contour(x,y,HGT)
#plt.contourf(x,y,HGT,cmap=cmapgrey) # transparent greay if plotted on top
plt.barbs(x[::3,::3],y[::3,::3],masked_U10[::3,::3],masked_V10[::3,::3],
length=6,
barb_increments=dict(half=1, full=2, flag=10),
sizes=dict(emptybarb=.1))
plt.contour(x,y,masked_Q2,linewidths=2,levels=[1,2,3,4,5,6,7,8,9,10],cmap='PiYG')
cbar_WV = plt.colorbar(orientation='horizontal',shrink=.8,pad=.01,)
cbar_WV.ax.set_xlabel('2-m Water Vapor (g/kg)')
xs,ys = m(-111.97,40.78) #buffr sounding coordinates
#plt.scatter(xs,ys, s=70, c='w')
plt.title(time_str+'\n'+time_str_local, bbox=dict(facecolor='white', alpha=0.65),\
x=0.5,y=1.05,weight = 'demibold',style='oblique', \
stretch='normal', family='sans-serif')
plt.savefig(out_dir+'contour_V10_barbs_'+time_file+'.png',bbox_inches="tight")
开发者ID:LeiNate-ZHU,项目名称:Ute_WRF,代码行数:32,代码来源:plot_Wind_Q.py
示例19: plot_sounding
def plot_sounding(axes, z, th, p, qv, u = None, v = None):
"""Plot sounding data
This plots temperature, dewpoint and wind data on a Skew-T/Log-P plot.
This will also plot derived values such as wetbulb temperature and
label the surface based LCL, LFC and EL.
:parameter z: height values (1D array)
:parameter th: potential temperature at z heights (1D array)
:parameter p: pressure at z heights (1D array)
:parameter qv: water vapor mixing ratio at z heights (1D array)
:parameter u: U component of wind at z heights (1D array)
:parameter v: V component of wind at z heights (1D array)
:paramter axes: The axes instance to draw on
"""
# calculate Temperature and dewpoint
T = met.T(th,p) - met.T00 # T (C)
Td = met.Td(p, qv) - met.T00 # Td (C)
# calculate wetbulb temperature
Twb = np.empty(len(z), np.float32) # Twb (C)
for zlvl in range(len(z)):
Twb[zlvl] = met.Twb(z, p, th, qv, z[zlvl])
# Get surface parcel CAPE and temperature / height profiles
pcl = met.CAPE(z, p, T+met.T00, qv, 1) # CAPE
T_parcel = pcl['t_p'] - met.T00 # parcel T (C)
T_vparcel = pcl['tv_p'] - met.T00 # parcel Tv (C)
T_venv = met.T(pcl['thv_env'], pcl['pp']) - met.T00 # Env Tv (C)
# plot Temperature, dewpoint, wetbulb and lifted surface parcel profiles on skew axes
axes.semilogy(T + skew(p), p, basey=math.e, color=linecolor_T , linewidth = linewidth_T)
axes.semilogy(Td + skew(p), p, basey=math.e, color=linecolor_Td, linewidth = linewidth_Td)
axes.semilogy(T_parcel + skew(pcl['pp']), pcl['pp'], basey=math.e,
color=linecolor_Parcel_T, linewidth=linewidth_Parcel_T)
axes.semilogy(Twb + skew(p), p, basey=math.e, color=linecolor_Twb, linewidth=linewidth_Twb)
# plot virtual temperature of environment and lifted parcel
axes.semilogy(T_venv + skew(pcl['pp']), pcl['pp'], basey=math.e, color=linecolor_Tve,
linewidth=linewidth_Tve, linestyle=linestyle_Tve)
axes.semilogy(T_vparcel + skew(pcl['pp']), pcl['pp'], basey=math.e, color=linecolor_Tvp,
linewidth=linewidth_Tvp, linestyle=linestyle_Tvp)
# Add labels for levels based on surface parcel
#debug print(pcl['lfcprs'], pcl['lclprs'], pcl['elprs'], pcl['ptops'])
if (pcl['lfcprs'] > 0):
label_m(Tmax-.5, pcl['lfcprs'], '--LFC', axes)
if (pcl['lclprs'] > 0):
label_m(Tmax-.5, pcl['lclprs'], '--LCL', axes)
if (pcl['elprs'] > 0):
label_m(Tmax-.5, pcl['elprs'], '--EL', axes)
if (pcl['ptops'] > 0):
label_m(Tmax-.5, pcl['ptops'], '--TOPS', axes)
# plot labels for std heights
for plvl in plevs_std:
zlvl = pymeteo.interp.interp_height(z,p,plvl)
label_m(Tmin-.5,plvl, str(int(zlvl)), axes)
# plot wind barbs on left side of plot. move this? right side?
if (u is not None and v is not None):
#draw_wind_line(axes)
for i in np.arange(0,len(z),2):
if (p[i] > pt_plot):
plt.barbs(Tmin+4,p[i],u[i],v[i], length=5, linewidth=.5)
开发者ID:JorgeGacitua,项目名称:pyMeteo,代码行数:65,代码来源:skewt.py
示例20: knots
import numpy as np
# north-south speed
# we define speed of the wind from south to north
# in knots (nautical miles per hour)
V = [0, -5, -10, -15, -30, -40, -50, -60, -100]
# helper to coordinate size of other values with size of V vector
SIZE = len(V)
# east-west speed
# we define speed of the wind in east-west direction
# here, the "horizontal" speed component is 0
# our staff part of the wind barbs is vertical
U = np.zeros(SIZE)
# lon, lat
# we define linear distribution in horizontal manner
# of wind barbs, to spot increase in speed as we read figure from left to right
y = np.ones(SIZE)
x = [0, 5, 10, 15, 30, 40, 50, 60, 100]
# plot the barbs
plt.barbs(x, y, U, V, length=9)
# misc settings
plt.xticks(x)
plt.ylim(0.98, 1.05)
plt.show()
开发者ID:EricDoug,项目名称:python-data-viz-cookbook,代码行数:30,代码来源:ch08_rec01_windbarbs.py
注:本文中的matplotlib.pyplot.barbs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论