Index: /trunk/tools/drawing.py
===================================================================
--- /trunk/tools/drawing.py	(revision 445)
+++ /trunk/tools/drawing.py	(revision 446)
@@ -2353,10 +2353,17 @@
 
         valsv = np.zeros((2,dimt), dtype=np.float)
+# Checking for time consistency
+        if otim.getncattr('units') != tunits:
+            print warnmsg
+            print '  ' + fname + ': different time units in the plot!!'
+            newtimes = drw.coincident_CFtimes(otim[:], tunits, otim.getncattr('units'))
+        else:
+            newtimes = otim[:]
 
         if tini == -1:
-            valsv[1,:] = otim[:]
+            valsv[1,:] = newtimes[:]
             valsv[0,:] = ovar[:]
         else:
-            valsv[1,:] = otim[tiniid:tendid+1]
+            valsv[1,:] = newtimes[tiniid:tendid+1]
             valsv[0,:] = ovar[tiniid:tendid+1]
 
Index: /trunk/tools/drawing_tools.py
===================================================================
--- /trunk/tools/drawing_tools.py	(revision 445)
+++ /trunk/tools/drawing_tools.py	(revision 446)
@@ -2209,4 +2209,142 @@
     return boolv
 
+def coincident_CFtimes(tvalB, tunitA, tunitB):
+    """ Function to make coincident times for two different sets of CFtimes
+    tvalB= time values B
+    tunitA= time units times A to which we want to make coincidence
+    tunitB= time units times B
+    >>> coincident_CFtimes(np.arange(10),'seconds since 1949-12-01 00:00:00',
+      'hours since 1949-12-01 00:00:00')
+    [     0.   3600.   7200.  10800.  14400.  18000.  21600.  25200.  28800.  32400.]
+    >>> coincident_CFtimes(np.arange(10),'seconds since 1949-12-01 00:00:00',
+      'hours since 1979-12-01 00:00:00')
+    [  9.46684800e+08   9.46688400e+08   9.46692000e+08   9.46695600e+08
+       9.46699200e+08   9.46702800e+08   9.46706400e+08   9.46710000e+08
+       9.46713600e+08   9.46717200e+08]
+    """
+    import datetime as dt
+    fname = 'coincident_CFtimes'
+
+    trefA = tunitA.split(' ')[2] + ' ' + tunitA.split(' ')[3]
+    trefB = tunitB.split(' ')[2] + ' ' + tunitB.split(' ')[3]
+    tuA = tunitA.split(' ')[0]
+    tuB = tunitB.split(' ')[0]
+
+    if tuA != tuB:
+        if tuA == 'microseconds':
+            if tuB == 'microseconds':
+                tB = tvalB*1.
+            elif tuB == 'seconds':
+                tB = tvalB*10.e6
+            elif tuB == 'minutes':
+                tB = tvalB*60.*10.e6
+            elif tuB == 'hours':
+                tB = tvalB*3600.*10.e6
+            elif tuB == 'days':
+                tB = tvalB*3600.*24.*10.e6
+            else:
+                print errormsg
+                print '  ' + fname + ": combination of time untis: '" + tuA +        \
+                  "' & '" + tuB + "' not ready !!"
+                quit(-1)
+        elif tuA == 'seconds':
+            if tuB == 'microseconds':
+                tB = tvalB/10.e6
+            elif tuB == 'seconds':
+                tB = tvalB*1.
+            elif tuB == 'minutes':
+                tB = tvalB*60.
+            elif tuB == 'hours':
+                tB = tvalB*3600.
+            elif tuB == 'days':
+                tB = tvalB*3600.*24.
+            else:
+                print errormsg
+                print '  ' + fname + ": combination of time untis: '" + tuA +        \
+                  "' & '" + tuB + "' not ready !!"
+                quit(-1)
+        elif tuA == 'minutes':
+            if tuB == 'microseconds':
+                tB = tvalB/(60.*10.e6)
+            elif tuB == 'seconds':
+                tB = tvalB/60.
+            elif tuB == 'minutes':
+                tB = tvalB*1.
+            elif tuB == 'hours':
+                tB = tvalB*60.
+            elif tuB == 'days':
+                tB = tvalB*60.*24.
+            else:
+                print errormsg
+                print '  ' + fname + ": combination of time untis: '" + tuA +        \
+                  "' & '" + tuB + "' not ready !!"
+                quit(-1)
+        elif tuA == 'hours':
+            if tuB == 'microseconds':
+                tB = tvalB/(3600.*10.e6)
+            elif tuB == 'seconds':
+                tB = tvalB/3600.
+            elif tuB == 'minutes':
+                tB = tvalB/60.
+            elif tuB == 'hours':
+                tB = tvalB*1.
+            elif tuB == 'days':
+                tB = tvalB*24.
+            else:
+                print errormsg
+                print '  ' + fname + ": combination of time untis: '" + tuA +        \
+                  "' & '" + tuB + "' not ready !!"
+                quit(-1)
+        elif tuA == 'days':
+            if tuB == 'microseconds':
+                tB = tvalB/(24.*3600.*10.e6)
+            elif tuB == 'seconds':
+                tB = tvalB/(24.*3600.)
+            elif tuB == 'minutes':
+                tB = tvalB/(24.*60.)
+            elif tuB == 'hours':
+                tB = tvalB/24.
+            elif tuB == 'days':
+                tB = tvalB*1.
+            else:
+                print errormsg
+                print '  ' + fname + ": combination of time untis: '" + tuA +        \
+                  "' & '" + tuB + "' not ready !!"
+                quit(-1)
+        else:
+            print errormsg
+            print '  ' + fname + ": time untis: '" + tuA + "' not ready !!"
+            quit(-1)
+    else:
+        tB = tvalB*1.
+
+    if trefA != trefB:
+        trefTA = dt.datetime.strptime(trefA, '%Y-%m-%d %H:%M:%S')
+        trefTB = dt.datetime.strptime(trefB, '%Y-%m-%d %H:%M:%S')
+
+        difft = trefTB - trefTA
+        diffv = difft.days*24.*3600.*10.e6 + difft.seconds*10.e6 + difft.microseconds
+        print '  ' + fname + ': different reference refA:',trefTA,'refB',trefTB
+        print '    difference:',difft,':',diffv,'microseconds'
+
+        if tuA == 'microseconds':
+            tB = tB + diffv
+        elif tuA == 'seconds':
+            tB = tB + diffv/10.e6
+        elif tuA == 'minutes':
+            tB = tB + diffv/(60.*10.e6)
+        elif tuA == 'hours':
+            tB = tB + diffv/(3600.*10.e6)
+        elif tuA == 'dayss':
+            tB = tB + diffv/(24.*3600.*10.e6)
+        else:
+            print errormsg
+            print '  ' + fname + ": time untis: '" + tuA + "' not ready !!"
+            quit(-1)
+
+    return tB
+
+####### ###### ##### #### ### ## #
+
 def plot_TimeSeries(valtimes, vunits, tunits, hfileout, vtit, ttit, tkind, tformat,  \
   tit, linesn, lloc, kfig):
