Changeset 947 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Jun 24, 2016, 12:46:07 PM (8 years ago)
Author:
lfita
Message:

Fixing months' time units in draw_lines_time'

Location:
trunk/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/drawing.py

    r938 r947  
    17851785        [valuesaxis]: which axis will be used for the values ('x', or 'y')
    17861786        [dimtit]: title for the common dimension ('|' for spaces)
    1787         [leglabels]: ',' separated list of names for the legend ('None', no legend)
     1787        [leglabels]: ',' separated list of names for the legend ('None', no legend '!' for spaces)
    17881788        [vartit]: name of the variable in the graph
    17891789        [title]: title of the plot ('|' for spaces)
     
    18371837    valuesaxis = values.split(';')[1]
    18381838    dimtit = values.split(';')[2].replace('|',' ')
    1839     leglabels = values.split(';')[3].replace('_','\_')
     1839    leglabels = values.split(';')[3].replace('_','\_').replace('!',' ')
    18401840    vartit = values.split(';')[4]
    18411841    title = values.split(';')[5].replace('|',' ')
     
    18871887# Multiple point types?
    18881888    if points0.find(',') != -1:
    1889         points = points0.split(',')
     1889        if len(points0) == 1:
     1890            points = []
     1891            for ip in range(Nfiles):
     1892                points.append(points0)
     1893        else:
     1894            points = points0.split(',')
    18901895    elif points0 == 'None':
    18911896        points = None
     
    19801985              "' has any variable '", varname, "' !!"
    19811986            quit(-1)
    1982 
     1987        if vdobj.units.find('month') != 1:
     1988            print warnmsg
     1989            print '  ' + fname + ": tranforming time units from 'months' to 'days'!!"
     1990            timevals0, tunits0 = gen.CFmonthU_daysU(vdobj[:], vdobj.units)
     1991        else:
     1992            timevals0 = vdobj[:]
     1993            tunits0 = str(vdobj.units)
    19831994
    19841995# Getting period
    19851996        if ifn > 0:
    19861997# Referring all times to the same reference time!
    1987             reftvals = drw.coincident_CFtimes(vdobj[:], timeunit, vdobj.units)
     1998            reftvals = drw.coincident_CFtimes(timevals0, timeunit, tunits0)
    19881999        else:
    1989             reftvals = vdobj[:]
     2000            reftvals = timevals0
    19902001
    19912002        dimt = len(vdobj[:])
     
    20402051        if mindvals < mintval: mintval = mindvals
    20412052        if maxdvals > maxtval: maxtval = maxdvals
    2042 #        print '  ' + fname + ": file '" + filen + "' period:", ibeg, '->', iend,     \
    2043 #            reftvals[ibeg], '->', reftvals[np.min([iend,dimt-1])], timeunit
     2053        print '  ' + fname + ": file '" + filen + "' period:", mindvals, '->', maxdvals
    20442054
    20452055        if ifn == 0:
  • trunk/tools/drawing_tools.py

    r945 r947  
    26382638    tuB = tunitB.split(' ')[0]
    26392639
    2640     if tuB == 'months':
    2641         tvalB, tunitB  = gen.CFmonthU_daysU(tvalB, tunitB)
    2642         tuB = tunitB.split(' ')[0]
     2640#    if tuB == 'months':
     2641#        tvalB, tunitB  = gen.CFmonthU_daysU(tvalB, tunitB)
     2642#        tuB = tunitB.split(' ')[0]
    26432643
    26442644    if tuA != tuB:
     
    27472747        elif tuA == 'hours':
    27482748            tB = tB + diffv/(3600.*10.e6)
    2749         elif tuA == 'dayss':
     2749        elif tuA == 'days':
    27502750            tB = tB + diffv/(24.*3600.*10.e6)
    27512751        else:
     
    58225822    else:
    58235823        for il in range(Ntraj):
     5824            Nvals = len(vardv[il])
     5825            dvals = vardv[il]
     5826            vvals = varvv[il]
    58245827            plt.plot(vardv[il], varvv[il], linekinds[il], marker=pointkinds[il],     \
    58255828              label=linesn[il], color=colvalues[il], linewidth=lwidths[il],          \
Note: See TracChangeset for help on using the changeset viewer.