Changeset 620 in lmdz_wrf


Ignore:
Timestamp:
Aug 21, 2015, 3:26:11 PM (10 years ago)
Author:
lfita
Message:

Adding 'points' as paramter on 'draw_lines_time'

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing.py

    r604 r620  
    17991799      ncfilens= [filen] ',' separated list of netCDF files
    18001800      values= [dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];[timevals];[locleg];
    1801         [graphk];[collines];[period]
     1801        [graphk];[collines];[points];[period]
    18021802        [dimvname]: ',' list of names of the variables with he values of the common dimension
    18031803        [valuesaxis]: which axis will be used for the values ('x', or 'y')
     
    18221822          9: 'upper center', 10: 'center'
    18231823        [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
    18251828        [period]: which period to plot
    18261829          '-1': all period
     
    18381841
    18391842    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]'
    18411845    drw.check_arguments(fname,len(expectargs.split(';')),values,';',expectargs)
    18421846
     
    18521856    graphk = values.split(';')[8]
    18531857    collines0 = values.split(';')[9]
    1854     period = values.split(';')[10]
     1858    points0 = values.split(';')[10]
     1859    period = values.split(';')[11]
    18551860
    18561861    Nfiles = len(ncfiles)
     
    18711876    if collines0.find(',') != -1:
    18721877        collines = collines0.split(',')
    1873     else:
     1878    elif collines == 'None':
    18741879        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)
    18751894
    18761895# Getting values
     
    20062025      drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit,                  \
    20072026        leglabels.split(','), vartit, varunits, timepos, timelabels, title, locleg,  \
    2008         graphk, collines)
     2027        graphk, collines, points)
    20092028    else:
    20102029      drw.plot_lines_time(dimvalues, varvalues, valuesaxis, dimtit,                  \
  • trunk/tools/drawing_tools.py

    r605 r620  
    52055205
    52065206def plot_lines_time(vardv, varvv, vaxis, dtit, linesn0, vtit, vunit, tpos, tlabs,    \
    5207   gtit, gloc, kfig, coll):
     5207  gtit, gloc, kfig, coll, ptl):
    52085208    """ Function to plot a collection of lines with a time axis
    52095209      vardv= list of set of dimension values
     
    52235223      kfig= kind of figure
    52245224      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
    52255230      plot_lines([np.arange(10)], [np.sin(np.arange(10)*np.pi/2.5)], 'y', 'time (s)',      \
    52265231  ['2.5'], 'sin', '-', 'sinus frequency dependency', 'pdf')
     
    52345239
    52355240# 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
    52375249
    52385250    Ntraj = len(vardv)
     
    52565268        for il in range(Ntraj):
    52575269            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])
    52595271            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],\
    52615273                  color=coll[il])
    52625274
     
    52705282            if mindv < xtrmdv[0]: xtrmdv[0] = mindv
    52715283            if maxdv > xtrmdv[1]: xtrmdv[1] = maxdv
    5272 
    5273             if il == 6: N7lines = N7lines + 1
    52745284
    52755285        plt.xlabel(vtit + ' (' + vunit + ')')
     
    52845294        for il in range(Ntraj):
    52855295            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])
    52875297            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],\
    52895299                  color=coll[il])
    52905300
     
    52985308            if mindv < xtrmdv[0]: xtrmdv[0] = mindv
    52995309            if maxdv > xtrmdv[1]: xtrmdv[1] = maxdv
    5300 
    5301             if il == 6: N7lines = N7lines + 1
    53025310
    53035311        plt.xlabel(dtit)
Note: See TracChangeset for help on using the changeset viewer.