Changeset 1120 in lmdz_wrf


Ignore:
Timestamp:
Sep 30, 2016, 3:41:47 PM (9 years ago)
Author:
lfita
Message:

Adding `fmtcolorbar': format of the numbers in the color bar 'C'-like ('auto' for %6g) in 'draw_2D_shad'

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/tools/drawing.py

    r1119 r1120  
    5656    draw_2D_shad(ncfile, values, varn)
    5757      ncfile= file to use
    58       values=[vnamefs]:[dimvals]:[dimxvn]:[dimyvn]:[colorbar]:[sminv],[smaxv]:[figt]:
     58      values=[vnamefs]:[dimvals]:[dimxvn]:[dimyvn]:[colorbar]:[fmtcolorbar]:[sminv],[smaxv]:[figt]:
    5959       [kindfig]:[reverse]:[mapv]:[close]
    6060        [vnamefs]: Name in the figure of the variable to be shaded
     
    6262          variable a given value is required (-1, all the length)
    6363        [dimx/yvn]: name of the variables with the values of the final dimensions (x,y)
    64         [colorbar]: name of the color bar
     64        [colbarn]: name of the color bar
     65        [fmtcolorbar]: format of the numbers in the color bar 'C'-like ('auto' for %6g)
    6566        [smin/axv]: minimum and maximum value for the shading or:
    6667          'Srange': for full range
     
    100101        quit()
    101102
    102     expectargs = '[vnamefs]:[dimvals]:[dimxvn]:[dimyvn]:[colorbar]:[sminv],[smaxv]'+\
    103       ':[figt]:[kindfig]:[reverse]:[mapv]:[close]'
     103    expectargs = '[vnamefs]:[dimvals]:[dimxvn]:[dimyvn]:[colbarn]:[fmtcolorbar]:' +  \
     104      '[sminv],[smaxv]:[figt]:[kindfig]:[reverse]:[mapv]:[close]'
    104105 
    105106    drw.check_arguments(fname,values,expectargs,':')
     
    110111    vdimyn = values.split(':')[3]
    111112    colbarn = values.split(':')[4]
    112     shadminmax = values.split(':')[5]
    113     figtitle = values.split(':')[6].replace('|',' ')
    114     figkind = values.split(':')[7]
    115     revals = values.split(':')[8]
    116     mapvalue = values.split(':')[9]
    117     close = gen.Str_Bool(values.split(':')[10])
     113    fmtcolbar0 = values.split(':')[5]
     114    shadminmax = values.split(':')[6]
     115    figtitle = values.split(':')[7].replace('|',' ')
     116    figkind = values.split(':')[8]
     117    revals = values.split(':')[9]
     118    mapvalue = values.split(':')[10]
     119    close = gen.Str_Bool(values.split(':')[11])
    118120
    119121    ncfiles = ncfile
     
    222224    if mapvalue == 'None': mapvalue = None
    223225
     226    if fmtcolbar0 == 'auto':
     227        fmtcolorbar = '%6g'
     228    else:
     229        fmtcolorbar = fmtcolbar0
     230
    224231    drw.plot_2D_shadow(valshad, vnamesfig, odimxv, odimyv, odimxu, odimyu, dimnamesv,\
    225       colbarn, shading_nx, varunits, figtitle, figkind, revals, mapvalue, close)
     232      colbarn, fmtcolorbar, shading_nx, varunits, figtitle, figkind, revals,         \
     233      mapvalue, close)
    226234
    227235    return
  • TabularUnified trunk/tools/drawing_tools.py

    r1119 r1120  
    37773777
    37783778def plot_2D_shadow(varsv,vnames,dimxv,dimyv,dimxu,dimyu,dimn,          \
    3779   colorbar,vs,uts,vtit,kfig,reva,mapv,ifclose):
     3779  colorbar,cbarfmt,vs,uts,vtit,kfig,reva,mapv,ifclose):
    37803780    """ Adding labels and other staff to the graph
    37813781      varsv= 2D values to plot with shading
     
    37853785      dimn= dimension names to plot
    37863786      colorbar= name of the color bar to use
     3787      cbarfmt= format of the numbers in the colorbar
    37873788      vs= minmum and maximum values to plot in shadow or:
    37883789        'Srange': for full range
     
    40004001
    40014002    plt.pcolormesh(x, y, varsv, cmap=plt.get_cmap(colorbar), vmin=vsend[0], vmax=vsend[1])
    4002     cbar = plt.colorbar()
     4003    cbar = plt.colorbar(format=cbarfmt)
    40034004
    40044005    if not mapv is None:
Note: See TracChangeset for help on using the changeset viewer.