Changeset 782 in lmdz_wrf


Ignore:
Timestamp:
May 27, 2016, 6:36:50 PM (9 years ago)
Author:
lfita
Message:

Adding to check whether the country borders and the id of the basins should be drawn in `draw_basins'

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing.py

    r781 r782  
    33353335    """ Function to plot wind basins
    33363336      values= [lonlatbox]:[mapres]:[cbarname]:[xtrmbasin]:[mapdraw]:[veclength]:[freq]:
    3337         [ifreq]:[gtit]:[kindfig]:[figuren]
     3337        [ifreq]:[plotcountry]:[basinidn]:[gtit]:[kindfig]:[figuren]
    33383338        [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
    33433351      ncfile= file to use
    33443352    """
     
    33513359
    33523360    expectargs = '[lonlatbox]:[mapres]:[cbarname]:[xtrmbasin]:[mapdraw]:' +          \
    3353       '[veclength]:[freq]:[ifreq]:[gtit]:[kindfig]:[figuren]'
     3361      '[veclength]:[freq]:[plotcountry]:[basinidn]:[gtit]:[kindfig]:[figuren]'
    33543362 
    33553363    drw.check_arguments(fname,values,expectargs,':')
     
    33723380    minbasin = np.int(values.split(':')[3].split(',')[0])
    33733381    maxbasin = np.int(values.split(':')[3].split(',')[1])
    3374     mapdraw0 = gen.Str_Bool(values.split(':')[4])
     3382    mapdraw = gen.Str_Bool(values.split(':')[4])
    33753383    veclength = np.float(values.split(':')[5])
    33763384    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]
    33813390
    33823391    if freq0 == 'None': freq = None
     
    34043413      oflow[jmin:jmax,imin:imax], freq, cbarname+'@basin@-',                         \
    34053414      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)
    34073416
    34083417    ofile.close()
  • trunk/tools/drawing_tools.py

    r781 r782  
    62156215
    62166216def 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):
    62186218    """ Function to plot vectors
    62196219      xvals= values for the x-axis
     
    62406240          * 'h', high
    62416241          * 'f', full
     6242      drawcountry= whether country lines should be plotted or not
     6243      basinid= whether  basins id should be plotted or not
    62426244      graphtit= title of the graph ('|', for spaces)
    62436245      kfig= kind of figure
     
    63376339
    63386340        m.drawcoastlines()
     6341        drawcountry = True
     6342        if drawcountry: m.drawcountries()
    63396343
    63406344        meridians = pretty_int(nlon,xlon,5)
     
    63706374    cbar.set_label(vN + ' (' + units_lunits(vU) + ')')
    63716375
    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)
    63756380
    63766381# Sea-flow
Note: See TracChangeset for help on using the changeset viewer.