Index: /trunk/SRC/Calendar/caldat.pro
===================================================================
--- /trunk/SRC/Calendar/caldat.pro	(revision 204)
+++ /trunk/SRC/Calendar/caldat.pro	(revision 205)
@@ -70,9 +70,10 @@
   IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg'
   if keyword_set(ndayspm) then key_caltype = '360d'
+
+  nParam = N_PARAMS()
+  IF (nParam LT 1) THEN MESSAGE, 'Incorrect number of arguments.'
+
   CASE key_caltype OF
     'greg':BEGIN
-
-      nParam = N_PARAMS()
-      IF (nParam LT 1) THEN MESSAGE, 'Incorrect number of arguments.'
 
       min_julian = -1095
@@ -110,42 +111,8 @@
       year = TEMPORARY(year) - (month GT 2)
       year = year - (year LE 0)
-; see if we need to do hours, minutes, seconds
-      IF (nParam GT 4) THEN BEGIN
-        fraction = julian + 0.5d - TEMPORARY(julLong)
-        hour = floor(fraction * 24d)
-        fraction = TEMPORARY(fraction) - hour/24d
-        minute = floor(fraction*1440d)
-        second = (TEMPORARY(fraction) - minute/1440d) * 86400d
-      ENDIF
-
-; if julian is an array, reform all output to correct dimensions
-      IF (SIZE(julian, /N_DIMENSION) GT 0) THEN BEGIN
-        dimensions = SIZE(julian, /DIMENSION)
-        month = REFORM(month, dimensions)
-        day = REFORM(day, dimensions)
-        year = REFORM(year, dimensions)
-        IF (nParam GT 4) THEN BEGIN
-          hour = REFORM(hour, dimensions)
-          minute = REFORM(minute, dimensions)
-          second = REFORM(second, dimensions)
-        ENDIF
-      ENDIF
 
     END 
     '360d':BEGIN
-
-      jul = long(julian)
-      f = (jul - floor(jul))
-      IF total(f NE 0.0) GT 0 THEN BEGIN ;Get hours, minutes, seconds.
-        hour = floor(f*24.)
-        f = f - hour / 24.d
-        minute = floor(f*1440)
-        second = (f - minute/1440.d0) * 86400.0d0
-      ENDIF ELSE BEGIN
-        hour = replicate(0L,  n_elements(julian))
-        minute = replicate(0L,  n_elements(julian))
-        second = replicate(0L,  n_elements(julian))
-      ENDELSE
-
+ 
       IF keyword_set(ndayspm) THEN BEGIN
         IF ndayspm EQ 1 THEN ndayspm = 30
@@ -153,8 +120,8 @@
 
       ndayspm = long(ndayspm)
-      Z = floor(julian)
-      year = z/(12*ndayspm)+1
-      month = (z-(12*ndayspm)*(year-1))/ndayspm+1
-      day = z-(12*ndayspm)*(year-1)-ndayspm*(month-1)
+      julLong = FLOOR(julian + 0.5d)     ;Better be long
+      year = julLong/(12*ndayspm)+1
+      month = (julLong-(12*ndayspm)*(year-1))/ndayspm+1
+      day = julLong-(12*ndayspm)*(year-1)-ndayspm*(month-1)
       WHILE total(day LT 1) GT 0 DO BEGIN
         tochange = where(day LT 1)
@@ -173,11 +140,10 @@
     'noleap':BEGIN
 
-      jul = long(julian)
-      year = jul/365 + 1
-      day = jul MOD 365L
-;
+      julLong = FLOOR(julian + 0.5d)     ;Better be long
+      year = julLong/365 + 1
+      day = julLong MOD 365L
 ;
       zero = where(day EQ 0)
- ;
+;
       month = 1 + (day GT 31) + (day GT 59) + (day GT 90) + (day GT 120) $
               + (day GT 151) + (day GT 181) + (day GT 212) + (day GT 243) $
@@ -195,5 +161,5 @@
         day[zero] = 31L
       ENDIF 
-
+;
     END 
     ELSE:BEGIN
@@ -206,4 +172,26 @@
   IF cnt NE 0 THEN year[zero] = year[zero]-654321L
 ;
+; see if we need to do hours, minutes, seconds
+  IF (nParam GT 4) THEN BEGIN
+    fraction = julian + 0.5d - TEMPORARY(julLong)
+    hour = floor(fraction * 24d)
+    fraction = TEMPORARY(fraction) - hour/24d
+    minute = floor(fraction*1440d)
+    second = (TEMPORARY(fraction) - minute/1440d) * 86400d
+  ENDIF
+  
+; if julian is an array, reform all output to correct dimensions
+  IF (SIZE(julian, /N_DIMENSION) GT 0) THEN BEGIN
+    dimensions = SIZE(julian, /DIMENSION)
+    month = REFORM(month, dimensions, /overwrite)
+    day = REFORM(day, dimensions, /overwrite)
+    year = REFORM(year, dimensions, /overwrite)
+    IF (nParam GT 4) THEN BEGIN
+      hour = REFORM(hour, dimensions, /overwrite)
+      minute = REFORM(minute, dimensions, /overwrite)
+      second = REFORM(second, dimensions, /overwrite)
+    ENDIF
+  ENDIF
+;
   return
 
Index: /trunk/SRC/Calendar/date2jul.pro
===================================================================
--- /trunk/SRC/Calendar/date2jul.pro	(revision 204)
+++ /trunk/SRC/Calendar/date2jul.pro	(revision 205)
@@ -50,5 +50,14 @@
      + 2000 * (year GE  1 AND year LE 49)
 ;------------------------------------------------------------
-   return, julday(month, day, year)
+  IF array_equal(date, long(date)) THEN return, julday(month, day, year)
+  
+  fraction = date - long(date)
+  hour = floor(fraction * 24d)
+  fraction = TEMPORARY(fraction) - hour/24d
+  minute = floor(fraction*1440d)
+  second = (TEMPORARY(fraction) - minute/1440d) * 86400d
+  
+  return, julday(month, day, year, hour, minute, second)
+
 end
 
Index: /trunk/SRC/Calendar/jul2date.pro
===================================================================
--- /trunk/SRC/Calendar/jul2date.pro	(revision 204)
+++ /trunk/SRC/Calendar/jul2date.pro	(revision 205)
@@ -30,10 +30,11 @@
   compile_opt idl2, strictarrsubs
 ;
-
-  caldat, jday, month, day, year
-
+  caldat, jday, month, day, year, hour, min, sec
+;
   res = (10000L*year + 100L*month + day)*(year GE 0) $
         +( 10000L*year - 100L*month - day)*(year LT 0)
+;
+  IF total([hour NE 12, min NE 0, sec NE 0]) EQ 0 THEN return, long(res) $
+  ELSE return, double(res) + (hour / 24.0d0) + (min/1440.0d0) + (sec / 86400.0d0)
 
-  return, long(res)
 end
Index: /trunk/SRC/Calendar/julday.pro
===================================================================
--- /trunk/SRC/Calendar/julday.pro	(revision 204)
+++ /trunk/SRC/Calendar/julday.pro	(revision 205)
@@ -93,5 +93,4 @@
   if keyword_set(ndayspm) then key_caltype = '360d'
 ;
-
   YEAR = long(yearin)
   zero = where(year EQ 0, cnt)
@@ -100,5 +99,4 @@
   CASE key_caltype OF
     'greg':BEGIN
-
 
 ; Gregorian Calender was adopted on Oct. 15, 1582
@@ -245,10 +243,10 @@
       if n_elements(Hour) + n_elements(Minute) + n_elements(Second) eq 0 then $
         return, JUL
-      if n_elements(Hour) eq 0 then Hour = 0
+      if n_elements(Hour) eq 0 then Hour = 12
       if n_elements(Minute) eq 0 then Minute = 0
       if n_elements(Second) eq 0 then Second = 0
       
-      IF Hour+Minute+Second EQ 0 THEN return, JUL ELSE $
-        return, JUL + (Hour / 24.0d0) + (Minute/1440.0d0) + (Second / 86400.0d0)
+      IF total([hour NE 12, minute NE 0, second NE 0]) EQ 0 THEN return, JUL ELSE $
+        return, JUL + (Hour / 24.0d0 - 0.5d) + (Minute/1440.0d0) + (Second / 86400.0d0)
 
     END 
@@ -275,5 +273,13 @@
       daysyear = long(total([0, 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30], /cumulative))
 
-      return, 365*L_YEAR + daysyear[L_MONTH] + L_DAY
+      JUL = 365*L_YEAR + daysyear[L_MONTH] + L_DAY
+      if n_elements(Hour) + n_elements(Minute) + n_elements(Second) eq 0 then $
+        return, JUL
+      if n_elements(Hour) eq 0 then Hour = 12
+      if n_elements(Minute) eq 0 then Minute = 0
+      if n_elements(Second) eq 0 then Second = 0
+      
+        IF total([hour NE 12, minute NE 0, second NE 0]) EQ 0 THEN return, JUL ELSE $
+        return, JUL + (Hour / 24.0d0 - 0.5d) + (Minute/1440.0d0) + (Second / 86400.0d0)
 
     END 
Index: /trunk/SRC/Interpolation/fromirr.pro
===================================================================
--- /trunk/SRC/Interpolation/fromirr.pro	(revision 204)
+++ /trunk/SRC/Interpolation/fromirr.pro	(revision 205)
@@ -14,18 +14,18 @@
 ; a 2D array the input data to interpolate
 ;
-; @param lonin {in}{optional}{type=2d array}
+; @param lonin {in}{required}{type=2d array}
 ; a 2D array defining the longitude of the input data
 ;
-; @param latin {in}{optional}{type=2d array}
+; @param latin {in}{required}{type=2d array}
 ; a 2D array defining the latitude of the input data.
 ;
-; @param mskin {in}{optional}{type=2d array or -1}
+; @param mskin {in}{required}{type=2d array or -1}
 ; a 2D array, the land-sea mask of the input data (1 on ocean, 0 on land)
 ; put -1 if input data are not masked
 ;
-; @param lonout {in}{optional}{type=1d or 2d array}
+; @param lonout {in}{required}{type=1d or 2d array}
 ; 1D or 2D array defining the longitude of the output data.
 ;
-; @param latout {in}{optional}{type=1d or 2d array}
+; @param latout {in}{required}{type=1d or 2d array}
 ; 1D or 2D array defining the latitude of the output data.
 ;
Index: /trunk/SRC/Interpolation/fromreg.pro
===================================================================
--- /trunk/SRC/Interpolation/fromreg.pro	(revision 204)
+++ /trunk/SRC/Interpolation/fromreg.pro	(revision 205)
@@ -17,11 +17,11 @@
 ; a 2D array the input data to interpolate
 ;
-; @param lonin {in}{optional}{type=1d or 2d array}
+; @param lonin {in}{required}{type=1d or 2d array}
 ; 1D or 2D array defining the longitude of the input data
 ;
-; @param latin {in}{optional}{type=1d or 2d array}
+; @param latin {in}{required}{type=1d or 2d array}
 ; 1D or 2D array defining the latitude of the input data
 ;
-; @param lonout {in}{optional}{type=1d or 2d array}
+; @param lonout {in}{required}{type=1d or 2d array}
 ; 1D or 2D array defining the longitude of the output data
 ;
Index: /trunk/SRC/ToBeReviewed/PLOTS/axe.pro
===================================================================
--- /trunk/SRC/ToBeReviewed/PLOTS/axe.pro	(revision 204)
+++ /trunk/SRC/ToBeReviewed/PLOTS/axe.pro	(revision 205)
@@ -74,96 +74,130 @@
        if coupe EQ 'yt' OR coupe EQ 'zt' OR coupe EQ 't' then sep = '!C' ELSE sep = ' '
 ;
-      caldat,tempsmin, mmin, dmin, ymin, hmin, mnmin, smin, _EXTRA = ex
-      caldat,tempsmax, mmax, dmax, ymax, hmax, mnmax, smax, _EXTRA = ex
+      caldat, tempsmin, mmin, dmin, ymin, hmin, mnmin, smin, _EXTRA = ex
+      caldat, tempsmax, mmax, dmax, ymax, hmax, mnmax, smax, _EXTRA = ex
 ; format used for the year (2 or 4/5 digits).
       IF NOT keyword_set(digitsyear) THEN digitsyear = 4
       IF digitsyear EQ 2 THEN fmtyr = '%Z' ELSE fmtyr = '%Y'
 ;
-      if ymax EQ ymin then BEGIN
-         if mmin ne mmax then BEGIN
-; Same year but several monthes
-            nticks = mmax-mmin+1
-            ticknom = lonarr(nticks)
-            for m = 0,nticks-1 do ticknom[m] = julday(m+mmin, 1, ymin, _EXTRA = ex)
-            tminor = 6
-            datfmt = '%M'+sep+fmtyr
-; We check that labels are betwenn TEMPSMIN and TEMPSMAX...
-            ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE -1)]
-            nticks = n_elements(ticknom)
-; Particular case where we are overlap two monthes
-            if nticks LE 1 then begin
-               nticks = (dmax+(jourdsmois(mmin, ymin))[0]-dmin+1)/2
-               ticknom = lonarr(nticks)
-               for d = 0,nticks-1 do ticknom[d] = julday(mmin, d*2+dmin, ymin, _EXTRA = ex)
-               ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax $
-                                       AND ticknom NE -1)]
-               nticks = n_elements(ticknom)
-               tminor = 2
-               datfmt = '%D'+sep+'%M'
-            endif
-         ENDIF ELSE BEGIN 
-; Same year and same month
-            IF dmax-dmin+1 GT 4 THEN BEGIN ; more than 4 days
-               nticks = dmax-dmin+1
-               ticknom = lonarr(nticks)
-               for d = 0,nticks-1 do ticknom[d] = julday(mmin, d+dmin, ymin, _EXTRA = ex)
-               ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax $
-                                       AND ticknom NE -1)]
-               nticks = n_elements(ticknom)
-               tminor = 2
-               datfmt = '%D'+sep+'%M'
-            ENDIF ELSE BEGIN    ; less than 4 days : divday ticks per day
-               divday = 4
-               nticks = (dmax-dmin)*divday + 1
-               ticknom = fltarr(nticks)
-               for d = 0,nticks-1 do $
-                ticknom[d] = julday(mmin, d/divday+dmin, ymin, _EXTRA = ex) $
-                +(d MOD divday)/float(divday)
-               tminor = 2
-               datfmt = '%H:00'
-            ENDELSE 
-         ENDELSE 
-      ENDIF ELSE BEGIN 
-; Several years
-         CASE 1 OF
-         ymax-ymin+1 LE 10: BEGIN & freq = 1. & tminor = 12 & datfmt = '%M'+sep+fmtyr & end
-         ymax-ymin+1 LE 20: BEGIN & freq = 2. & tminor = 6 & datfmt = '%M'+sep+fmtyr & end
-         ymax-ymin+1 LE 50: BEGIN & freq = 5. & tminor = 5 & datfmt = '%M'+sep+fmtyr & end
-         ymax-ymin+1 LE 100: BEGIN & freq = 10. & tminor = 10 & datfmt = fmtyr & end
-         ymax-ymin+1 LE 1000: BEGIN & freq = 50. & tminor = 5 & datfmt = fmtyr & end
-         ELSE : BEGIN & freq = 100. & tminor = 50 & datfmt = '%Y' & end
-         ENDCASE 
-         nticks = floor((ymax-ymin)/freq)+1
-         IF floor((ymin)/freq) NE (ymin)/freq THEN $
-          yminf = (floor(ymin/freq)+1)*freq ELSE  $
+      CASE 1 OF
+; yearly base
+        tempsmax GT julday(mmin, dmin, ymin + 3, hmin, mnmin, smin):BEGIN ; more than 3 years
+          CASE 1 OF
+          ymax-ymin+1 GT 5000: BEGIN & freq = 500. & tminor = 5 & datfmt = fmtyr & end
+          ymax-ymin+1 GT 2000: BEGIN & freq = 200. & tminor = 4 & datfmt = fmtyr & end
+          ymax-ymin+1 GT 1000: BEGIN & freq = 100. & tminor = 5 & datfmt = fmtyr & end
+          ymax-ymin+1 GT 500: BEGIN & freq = 50. & tminor = 5 & datfmt = fmtyr & end
+          ymax-ymin+1 GT 200: BEGIN & freq = 20. & tminor = 4 & datfmt = fmtyr & end
+          ymax-ymin+1 GT 100: BEGIN & freq = 10. & tminor = 5 & datfmt = fmtyr & end
+          ymax-ymin+1 GT 50: BEGIN & freq = 5. & tminor = 5 & datfmt = '%M'+sep+fmtyr & end
+          ymax-ymin+1 GT 20: BEGIN & freq = 4. & tminor = 4 & datfmt = '%M'+sep+fmtyr & end
+          ymax-ymin+1 GT 10: BEGIN & freq = 2. & tminor = 4 & datfmt = '%M'+sep+fmtyr & end
+          ELSE: BEGIN & freq = 1. & tminor = 4 & datfmt = '%M'+sep+fmtyr & end
+          ENDCASE 
+          nticks = ceil((ymax-ymin)/freq) + 2
           yminf = (floor(ymin/freq))*freq
-         ticknom = lonarr(nticks)
-         for y = 0, nticks-1 do ticknom[y] = julday(1, 1, yminf+(y*freq), _EXTRA = ex)
-; We check that labels are betwenn TEMPSMIN and TEMPSMAX...
-         ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE -1)]
-         nticks = n_elements(ticknom)
-; Particular case where we are overlap two monthes
-         if nticks LE 1 then begin
-            nticks = (mmax+12)-mmin+1
-            ticknom = lonarr(nticks)
-            for m = 0,nticks-1 do ticknom[m] = julday(m+mmin, 1, ymin, _EXTRA = ex)
-            ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax AND ticknom NE -1)]
-            nticks = n_elements(ticknom)
-            tminor = 6
-            datfmt = '%M'+sep+fmtyr
- ; Particular case where we are overlap two monthes
-           if nticks LE 1 then begin
-               nticks = (dmax+(jourdsmois(mmin, ymin))[0]-dmin+1)/2
-               ticknom = lonarr(nticks)
-               for d = 0,nticks-1 do ticknom[d] = julday(mmin, d*2+dmin, ymin, _EXTRA = ex)
-               ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax $
-                                       AND ticknom NE -1)]
-               nticks = n_elements(ticknom)
-               tminor = 2
-               datfmt = '%D'+sep+'%M'
-            endif
-         endif
-      ENDELSE 
-      toto = label_date(0, 0, 0, DATE_FORMAT = datfmt, _EXTRA = ex)
+          ticknom = lonarr(nticks)
+          for y = 0, nticks-1 do ticknom[y] = julday(1, 1, yminf + y*freq, _EXTRA = ex)
+          ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax, nticks)]
+        END
+; monthly base
+        tempsmax GT julday(mmin + 3, dmin, ymin, hmin, mnmin, smin):BEGIN ; more than 3 months
+          CASE 1 OF
+            tempsmax GT julday(mmin + 30, dmin, ymin, hmin, mnmin, smin):BEGIN ; more than 30 months -> ticks every 3 months
+            freq = 3. & tminor = 3 & END
+            tempsmax GT julday(mmin + 16, dmin, ymin, hmin, mnmin, smin):BEGIN ; more than 16 months -> ticks every 2 months
+            freq = 2. & tminor = 2 & END
+            else:BEGIN          ; monthly ticks
+            freq = 1. & tminor = 6 & END
+          ENDCASE
+          nticks = ceil((mmax + 12*(ymax - ymin) - mmin)/freq) + 2
+          mminf = 1 > ((floor(mmin/freq))*freq)
+          ticknom = lonarr(nticks)
+          for m = 0, nticks-1 do ticknom[m] = julday(mminf + freq*m, 1, ymin, _EXTRA = ex)
+          datfmt = '%M'+sep+fmtyr
+          ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax, nticks)]
+        END
+; daily base
+        tempsmax GT julday(mmin, dmin + 3, ymin, hmin, mnmin, smin):BEGIN ; more than 3 days
+          CASE 1 OF
+            tempsmax GT julday(mmin, dmin + 60, ymin, hmin, mnmin, smin):BEGIN ; more than 60 days -> ticks every 7 days
+            freq = 7. & tminor = 2 & END
+            tempsmax GT julday(mmin, dmin + 30, ymin, hmin, mnmin, smin):BEGIN ; more than 30 days -> ticks every 5 days
+            freq = 5. & tminor = 5 & END
+            tempsmax GT julday(mmin, dmin + 16, ymin, hmin, mnmin, smin):BEGIN ; more than 16 days -> ticks every 2 days
+            freq = 2. & tminor = 2 & END
+            ELSE:BEGIN   ; daily ticks
+            freq = 1. & tminor = 2 & END
+          ENDCASE
+          nticks = ceil((tempsmax - tempsmin)/freq) + 2
+          dminf = 1 > ((floor(dmin/freq))*freq)
+          ticknom = lonarr(nticks)
+          for d = 0, nticks-1 do ticknom[d] = julday(mmin, dminf + freq*d, ymin, _EXTRA = ex)
+          datfmt = '%D'+sep+'%M'
+          ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax, nticks)]
+        END
+; hourly base
+        tempsmax GT julday(mmin, dmin, ymin, hmin + 3, mnmin, smin):BEGIN ; more than 3 hours
+          CASE 1 OF
+            tempsmax GT julday(mmin, dmin, ymin, hmin + 48, mnmin, smin):BEGIN ; more than 48 hours -> ticks every 6 hours
+            freq = 6. & tminor = 3 & datfmt = '%D'+sep+'%H:00' & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin + 30, mnmin, smin):BEGIN ; more than 30 hours -> ticks every 4 hours
+            freq = 4. & tminor = 2 & datfmt = '%D'+sep+'%H:00' & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin + 16, mnmin, smin):BEGIN ; more than 16 hours -> ticks every 2 hours
+            freq = 2. & tminor = 2 & datfmt = '%H:00' & END
+            ELSE:BEGIN   ; ticks every hour
+            freq = 1. & tminor = 2 & datfmt = '%H:00' & END
+          ENDCASE
+          nticks = ceil((hmax + 24*(dmax - dmin) - hmin)/freq) + 2
+          hminf = (floor(hmin/freq))*freq
+          ticknom = dblarr(nticks)
+          for h = 0, nticks-1 do ticknom[h] = julday(mmin, dmin, ymin, hminf + freq*h, 0, 0, _EXTRA = ex)
+          ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax, nticks)]
+        END
+; minute base
+        tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin + 3, smin):BEGIN ; more than 3 minutes
+          CASE 1 OF
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin + 120, smin):BEGIN ; more than 120 minutes -> ticks every 10 minutes
+            freq = 10. & tminor = 2 & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin + 60, smin):BEGIN ; more than 60 minutes -> ticks every 6 minutes
+            freq = 6. & tminor = 3 & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin + 30, smin):BEGIN ; more than 30 minutes -> ticks every 4 minutes
+            freq = 4. & tminor = 2 & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin + 15, smin):BEGIN ; more than 15 minutes -> ticks every 2 minutes
+            freq = 2. & tminor = 2 & END
+            ELSE:BEGIN   ; ticks every minutes
+            freq = 1. & tminor = 2 & END
+          ENDCASE
+          nticks = ceil((mnmax + 60*(hmax - hmin) - mnmin)/freq) + 2
+          mnminf = (floor(mnmin/freq))*freq
+          ticknom = dblarr(nticks)
+          for mn = 0, nticks-1 do ticknom[mn] = julday(mmin, dmin, ymin, hmin, mnminf + freq*mn, 0, _EXTRA = ex)
+          ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax, nticks)]
+          datfmt = '%H:%I' 
+        END
+; second base
+        ELSE:BEGIN ; less than 3 minutes
+          CASE 1 OF
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin, smin + 120):BEGIN ; more than 120 seconds -> ticks every 20 seconds
+            freq = 20. & tminor = 2 & datfmt = '%H:%I:%S' & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin, smin + 60):BEGIN ; more than 60 seconds -> ticks every 15 seconds
+            freq = 15. & tminor = 3 & datfmt = '%H:%I:%S' & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin, smin + 30):BEGIN ; more than 30 seconds -> ticks every 10 seconds
+            freq = 10. & tminor = 2 & datfmt = '%H:%I:%S' & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin, smin + 15):BEGIN ; more than 15 seconds -> ticks every 4 seconds
+            freq = 4. & tminor = 4 & datfmt = '%H:%I:%S' & END
+            tempsmax GT julday(mmin, dmin, ymin, hmin, mnmin, smin + 7):BEGIN ; more than 7 seconds -> ticks every 2 seconds
+            freq = 2. & tminor = 2 & datfmt = '%H:%I:%S' & END
+            ELSE:BEGIN   ; ticks every minutes
+            freq = 1. & tminor = 2 & datfmt = '%H:%I:%S' & END
+          ENDCASE
+          nticks = ceil((smax + 60*(mnmax - mnmin) - smin)/freq) + 2
+          sminf = (floor(smin/freq))*freq
+          ticknom = dblarr(nticks)
+          for s = 0, nticks-1 do ticknom[s] = julday(mmin, dmin, ymin, hmin, mnmin, sminf + freq*s, _EXTRA = ex)
+          ticknom = ticknom[where(ticknom GE tempsmin AND ticknom LE tempsmax, nticks)]
+        END
+      ENDCASE
+      dummy = label_date(0, 0, 0, DATE_FORMAT = datfmt, _EXTRA = ex)
       if chkstru(ex, 'DATE_FORMAT') then ex.DATE_FORMAT = ''
    ENDIF 
