Index: trunk/tools/drawing.py
===================================================================
--- trunk/tools/drawing.py	(revision 560)
+++ trunk/tools/drawing.py	(revision 561)
@@ -1799,8 +1799,8 @@
       ncfilens= [filen] ',' separated list of netCDF files
       values= [dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];[timevals];[locleg];
-        [graphk];[collines]
+        [graphk];[collines];[period]
         [dimvname]: ',' list of names of the variables with he values of the common dimension
         [valuesaxis]: which axis will be used for the values ('x', or 'y')
-        [dimtit]: title for the common dimension
+        [dimtit]: title for the common dimension ('|' for spaces)
         [leglabels]: ',' separated list of names for the legend
         [vartit]: name of the variable in the graph
@@ -1823,4 +1823,7 @@
         [graphk]: kind of the graphic
         [collines]: ',' list of colors for the lines or None for automatic
+        [period]: which period to plot
+          '-1': all period
+          [beg],[end]: beginning and end of the period in reference time-units of first file
       varname0= ',' list of variable names to plot (assuming only 1 variable per file)
       values= 'time;y;time ([DD]${[HH]}$);32x32;$wss^{*}$;wss Taylor's turbulence term;time|hours!since!1949-12-01_00:00:00;exct,12,h|%d$^{%H}$;2;pdf'
@@ -1835,5 +1838,5 @@
 
     expectargs = '[dimvname];[valuesaxis];[dimtit];[leglabels];[vtit];[title];'
-    expectargs = expectargs + '[timevals];[locleg];[graphk];[collines]'
+    expectargs = expectargs + '[timevals];[locleg];[graphk];[collines];[period]'
     drw.check_arguments(fname,len(expectargs.split(';')),values,';',expectargs)
 
@@ -1841,5 +1844,5 @@
     dimvname0 = values.split(';')[0]
     valuesaxis = values.split(';')[1]
-    dimtit = values.split(';')[2]
+    dimtit = values.split(';')[2].replace('|',' ')
     leglabels = values.split(';')[3].replace('_','\_')
     vartit = values.split(';')[4]
@@ -1849,4 +1852,5 @@
     graphk = values.split(';')[8]
     collines0 = values.split(';')[9]
+    period = values.split(';')[10]
 
     Nfiles = len(ncfiles)
@@ -1929,10 +1933,52 @@
             quit(-1)
 
-        varvalues.append(vvobj[:])
-        dimvalues.append(vdobj[:])
-
-        mindvals = np.min(vdobj[:])
-        maxdvals = np.max(vdobj[:])
-        dimt = len(vvobj[:])
+
+# Getting period
+        dimt = len(vdobj[:])
+
+        if period == 'all':
+            varvalues.append(vvobj[:])
+            dimvalues.append(vdobj[:])
+            mindvals = np.min(vdobj[:])
+            maxdvals = np.max(vdobj[:])
+        else:
+            ibeg=-1
+            iend=-1
+            tbeg = np.float(period.split(',')[0])
+            tend = np.float(period.split(',')[1])
+
+            for it in range(dimt-1):
+                if vdobj[it] <= tbeg and vdobj[it+1] > tbeg : ibeg = it
+                if vdobj[it] <= tend and vdobj[it+1] > tend: iend = it + 1
+                if ibeg != -1 and iend != -1: break
+
+            if ibeg == -1 and iend == -1:
+                print errormsg
+                print '  ' + fname + ': Period:',tbeg,',',tend,'not found!!'
+                print '    ibeg:',ibeg,'iend:',iend
+                print '    period in file:',np.min(vdobj[:]), np.max(vdobj[:])
+                quit(-1)
+            elif iend == -1:
+                iend = dimt
+                print warnmsg
+                print '  ' + fname + ': end of Period:',tbeg,',',tend,'not found!!'
+                print '    getting last available time instead'
+                print '    ibeg:',ibeg,'iend:',iend
+                print '    period in file:',np.min(vdobj[:]), np.max(vdobj[:])
+            elif ibeg == -1:
+                ibeg = 0
+                print warnmsg
+                print '  ' + fname + ': beginning of Period:',tbeg,',',tend,         \
+                  'not found!!'
+                print '    getting first available time instead'
+                print '    ibeg:',ibeg,'iend:',iend
+                print '    period in file:',np.min(vdobj[:]), np.max(vdobj[:])
+
+            varvalues.append(vvobj[ibeg:iend])
+            dimvalues.append(vdobj[ibeg:iend])
+            mindvals = np.min(vdobj[ibeg:iend])
+            maxdvals = np.max(vdobj[ibeg:iend])
+
+            dimt = iend - ibeg
 
         if mindvals < mintval: mintval = mindvals
