Changeset 251
- Timestamp:
- Aug 2, 2011, 1:45:34 AM (13 years ago)
- Location:
- trunk/MESOSCALE_DEV/PLOT/PYTHON/scripts
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MESOSCALE_DEV/PLOT/PYTHON/scripts/winds.py
r247 r251 40 40 from myplot import getcoord2d,define_proj,makeplotres,simplinterv,vectorfield,ptitle,latinterv,getproj,wrfinterv,dumpbdy,\ 41 41 fmtvar,definecolorvec,defcolorb,getprefix,putpoints,calculate_bounds,errormess,definesubplot,\ 42 zoomset,getcoorddef,getwinddef,whatkindfile,reducefield,bounds,getstralt,getfield,smooth,nolow 42 zoomset,getcoorddef,getwinddef,whatkindfile,reducefield,bounds,getstralt,getfield,smooth,nolow,\ 43 getname,localtime,polarinterv 43 44 from mymath import deg,max,min,mean 44 45 from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show … … 60 61 [uchar,vchar,metwind] = getwinddef(nc) 61 62 if uchar == 'not found': winds = False 63 if not var and not winds: errormess("please set at least winds or var",printvar=nc.variables) 62 64 [lon2d,lat2d] = getcoorddef(nc) ## COORDINATES, could be moved below 63 65 if proj == None: proj = getproj(nc) ## PROJECTION … … 65 67 ########################## 66 68 ### Define plot boundaries 67 if proj == "npstere": [wlon,wlat] = latinterv("North_Pole")68 elif proj == "spstere": [wlon,wlat] = latinterv("Far_South_Pole")69 ### todo: possible areas in latinterv in argument (ex: "Far_South_Pole") 70 if proj in ["npstere","spstere"]: [wlon,wlat] = polarinterv(lon2d,lat2d) 69 71 elif proj in ["lcc","laea"]: [wlon,wlat] = wrfinterv(lon2d,lat2d) 70 72 else: [wlon,wlat] = simplinterv(lon2d,lat2d) … … 73 75 ######################################### 74 76 ### Name for title and graphics save file 75 if var and winds: basename = var + '_UV' 76 elif var: basename = var 77 elif winds: basename = 'UV' 78 else: 79 print nc.variables 80 errormess("please set at least winds or var") 81 if anomaly: basename = 'd' + basename 77 basename = getname(var=var,winds=winds,anomaly=anomaly) 82 78 basename = basename + getstralt(nc,nvert) ## can be moved elsewhere for a more generic routine 83 79 … … 98 94 99 95 ### Which local time ? 100 #print interv[0], interv[1], itime 101 ltst = ( interv[0] + 0.5*(wlon[0]+wlon[1])/15.) + itime*interv[1] 102 ltst = int (ltst * 10) / 10. 103 ltst = ltst % 24 96 ltst = localtime ( interv[0]+itime*interv[1], 0.5*(wlon[0]+wlon[1]) ) 104 97 105 98 ### General plot settings … … 109 102 if numplot > 1: 110 103 if typefile not in ['geo']: subplot(sub+nplot-1) 111 112 104 found_lct = True 113 105 ### If only one local time is requested (numplot < 0) … … 157 149 vmin=zevmin, vmax=zevmax ) 158 150 if colorb != 'nobar' and var != 'HGT': 159 colorbar(fraction=0.05,pad=0. 1,format=fmtvar(fvar),\151 colorbar(fraction=0.05,pad=0.03,format=fmtvar(fvar),\ 160 152 ticks=np.linspace(zevmin,zevmax,ndiv+1),\ 161 153 extend='neither',spacing='proportional')
Note: See TracChangeset
for help on using the changeset viewer.