Changeset 679 in lmdz_wrf
- Timestamp:
- Jan 21, 2016, 11:05:39 AM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r678 r679 1813 1813 ncfilens= [filen] ',' separated list of netCDF files 1814 1814 values= [dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];[timevals];[locleg]; 1815 [graphk];[collines];[points];[p eriod]1815 [graphk];[collines];[points];[pointfreq];[period] 1816 1816 [dimvname]: ',' list of names of the variables with he values of the common dimension 1817 1817 [valuesaxis]: which axis will be used for the values ('x', or 'y') … … 1840 1840 [points]: ',' list of type of points for the lines, None for automatic, single 1841 1841 value all the same 1842 [pointfreq]: frequency of point plotting, 'all' for all time steps 1842 1843 [period]: which period to plot 1843 1844 '-1': all period … … 1856 1857 expectargs = '[dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];' 1857 1858 expectargs = expectargs + '[timevals];[locleg];[graphk];[collines];[points];' 1858 expectargs = expectargs + '[p eriod]'1859 expectargs = expectargs + '[pointfreq];[period]' 1859 1860 drw.check_arguments(fname,len(expectargs.split(';')),values,';',expectargs) 1860 1861 … … 1871 1872 collines0 = values.split(';')[9] 1872 1873 points0 = values.split(';')[10] 1873 period = values.split(';')[11] 1874 pointfreq0 = values.split(';')[11] 1875 period = values.split(';')[12] 1874 1876 1875 1877 Nfiles = len(ncfiles) … … 2043 2045 legvals = None 2044 2046 2047 if pointfreq0 == 'all': 2048 pointfreq = None 2049 else: 2050 pointfreq = int(pointfreq0) 2051 2045 2052 drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, legvals, vartit, \ 2046 varunits, timepos, timelabels, title, locleg, graphk, collines, points )2053 varunits, timepos, timelabels, title, locleg, graphk, collines, points, pointfreq) 2047 2054 2048 2055 return -
trunk/tools/drawing_tools.py
r678 r679 2491 2491 Nlines = len(valtimes) 2492 2492 # Canging line kinds every 7 lines (end of standard colors) 2493 pointkindsauto=['.', 'x', 'o', '*', 'o', '<', '>', '5'] 2493 pointkindsauto=['.', ',', 'x', 'o', '*', '+', '<', '|', '_', '>', '1', '8', 's', \ 2494 'p', 'h', 'D'] 2494 2495 Npts = len(pointkindsauto) 2495 2496 linekinds = [] … … 5339 5340 # Canging line kinds every 7 lines (end of standard colors) 5340 5341 linekinds=['.-','x-','o-'] 5342 pointkindsauto=['.', ',', 'x', 'o', '*', '+', '<', '|', '_', '>', '1', '8', 's', \ 5343 'p', 'h', 'D'] 5341 5344 5342 5345 Ntraj = len(vardv) … … 5395 5398 5396 5399 def plot_lines_time(vardv, varvv, vaxis, dtit, linesn0, vtit, vunit, tpos, tlabs, \ 5397 gtit, gloc, kfig, coll, ptl ):5400 gtit, gloc, kfig, coll, ptl, ptf): 5398 5401 """ Function to plot a collection of lines with a time axis 5399 5402 vardv= list of set of dimension values … … 5417 5420 ptl= ',' list of type of points for the lines, None for automatic, single 5418 5421 value all the same 5419 5422 ptf= frequency of point plotting, 'all' for all time steps 5423 5420 5424 plot_lines([np.arange(10)], [np.sin(np.arange(10)*np.pi/2.5)], 'y', 'time (s)', \ 5421 5425 ['2.5'], 'sin', '-', 'sinus frequency dependency', 'pdf') 5422 5426 """ 5423 fname = 'plot_lines '5427 fname = 'plot_lines_time' 5424 5428 5425 5429 if vardv == 'h': … … 5430 5434 # Canging line kinds every 7 lines (end of standard colors) 5431 5435 linekinds = [] 5436 pointkinds = [] 5437 pointkindsauto=['.', ',', 'x', 'o', '*', '+', '<', '|', '_', '>', '1', '8', 's', \ 5438 'p', 'h', 'D'] 5439 Nkpts = len(pointkindsauto) 5432 5440 if ptl is None: 5433 linekindsauto=['.-','x-','o-'] 5434 for ptype in range(4): 5435 for ip in range(7): 5436 linekinds.append(linekindsauto[ptype]) 5437 else: 5438 linekinds = ptl 5441 if ptf is None: 5442 for ptype in range(4): 5443 for ip in range(Nkpts): 5444 linekinds.append(pointkindsauto[ptype] + '-') 5445 else: 5446 for ptype in range(4): 5447 for ip in range(Nkpts): 5448 linekinds.append('-') 5449 pointkinds.append(pointkindsauto[ptype]) 5450 else: 5451 if ptf is None: 5452 for pt in ptl: 5453 linekinds.append(pt + '-') 5454 else: 5455 pointkinds = ptl 5456 for pt in ptl: 5457 linekinds.append('-') 5439 5458 5440 5459 Ntraj = len(vardv) … … 5458 5477 for il in range(Ntraj): 5459 5478 if coll is None: 5460 plt.plot(varvv[il], vardv[il], linekinds[il], label= linesn[il]) 5479 if ptf is None: 5480 plt.plot(varvv[il], vardv[il], linekinds[il], label= linesn[il]) 5481 else: 5482 plt.plot(varvv[il], vardv[il], linekinds[il]) 5483 plt.plot(varvv[il][::ptf], vardv[il][::ptf], pointkinds[il], \ 5484 label= linesn[il]) 5461 5485 else: 5462 plt.plot(varvv[il], vardv[il], linekinds[il], label= linesn[il],\ 5463 color=coll[il]) 5486 if ptf is None: 5487 plt.plot(varvv[il], vardv[il], linekinds[il], label= linesn[il], \ 5488 color=coll[il]) 5489 else: 5490 plt.plot(varvv[il], vardv[il], linekinds[il], color=coll[il]) 5491 plt.plot(varvv[il][::ptf], vardv[il][::ptf], pointkinds[il], \ 5492 label= linesn[il], color=coll[il]) 5464 5493 5465 5494 minvv = np.min(varvv[il]) … … 5484 5513 for il in range(Ntraj): 5485 5514 if coll is None: 5486 plt.plot(vardv[il], varvv[il], linekinds[il], label= linesn[il]) 5515 if ptf is None: 5516 plt.plot(vardv[il], varvv[il], linekinds[il], label= linesn[il]) 5517 else: 5518 plt.plot(vardv[il], varvv[il], linekinds[il]) 5519 plt.plot(vardv[il][::ptf], varvv[il][::ptf], pointkinds[il], \ 5520 label= linesn[il]) 5487 5521 else: 5488 plt.plot(vardv[il], varvv[il], linekinds[il], label= linesn[il],\ 5489 color=coll[il]) 5522 if ptf is None: 5523 plt.plot(vardv[il], varvv[il], linekinds[il], label= linesn[il], \ 5524 color=coll[il]) 5525 else: 5526 plt.plot(vardv[il], varvv[il], linekinds[il], color=coll[il]) 5527 plt.plot(vardv[il][::ptf], varvv[il][::ptf], linekinds[il], \ 5528 label= linesn[il], color=coll[il]) 5490 5529 5491 5530 minvv = np.min(varvv[il])
Note: See TracChangeset
for help on using the changeset viewer.