Changeset 834 in lmdz_wrf for trunk


Ignore:
Timestamp:
Jun 16, 2016, 1:28:33 PM (8 years ago)
Author:
lfita
Message:

Adding:

  • `basinwidth': with of the lines of the basin
  • Avoiding too clear colors (all rgb >= 0.95) , by lookingt the largest and keeping the rest as 0.9
  • New definition of figure size by means of sign and lengthtrack
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing_tools.py

    r827 r834  
    69406940    return
    69416941
    6942 def plot_subbasin(subname, lons, lats, rsf, rLlf, rof, rcolors, mapv, drawsubid,     \
    6943   graphtit, kfig, lloc, figname):
     6942def plot_subbasin(subname, lons, lats, rsf, rLlf, rof, rcolors, mapv, basinwidth,    \
     6943  drawsubid, graphtit, kfig, lloc, figname):
    69446944    """ Function to plot rivers from 'river_desc.nc' ORCDHIEE
    69456945      subname= name of the subbasin
     
    69616961          * 'h', high
    69626962          * 'f', full
     6963      basinwidth = with of the lines of the basin
    69636964      drawsubid= wehther sub-flow ids should be plot or not
    69646965      graphtit= title of the graph ('|', for spaces)
     
    70047005# All the colors should finish white...
    70057006    endcol = [1., 1., 1.]
     7007#    endcol = [0.9, 0.9, 0.9]
    70067008    colorsub = {}
    70077009    xlabpos = []
     
    70227024# We do not want a last white value...
    70237025            if Nlevs < subhr.Nlevs:
    7024                 maxNcol = subhr.xlevs[ilev]
     7026                maxNcol = subhr.xlevs[ilev]+1
    70257027            else:
    70267028                maxNcol = subhr.xlevs[ilev]+1
     
    70297031
    70307032        colorsub[isub] = tuple(begcol)
     7033# Avoiding too clear colors
     7034        cols = colorsub[isub]
     7035        if (cols[0] >= 0.95)*(cols[1] >= 0.95)*(cols[2] >= 0.95):
     7036            print warnmsg
     7037            print '  ' + fname + ': avoiding to clear color:', colorsub[isub], '!!'
     7038            maxcol = np.max(cols)
     7039            imaxcol = gen.index_vec(cols, maxcol)
     7040            clear = np.ones((3), dtype=np.float)*0.9
     7041            clear[imaxcol] = 0.95
     7042            print '    keeping it clear:', clear
     7043            colorsub[isub] = tuple(clear)
     7044
    70317045        Llfs = rLlf[isub]
    70327046        outfs = rof[isub]
     
    70567070            ytrack.append(None)
    70577071            colortrack.append(colorsub[isub])
     7072
    70587073        xlabpos.append(ibeg)
    70597074        ylabpos.append(jbeg)
     
    70707085
    70717086# Making bigger the area to map
    7072     nlon = nlon-dlon-lengthtrac2
    7073     xlon = xlon+dlon+lengthtrac2
    7074     nlat = nlat-dlat-lengthtrac2
    7075     xlat = xlat+dlat+lengthtrac2
     7087#    nlon = nlon-dlon-lengthtrac2
     7088#    xlon = xlon+dlon+lengthtrac2
     7089#    nlat = nlat-dlat-lengthtrac2
     7090#    xlat = xlat+dlat+lengthtrac2
     7091    nlon = nlon-2.*lengthtrac*dlon/np.abs(dlon)
     7092    xlon = xlon+2.*lengthtrac*dlon/np.abs(dlon)
     7093    nlat = nlat-2.*lengthtrac*dlat/np.abs(dlat)
     7094    xlat = xlat+2.*lengthtrac*dlat/np.abs(dlat)
    70767095
    70777096    plt.xlim(nlon,xlon)
     
    71167135    j = 0
    71177136    for i in range(len(xtrack)/3):
    7118         plt.plot(xtrack[j:j+2], ytrack[j:j+2], color=colortrack[i])
     7137        plt.plot(xtrack[j:j+2], ytrack[j:j+2], color=colortrack[i], linewidth=basinwidth)
    71197138        j = j + 3
    71207139
     
    71307149    if drawsubid:
    71317150        for i in range(len(xlabpos)):
    7132             print ' Lluis:', rsf[i], ':', colorsub[rsf[i]]
    71337151            plt.text(xlabpos[i]+0.05*lengthtrac, ylabpos[i]+0.05*lengthtrac, rsf[i], \
    71347152              color=colorsub[rsf[i]], fontdict=fontcharac)
Note: See TracChangeset for help on using the changeset viewer.