Changeset 620 in lmdz_wrf
- Timestamp:
- Aug 21, 2015, 3:26:11 PM (10 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/drawing.py
r604 r620 1799 1799 ncfilens= [filen] ',' separated list of netCDF files 1800 1800 values= [dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];[timevals];[locleg]; 1801 [graphk];[collines];[p eriod]1801 [graphk];[collines];[points];[period] 1802 1802 [dimvname]: ',' list of names of the variables with he values of the common dimension 1803 1803 [valuesaxis]: which axis will be used for the values ('x', or 'y') … … 1822 1822 9: 'upper center', 10: 'center' 1823 1823 [graphk]: kind of the graphic 1824 [collines]: ',' list of colors for the lines or None for automatic 1824 [collines]: ',' list of colors for the lines, None for automatic, single 1825 value all the same 1826 [points]: ',' list of type of points for the lines, None for automatic, single 1827 value all the same 1825 1828 [period]: which period to plot 1826 1829 '-1': all period … … 1838 1841 1839 1842 expectargs = '[dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];' 1840 expectargs = expectargs + '[timevals];[locleg];[graphk];[collines];[period]' 1843 expectargs = expectargs + '[timevals];[locleg];[graphk];[collines];[points];' 1844 expectargs = expectargs + '[period]' 1841 1845 drw.check_arguments(fname,len(expectargs.split(';')),values,';',expectargs) 1842 1846 … … 1852 1856 graphk = values.split(';')[8] 1853 1857 collines0 = values.split(';')[9] 1854 period = values.split(';')[10] 1858 points0 = values.split(';')[10] 1859 period = values.split(';')[11] 1855 1860 1856 1861 Nfiles = len(ncfiles) … … 1871 1876 if collines0.find(',') != -1: 1872 1877 collines = collines0.split(',') 1873 el se:1878 elif collines == 'None': 1874 1879 collines = None 1880 else: 1881 collines = [] 1882 for ip in range(Nfiles): 1883 collines.append(collines0) 1884 1885 # Multiple point types? 1886 if points0.find(',') != -1: 1887 points = points0.split(',') 1888 elif points0 == 'None': 1889 points = None 1890 else: 1891 points = [] 1892 for ip in range(Nfiles): 1893 points.append(points0) 1875 1894 1876 1895 # Getting values … … 2006 2025 drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, \ 2007 2026 leglabels.split(','), vartit, varunits, timepos, timelabels, title, locleg, \ 2008 graphk, collines )2027 graphk, collines, points) 2009 2028 else: 2010 2029 drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit, \ -
trunk/tools/drawing_tools.py
r605 r620 5205 5205 5206 5206 def plot_lines_time(vardv, varvv, vaxis, dtit, linesn0, vtit, vunit, tpos, tlabs, \ 5207 gtit, gloc, kfig, coll ):5207 gtit, gloc, kfig, coll, ptl): 5208 5208 """ Function to plot a collection of lines with a time axis 5209 5209 vardv= list of set of dimension values … … 5223 5223 kfig= kind of figure 5224 5224 coll= ',' list of colors for the lines or None for automatic 5225 coll= ',' list of colors for the lines, None for automatic, single 5226 value all the same 5227 ptl= ',' list of type of points for the lines, None for automatic, single 5228 value all the same 5229 5225 5230 plot_lines([np.arange(10)], [np.sin(np.arange(10)*np.pi/2.5)], 'y', 'time (s)', \ 5226 5231 ['2.5'], 'sin', '-', 'sinus frequency dependency', 'pdf') … … 5234 5239 5235 5240 # Canging line kinds every 7 lines (end of standard colors) 5236 linekinds=['.-','x-','o-'] 5241 linekinds = [] 5242 if ptl is None: 5243 linekindsauto=['.-','x-','o-'] 5244 for ptype in range(4): 5245 for ip in range(7): 5246 linekinds.append(linekindsauto[ptype]) 5247 else: 5248 linekinds = ptl 5237 5249 5238 5250 Ntraj = len(vardv) … … 5256 5268 for il in range(Ntraj): 5257 5269 if coll is None: 5258 plt.plot(varvv[il], vardv[il], linekinds[ N7lines], label= linesn[il])5270 plt.plot(varvv[il], vardv[il], linekinds[il], label= linesn[il]) 5259 5271 else: 5260 plt.plot(varvv[il], vardv[il], linekinds[ N7lines], label= linesn[il],\5272 plt.plot(varvv[il], vardv[il], linekinds[il], label= linesn[il],\ 5261 5273 color=coll[il]) 5262 5274 … … 5270 5282 if mindv < xtrmdv[0]: xtrmdv[0] = mindv 5271 5283 if maxdv > xtrmdv[1]: xtrmdv[1] = maxdv 5272 5273 if il == 6: N7lines = N7lines + 15274 5284 5275 5285 plt.xlabel(vtit + ' (' + vunit + ')') … … 5284 5294 for il in range(Ntraj): 5285 5295 if coll is None: 5286 plt.plot(vardv[il], varvv[il], linekinds[ N7lines], label= linesn[il])5296 plt.plot(vardv[il], varvv[il], linekinds[il], label= linesn[il]) 5287 5297 else: 5288 plt.plot(vardv[il], varvv[il], linekinds[ N7lines], label= linesn[il],\5298 plt.plot(vardv[il], varvv[il], linekinds[il], label= linesn[il],\ 5289 5299 color=coll[il]) 5290 5300 … … 5298 5308 if mindv < xtrmdv[0]: xtrmdv[0] = mindv 5299 5309 if maxdv > xtrmdv[1]: xtrmdv[1] = maxdv 5300 5301 if il == 6: N7lines = N7lines + 15302 5310 5303 5311 plt.xlabel(dtit)
Note: See TracChangeset
for help on using the changeset viewer.