Changeset 549 in lmdz_wrf for trunk/tools
- Timestamp:
- Jul 1, 2015, 11:03:15 AM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r546 r549 22 22 ## e.g. # drawing.py -o draw_lines_time -f wrfout_d01_1980-03-01_00:00:00_Time_B0-E48-I1_south_north_B15-E15-I1_west_east_B15-E15-I1.nc -S 'time;y;time ([DD]${[HH]}$);file1;tas;evolution;time|hours!since!1949-12-01_00:00:00|exct,12,h|%d$^{%H}$;pdf' -v T2 23 23 ## e.g. # drawing.py -o draw_barbs -f ERAI_pl199501_131-132.nc -S 'X|lon|lon|-1,Y|lat|lat|-1,Z|lev|lev|4,T|time|time|0:auto,auto,auto:wind,ms-1:cyl,c:ERA-Interim|winds|at|1000|hPa|on|1996|January|1st|at|00|UTC:pdf:ERAI_pl199501_131-132' -v var131,var132 24 ## e.g. # python ~/etudes/WRF_LMDZ/svn/LMDZ_WRF/tools/drawing.py -o draw_points -S 'tslist.dat,#,3,2,1:SuperStorm|sfc|stations:cyl,i:auto:None:0:png:stations_loc' -f $HOME'/etudes/domains/WRFdynamicoSENS_SuperStorm/geo_em.d02.nc,XLONG_M,XLAT_M,HGT_M,Time|0,height,0.,3000.,terrain,m'25 24 ## e.g. # ~/etudes/WRF_LMDZ/svn/LMDZ_WRF/tools/drawing.py -o draw_points -S 'tslist.dat,#,3,2,1:SuperStorm|sfc|stations:cyl,i:legend:auto:None:0:png:stations_loc' -f $HOME'/etudes/domains/WRFdynamicoSENS_SuperStorm/geo_em.d02.nc,XLONG_M,XLAT_M,HGT_M,Time|0,height,0.,3000.,terrain,m' 25 ## e.g. # drawing.py -o draw_points -S 'tslist.dat,#,3,2,1:SuperStorm|sfc|stations:cyl,i:labelled,8,black:auto:None:0:png:stations_loc' -f $HOME'/etudes/domains/WRFdynamicoSENS_SuperStorm/geo_em_west_east_B25-E180-I1_south_north_B160-E262-I1.nc,XLONG_M,XLAT_M,HGT_M,Time|0,height,0.,1500.,terrain,m' 26 26 main = 'drawing.py' 27 27 … … 2186 2186 def draw_points(filen, values): 2187 2187 """ Function to plot a series of points 2188 [values]= [ptasciifile]:[gtit]:[mapvalues]:[ pointcolor]:[pointlabels]:[locleg]:2189 [ figurek]:[figuren]2188 [values]= [ptasciifile]:[gtit]:[mapvalues]:[kindfigure]:[pointcolor]:[pointlabels]: 2189 [locleg]:[figureko]:[figuren] 2190 2190 [ptasciifile]:[file],[comchar],[collon],[collat],[lab] 2191 2191 [file]: column ASCII file with the location of the points … … 2206 2206 * 'h', high 2207 2207 * 'f', full 2208 [kindfigure]: kind of figure 2209 'legend': only points in the map with the legend with the names 2210 'labelled',[txtsize],[txtcol]: points with the names and size, color of text 2208 2211 [pointcolor]: color for the points ('auto' for "red") 2209 2212 [pointlabels]: ',' of labels [only used if [collab]='None'] ('None' for no labels) … … 2212 2215 5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center', 2213 2216 9: 'upper center', 10: 'center' 2214 [figurek ]: kind of figure2217 [figureko]: kind of the output file (pdf, png, ...) 2215 2218 [figuren]: name of the figure 2216 2219 [filen]= [ncfile],[lonvarn],[latvarn][,[varn],[dimvals],[vargn],[min],[max],[cbar],[varu]] … … 2235 2238 quit() 2236 2239 2237 expectargs = '[ptasciifile]:[gtit]:[mapvalues]:[ pointcolor]:[pointlabels]:' +\2238 '[ locleg]:[figurek]:[figuren]'2240 expectargs = '[ptasciifile]:[gtit]:[mapvalues]:[kindfigure]:[pointcolor]:' + \ 2241 '[pointlabels]:[locleg]:[figurek]:[figuren]' 2239 2242 2240 2243 drw.check_arguments(fname,len(expectargs.split(':')),values,':', \ … … 2244 2247 gtit = values.split(':')[1] 2245 2248 mapvalues = values.split(':')[2] 2246 pointcolor = values.split(':')[3] 2247 pointlabels = values.split(':')[4] 2248 locleg = int(values.split(':')[5]) 2249 figurek = values.split(':')[6] 2250 figuren = values.split(':')[7] 2249 kindfigure = values.split(':')[3] 2250 pointcolor = values.split(':')[4] 2251 pointlabels = values.split(':')[5] 2252 locleg = int(values.split(':')[6]) 2253 figureko = values.split(':')[7] 2254 figuren = values.split(':')[8] 2251 2255 2252 2256 # Getting station locations … … 2336 2340 2337 2341 drw.plot_points(xptval, yptval, lonv, latv, varextra, varextrav, gtit, mapvalues,\ 2338 pointcolor, ptlabels, locleg, figurek, figuren)2342 kindfigure, pointcolor, ptlabels, locleg, figureko, figuren) 2339 2343 2340 2344 onc.close() -
trunk/tools/drawing_tools.py
r545 r549 2537 2537 #quit() 2538 2538 2539 def plot_points(xval, yval, vlon, vlat, extravals, extrapar, vtit, mapv, color,\2539 def plot_points(xval, yval, vlon, vlat, extravals, extrapar, vtit, mapv, figk, color,\ 2540 2540 labels, lloc, kfig, figname): 2541 2541 """ plotting points … … 2557 2557 * 'h', high 2558 2558 * 'f', full 2559 figK= kind of figure 2560 'legend': only points in the map with the legend with the names 2561 'labelled',[txtsize],[txtcol]: points with the names and size, color of text 2559 2562 color= color for the points/labels ('auto', for "red") 2560 2563 labels= list of labels for the points (None, no labels) … … 2637 2640 if labels is not None: 2638 2641 for iv in range(len(xval)): 2639 # plt.annotate(labels[iv], xy=(xval[iv],yval[iv]), xycoords='data')2640 2641 2642 if np.mod(iv,7) == 0: N7pts = N7pts + 1 2642 2643 # print iv,xval[iv],yval[iv],labels[iv],ptkinds[N7pts] 2643 2644 2644 plt.plot(xval[iv],yval[iv], ptkinds[N7pts],label=labels[iv]) 2645 plt.legend(loc=lloc) 2645 2646 if figk[0:8] == 'labelled': 2647 txtsize=int(figk.split(',')[1]) 2648 txtcol=figk.split(',')[2] 2649 for iv in range(len(xval)): 2650 plt.annotate(labels[iv], xy=(xval[iv],yval[iv]), xycoords='data', \ 2651 fontsize=txtsize, color=txtcol) 2652 elif figk == 'legend': 2653 plt.legend(loc=lloc) 2646 2654 2647 2655 else:
Note: See TracChangeset
for help on using the changeset viewer.