Changeset 782 in lmdz_wrf
- Timestamp:
- May 27, 2016, 6:36:50 PM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r781 r782 3335 3335 """ Function to plot wind basins 3336 3336 values= [lonlatbox]:[mapres]:[cbarname]:[xtrmbasin]:[mapdraw]:[veclength]:[freq]: 3337 [ifreq]:[ gtit]:[kindfig]:[figuren]3337 [ifreq]:[plotcountry]:[basinidn]:[gtit]:[kindfig]:[figuren] 3338 3338 [lonlatbox]= [lonSW],[lonNE],[latSW],[latNE] coordinates of the lon/lat box 3339 [xtrmbasin]= pminbasin],[maxbasin] 3340 gtit= title of the graph ('|', for spaces) 3341 kindfig= kind of figure 3342 figuren= name of the figure 3339 [mapres]= resolution of the mapping information 3340 [cbarname]= colorbar name for the colors 3341 [xtrmbasin]= [minbasin],[maxbasin] minimum and maximum basin numbers 3342 [mapdraw]= whether to draw the map (and project the data) or not ('True/False') 3343 [veclength]= length of the vectors of discharge at each grid cell 3344 [freq]= frequency of values allong each axis (None, all grid points; 3345 'auto', computed automatically to have 20 vectors along each axis) 3346 [plotcountry]= whether country lines should be plotted or not ('True/False') 3347 [plotbasinid]= whether id of the basins should be plotted or not ('True/False') 3348 [gtit]= title of the graph ('|', for spaces) 3349 [kindfig]= kind of figure 3350 [figuren]= name of the figure 3343 3351 ncfile= file to use 3344 3352 """ … … 3351 3359 3352 3360 expectargs = '[lonlatbox]:[mapres]:[cbarname]:[xtrmbasin]:[mapdraw]:' + \ 3353 '[veclength]:[freq]:[ ifreq]:[gtit]:[kindfig]:[figuren]'3361 '[veclength]:[freq]:[plotcountry]:[basinidn]:[gtit]:[kindfig]:[figuren]' 3354 3362 3355 3363 drw.check_arguments(fname,values,expectargs,':') … … 3372 3380 minbasin = np.int(values.split(':')[3].split(',')[0]) 3373 3381 maxbasin = np.int(values.split(':')[3].split(',')[1]) 3374 mapdraw 0= gen.Str_Bool(values.split(':')[4])3382 mapdraw = gen.Str_Bool(values.split(':')[4]) 3375 3383 veclength = np.float(values.split(':')[5]) 3376 3384 freq0 = values.split(':')[6] 3377 ifreq = int(values.split(':')[7]) 3378 gtit = values.split(':')[8].replace('|',' ') 3379 kindfig = values.split(':')[9] 3380 figuren = values.split(':')[10] 3385 plotcountry = gen.Str_Bool(values.split(':')[7]) 3386 plotbasinid = gen.Str_Bool(values.split(':')[8]) 3387 gtit = values.split(':')[9].replace('|',' ') 3388 kindfig = values.split(':')[10] 3389 figuren = values.split(':')[11] 3381 3390 3382 3391 if freq0 == 'None': freq = None … … 3404 3413 oflow[jmin:jmax,imin:imax], freq, cbarname+'@basin@-', \ 3405 3414 obasins[jmin:jmax,imin:imax], veclength, minbasin, maxbasin, 'outflow', '-', \ 3406 'cyl,'+map_res, gtit, kindfig, figuren)3415 'cyl,'+map_res, plotcountry, plotbasinid, gtit, kindfig, figuren) 3407 3416 3408 3417 ofile.close() -
trunk/tools/drawing_tools.py
r781 r782 6215 6215 6216 6216 def plot_basins(xvals,yvals,fvals,vecfreq,vecoln,veccolor,veclength,vcolmin,vcolmax,windn,wuts,\ 6217 mapv, graphtit,kfig,figname):6217 mapv,drawcountry,basinid,graphtit,kfig,figname): 6218 6218 """ Function to plot vectors 6219 6219 xvals= values for the x-axis … … 6240 6240 * 'h', high 6241 6241 * 'f', full 6242 drawcountry= whether country lines should be plotted or not 6243 basinid= whether basins id should be plotted or not 6242 6244 graphtit= title of the graph ('|', for spaces) 6243 6245 kfig= kind of figure … … 6337 6339 6338 6340 m.drawcoastlines() 6341 drawcountry = True 6342 if drawcountry: m.drawcountries() 6339 6343 6340 6344 meridians = pretty_int(nlon,xlon,5) … … 6370 6374 cbar.set_label(vN + ' (' + units_lunits(vU) + ')') 6371 6375 6372 for i in range(len(xlabpos)): 6373 plt.text(xlabpos[i]+0.5*ddx, ylabpos[i]+0.95*ddy, labels[i], \ 6374 color=labcol[i], fontdict=fontcharac) 6376 if basinid: 6377 for i in range(len(xlabpos)): 6378 plt.text(xlabpos[i]+0.5*ddx, ylabpos[i]+0.95*ddy, labels[i], \ 6379 color=labcol[i], fontdict=fontcharac) 6375 6380 6376 6381 # Sea-flow
Note: See TracChangeset
for help on using the changeset viewer.