Changeset 549 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jul 1, 2015, 11:03:15 AM (9 years ago)
Author:
lfita
Message:

Adding in `draw_points':
[kindfigure]: kind of figure

'legend': only points in the map with the legend with the names
'labelled',[txtsize],[txtcol]: points with the names and size, color of text

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing.py

    r546 r549  
    2222## 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
    2323## 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'
    2626main = 'drawing.py'
    2727
     
    21862186def draw_points(filen, values):
    21872187    """ 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]
    21902190        [ptasciifile]:[file],[comchar],[collon],[collat],[lab]
    21912191          [file]: column ASCII file with the location of the points
     
    22062206             * 'h', high
    22072207             * '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
    22082211        [pointcolor]: color for the points ('auto' for "red")
    22092212        [pointlabels]: ',' of labels [only used if [collab]='None'] ('None' for no labels)
     
    22122215          5: 'right', 6: 'center left', 7: 'center right', 8: 'lower center',
    22132216          9: 'upper center', 10: 'center'
    2214         [figurek]: kind of figure
     2217        [figureko]: kind of the output file (pdf, png, ...)
    22152218        [figuren]: name of the figure
    22162219      [filen]= [ncfile],[lonvarn],[latvarn][,[varn],[dimvals],[vargn],[min],[max],[cbar],[varu]]
     
    22352238        quit()
    22362239
    2237     expectargs = '[ptasciifile]:[gtit]:[mapvalues]:[pointcolor]:[pointlabels]:' +    \
    2238       '[locleg]:[figurek]:[figuren]'
     2240    expectargs = '[ptasciifile]:[gtit]:[mapvalues]:[kindfigure]:[pointcolor]:' +     \
     2241      '[pointlabels]:[locleg]:[figurek]:[figuren]'
    22392242 
    22402243    drw.check_arguments(fname,len(expectargs.split(':')),values,':',                 \
     
    22442247    gtit = values.split(':')[1]
    22452248    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]
    22512255
    22522256# Getting station locations
     
    23362340
    23372341    drw.plot_points(xptval, yptval, lonv, latv, varextra, varextrav, gtit, mapvalues,\
    2338       pointcolor, ptlabels, locleg, figurek, figuren)
     2342      kindfigure, pointcolor, ptlabels, locleg, figureko, figuren)
    23392343
    23402344    onc.close()
  • trunk/tools/drawing_tools.py

    r545 r549  
    25372537#quit()
    25382538
    2539 def plot_points(xval, yval, vlon, vlat, extravals, extrapar, vtit, mapv, color,      \
     2539def plot_points(xval, yval, vlon, vlat, extravals, extrapar, vtit, mapv, figk, color,\
    25402540  labels, lloc, kfig, figname):
    25412541    """ plotting points
     
    25572557          * 'h', high
    25582558          * '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
    25592562      color= color for the points/labels ('auto', for "red")
    25602563      labels= list of labels for the points (None, no labels)
     
    26372640    if labels is not None:
    26382641        for iv in range(len(xval)):
    2639 #            plt.annotate(labels[iv], xy=(xval[iv],yval[iv]), xycoords='data')
    2640 
    26412642            if np.mod(iv,7) == 0: N7pts = N7pts + 1
    26422643#            print iv,xval[iv],yval[iv],labels[iv],ptkinds[N7pts]
    2643 
    26442644            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)
    26462654
    26472655    else:
Note: See TracChangeset for help on using the changeset viewer.