- Timestamp:
- Jun 16, 2016, 1:28:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing_tools.py
r827 r834 6940 6940 return 6941 6941 6942 def plot_subbasin(subname, lons, lats, rsf, rLlf, rof, rcolors, mapv, drawsubid,\6943 graphtit, kfig, lloc, figname):6942 def plot_subbasin(subname, lons, lats, rsf, rLlf, rof, rcolors, mapv, basinwidth, \ 6943 drawsubid, graphtit, kfig, lloc, figname): 6944 6944 """ Function to plot rivers from 'river_desc.nc' ORCDHIEE 6945 6945 subname= name of the subbasin … … 6961 6961 * 'h', high 6962 6962 * 'f', full 6963 basinwidth = with of the lines of the basin 6963 6964 drawsubid= wehther sub-flow ids should be plot or not 6964 6965 graphtit= title of the graph ('|', for spaces) … … 7004 7005 # All the colors should finish white... 7005 7006 endcol = [1., 1., 1.] 7007 # endcol = [0.9, 0.9, 0.9] 7006 7008 colorsub = {} 7007 7009 xlabpos = [] … … 7022 7024 # We do not want a last white value... 7023 7025 if Nlevs < subhr.Nlevs: 7024 maxNcol = subhr.xlevs[ilev] 7026 maxNcol = subhr.xlevs[ilev]+1 7025 7027 else: 7026 7028 maxNcol = subhr.xlevs[ilev]+1 … … 7029 7031 7030 7032 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 7031 7045 Llfs = rLlf[isub] 7032 7046 outfs = rof[isub] … … 7056 7070 ytrack.append(None) 7057 7071 colortrack.append(colorsub[isub]) 7072 7058 7073 xlabpos.append(ibeg) 7059 7074 ylabpos.append(jbeg) … … 7070 7085 7071 7086 # 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) 7076 7095 7077 7096 plt.xlim(nlon,xlon) … … 7116 7135 j = 0 7117 7136 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) 7119 7138 j = j + 3 7120 7139 … … 7130 7149 if drawsubid: 7131 7150 for i in range(len(xlabpos)): 7132 print ' Lluis:', rsf[i], ':', colorsub[rsf[i]]7133 7151 plt.text(xlabpos[i]+0.05*lengthtrac, ylabpos[i]+0.05*lengthtrac, rsf[i], \ 7134 7152 color=colorsub[rsf[i]], fontdict=fontcharac)
Note: See TracChangeset
for help on using the changeset viewer.