Index: trunk/SRC/ToBeReviewed/GRILLE/domdef.pro
===================================================================
--- trunk/SRC/ToBeReviewed/GRILLE/domdef.pro	(revision 163)
+++ trunk/SRC/ToBeReviewed/GRILLE/domdef.pro	(revision 226)
@@ -4,6 +4,6 @@
 ;+
 ;
-; @file_comments 
-; Allows to extract a sub-domain of study by providing parameters 
+; @file_comments
+; Allows to extract a sub-domain of study by providing parameters
 ; needed for drawings (see outputs)
 ;
@@ -12,5 +12,5 @@
 ; @param Z1 {in}{optional}
 ; For a 3d domain whose the horizontal part cover all glam
-; 
+;
 ; @param Z2 {in}{optional}
 ; For a 3d domain whose the horizontal part cover all gphi
@@ -38,11 +38,11 @@
 ;
 ; @keyword FINDALWAYS
-; Force to redefine a box even when none point is find in the box. 
+; Force to redefine a box even when none point is find in the box.
 ; In this case, we select all the grid.
 ;
 ; @keyword GRIDTYPE {type=string or vector}
-; It is a string or a vector of strings containing the grids's name 
-; (Only determined by 'T','U','V','W','F') for which the calculation 
-; must be done. 
+; It is a string or a vector of strings containing the grids's name
+; (Only determined by 'T','U','V','W','F') for which the calculation
+; must be done.
 ;  For example: 'T' or ['T','U']
 ;
@@ -55,27 +55,26 @@
 ; grids.
 ;
-; @keyword INDEX 
-; We activate it if we want that all elements passed in input of domdef 
-; refer to indexes of glam, gphi and gdep arrays rather than to values 
+; @keyword INDEX
+; We activate it if we want that all elements passed in input of domdef
+; refer to indexes of glam, gphi and gdep arrays rather than to values
 ; of these arrays.
 ;
-; @keyword XINDEX 
-; We activate it if we want that all elements passed in input of domdef 
-; and concerning the X dimension refer to indexes of glam arrays rather 
+; @keyword XINDEX
+; We activate it if we want that all elements passed in input of domdef
+; and concerning the X dimension refer to indexes of glam arrays rather
 ; than to values of these arrays.
 ;
-; @keyword YINDEX 
-; We activate it if we want that all elements passed in input of domdef 
-; and concerning the X dimension refer to indexes of gphi arrays rather 
+; @keyword YINDEX
+; We activate it if we want that all elements passed in input of domdef
+; and concerning the X dimension refer to indexes of gphi arrays rather
 ; than to values of these arrays.
-; 
-; @keyword ZINDEX 
-; We activate it if we want that all elements passed in input of domdef 
-; and concerning the X dimension refer to indexes of gdep arrays rather 
+;
+; @keyword ZINDEX
+; We activate it if we want that all elements passed in input of domdef
+; and concerning the X dimension refer to indexes of gdep arrays rather
 ; than to values of these arrays.
 ;
 ; @uses
 ; common.pro
-;
 ;
 ; @history
@@ -123,9 +122,9 @@
 ;
   IF keyword_set(endpoints) THEN BEGIN
-    IF NOT keyword_set(type) THEN BEGIN 
+    IF NOT keyword_set(type) THEN BEGIN
       dummy = report(['If domdef is used do find the box associated' $
                       , 'to endpoints, you must also specify type keyword'])
       return
-    ENDIF 
+    ENDIF
     CASE N_PARAMS() OF
       0:
@@ -137,5 +136,5 @@
     section, BOXZOOM = boxzoom, ENDPOINTS = endpoints, TYPE = type, /ONLYBOX
     return
-  ENDIF   
+  ENDIF
 
 ;-------------------------------------------------------------------
@@ -153,5 +152,5 @@
       END
     ENDCASE
-    RETURN  
+    RETURN
   ENDIF
 ;-------------------------------------------------------------------
@@ -170,21 +169,21 @@
   vert1t = 99999. & vert2t = -99999. & vert1w = 99999. & vert2w = -99999.
 ;
-  IF jpj EQ 1 THEN BEGIN 
+  IF jpj EQ 1 THEN BEGIN
     IF (where(gridtype eq 'T'))[0] NE -1 OR (where(gridtype EQ 'W'))[0] NE -1 THEN BEGIN
       glamt = reform(glamt, jpi, jpj, /over)
       gphit = reform(gphit, jpi, jpj, /over)
-    ENDIF 
+    ENDIF
     IF (where(gridtype eq 'U'))[0] NE -1 THEN BEGIN
       glamu = reform(glamu, jpi, jpj, /over)
       gphiu = reform(gphiu, jpi, jpj, /over)
-    ENDIF  
+    ENDIF
     IF (where(gridtype eq 'V'))[0] NE -1 THEN BEGIN
       glamv = reform(glamv, jpi, jpj, /over)
       gphiv = reform(gphiv, jpi, jpj, /over)
-    ENDIF  
+    ENDIF
     IF (where(gridtype eq 'F'))[0] NE -1 THEN BEGIN
       glamf = reform(glamf, jpi, jpj, /over)
       gphif = reform(gphif, jpi, jpj, /over)
-    ENDIF  
+    ENDIF
   ENDIF
 ;
@@ -229,5 +228,5 @@
          AND NOT keyword_set(xindex) AND NOT keyword_set(yindex) AND NOT keyword_set(index) ) THEN BEGIN
     IF N_PARAMS() EQ 0 THEN BEGIN
-; find lon1 and lon2 the longitudinal boudaries of the full domain
+; find lon1 and lon2 the longitudinal boundaries of the full domain
       IF (where(gridtype eq 'T'))[0] NE -1 THEN lon1t = min(glamt, max = lon2t)
       IF (where(gridtype eq 'W'))[0] NE -1 AND (where(gridtype eq 'T'))[0] EQ -1 THEN lon1t = min(glamt, max = lon2t)
@@ -237,5 +236,5 @@
       lon1 = min([lon1t, lon1u, lon1v, lon1f])
       lon2 = max([lon2t, lon2u, lon2v, lon2f])
-; find lat1 and lat2 the latitudinal boudaries of the full domain
+; find lat1 and lat2 the latitudinal boundaries of the full domain
       IF (where(gridtype eq 'T'))[0] NE -1 THEN lat1t = min(gphit, max = lat2t)
       IF (where(gridtype eq 'W'))[0] NE -1 AND (where(gridtype eq 'T'))[0] EQ -1 THEN lat1t = min(gphit, max = lat2t)
@@ -245,5 +244,5 @@
       lat1 = min([lat1t, lat1u, lat1v, lat1f])
       lat2 = max([lat2t, lat2u, lat2v, lat2f])
-    ENDIF ELSE BEGIN 
+    ENDIF ELSE BEGIN
       lon1 = min([x1, x2], max = lon2)
       lat1 = min([y1, y2], max = lat2)
@@ -288,5 +287,5 @@
         IF (dom[0] EQ -1) THEN BEGIN
           IF keyword_set(findalways) THEN BEGIN
-; if t grid parameters alreday defined, we use them... 
+; if t grid parameters alreday defined, we use them...
             CASE 1 OF
               (where(gridtype eq 'T'))[0] NE -1 OR (where(gridtype EQ 'W'))[0] NE -1:BEGIN
@@ -337,10 +336,10 @@
                 firstxv = firstxt & lastxv = lastxt & nxv = nxt
                 firstyv = firstyt & lastyv = lastyt & nyv = nyt
-              END 
+              END
               (where(gridtype eq 'U'))[0] NE -1:BEGIN
                 print, 'WARNING, empty V points box... we use the same index as U points...'
                 firstxv = firstxu & lastxv = lastxu & nxv = nxu
                 firstyv = firstyu & lastyv = lastyu & nyv = nyu
-              END 
+              END
               ELSE:BEGIN
                 print, 'WARNING, empty V points box... we get the neighnors to define a new box...'
@@ -385,15 +384,15 @@
                 firstxf = firstxt & lastxf = lastxt & nxf = nxt
                 firstyf = firstyt & lastyf = lastyt & nyf = nyt
-              END 
+              END
               (where(gridtype eq 'U'))[0] NE -1:BEGIN
                 print, 'WARNING, empty F points box... we use the same index as U points...'
                 firstxf = firstxu & lastxf = lastxu & nxf = nxu
                 firstyf = firstyu & lastyf = lastyu & nyf = nyu
-              END 
+              END
               (where(gridtype eq 'V'))[0] NE -1:BEGIN
                 print, 'WARNING, empty F points box... we use the same index as V points...'
                 firstxf = firstxv & lastxf = lastxv & nxf = nxv
                 firstyf = firstyv & lastyf = lastyv & nyf = nyv
-              END 
+              END
               ELSE:BEGIN
                 print, 'WARNING, empty F points box... we get the neighnors to define a new box...'
@@ -406,5 +405,5 @@
                 RETURN
               END
-            ENDCASE  
+            ENDCASE
           ENDIF ELSE BEGIN
             ras = report('WARNING, The box does not contain any F points...')
@@ -469,5 +468,5 @@
           firstyv = fsty & lastyv = lsty
           nxv = nx & nyv = ny
-        ENDIF         
+        ENDIF
 ; find lon1f, lon2f, lat1f, lat2f, firstxf, firstxf, nxf and nyf
 ; according to x1, x2, y1, y2
@@ -537,5 +536,5 @@
                     print, 'WARNING, empty U points box... we use the same index as T points...'
                     firstyu = firstyt & lastyu = lastyt & nyu = nyt
-                  END 
+                  END
                   ELSE:BEGIN
                     print, 'WARNING, empty U points box... we get the neighnors to define a new box...'
@@ -548,5 +547,5 @@
                     RETURN
                   END
-                ENDCASE 
+                ENDCASE
               ENDIF ELSE BEGIN
                 ras = report('WARNING, The box does not contain any U points...')
@@ -575,9 +574,9 @@
                     print, 'WARNING, empty V points box... we use the same index as T points...'
                     firstyv = firstyt & lastyv = lastyt & nyv = nyt
-                  END 
+                  END
                   (where(gridtype eq 'U'))[0] NE -1:BEGIN
                     print, 'WARNING, empty V points box... we use the same index as U points...'
                     firstyv = firstyu & lastyv = lastyu & nyv = nyu
-                  END 
+                  END
                   ELSE:BEGIN
                     print, 'WARNING, empty V points box... we get the neighnors to define a new box...'
@@ -589,6 +588,6 @@
                     ENDCASE
                     RETURN
-                  END 
-                ENDCASE 
+                  END
+                ENDCASE
               ENDIF ELSE BEGIN
                 ras = report('WARNING, The box does not contain any V points...')
@@ -617,13 +616,13 @@
                     print, 'WARNING, empty F points box... we use the same index as T points...'
                     firstyf = firstyt & lastyf = lastyt & nyf = nyt
-                  END 
+                  END
                   (where(gridtype eq 'U'))[0] NE -1:BEGIN
                     print, 'WARNING, empty F points box... we use the same index as U points...'
                     firstyf = firstyu & lastyf = lastyu & nyf = nyu
-                  END 
+                  END
                   (where(gridtype eq 'V'))[0] NE -1:BEGIN
                     print, 'WARNING, empty F points box... we use the same index as V points...'
                     firstyf = firstyv & lastyf = lastyv & nyf = nyv
-                  END 
+                  END
                   ELSE:BEGIN
                     print, 'WARNING, empty F points box... we get the neighnors to define a new box...'
@@ -636,5 +635,5 @@
                     RETURN
                   END
-                ENDCASE 
+                ENDCASE
               ENDIF ELSE BEGIN
                 ras = report('WARNING, The box does not contain any F points...')
@@ -705,5 +704,5 @@
                     print, 'WARNING, empty U points box... we use the same index as T points...'
                     firstxu = firstxt & lastxu = lastxt & nxu = nxt
-                  END 
+                  END
                   ELSE:BEGIN
                     print, 'WARNING, empty U points box... we get the neighnors to define a new box...'
@@ -716,5 +715,5 @@
                     RETURN
                   END
-                ENDCASE 
+                ENDCASE
               ENDIF ELSE BEGIN
                 ras = report('WARNING, The box does not contain any U points...')
@@ -743,9 +742,9 @@
                     print, 'WARNING, empty V points box... we use the same index as T points...'
                     firstxv = firstxt & lastxv = lastxt & nxv = nxt
-                  END 
+                  END
                   (where(gridtype eq 'U'))[0] NE -1:BEGIN
                     print, 'WARNING, empty V points box... we use the same index as U points...'
                     firstxv = firstxu & lastxv = lastxu & nxv = nxu
-                  END 
+                  END
                   ELSE:BEGIN
                     print, 'WARNING, empty V points box... we get the neighnors to define a new box...'
@@ -757,6 +756,6 @@
                     ENDCASE
                     RETURN
-                  END 
-                ENDCASE 
+                  END
+                ENDCASE
               ENDIF ELSE BEGIN
                 ras = report('WARNING, The box does not contain any V points...')
@@ -785,13 +784,13 @@
                     print, 'WARNING, empty F points box... we use the same index as T points...'
                     firstxf = firstxt & lastxf = lastxt & nxf = nxt
-                  END 
+                  END
                   (where(gridtype eq 'U'))[0] NE -1:BEGIN
                     print, 'WARNING, empty F points box... we use the same index as U points...'
                     firstxf = firstxu & lastxf = lastxu & nxf = nxu
-                  END 
+                  END
                   (where(gridtype eq 'V'))[0] NE -1:BEGIN
                     print, 'WARNING, empty F points box... we use the same index as V points...'
                     firstxf = firstxv & lastxf = lastxv & nxf = nxv
-                  END 
+                  END
                   ELSE:BEGIN
                     print, 'WARNING, empty F points box... we get the neighnors to define a new box...'
@@ -803,6 +802,6 @@
                     ENDCASE
                     RETURN
-                  END 
-                ENDCASE 
+                  END
+                ENDCASE
               ENDIF ELSE BEGIN
                 ras = report('WARNING, The box does not contain any F points...')
@@ -821,11 +820,11 @@
       END
     ENDCASE
-  ENDELSE 
-;-------------------------------------------------------------------
-; The extracted domain is it regular or not? 
+  ENDELSE
+;-------------------------------------------------------------------
+; The extracted domain is it regular or not?
 ;-------------------------------------------------------------------
   CASE 1 OF
     ((where(gridtype eq 'T'))[0] NE -1 OR (where(gridtype eq 'W'))[0] NE -1) AND nxt NE 0 AND nyt NE 0:BEGIN
-; to get faster, we first test the most basic cases befor testing the
+; to get faster, we first test the most basic cases before testing the
 ; full array.
       CASE 0 OF
@@ -908,9 +907,9 @@
         firstzt = domz[0]
         lastzt = domz[nzt-1]
-      ENDIF ELSE BEGIN 
+      ENDIF ELSE BEGIN
         ras = report('WARNING, The box does not contain any T level...')
         firstzt = -1
         lastzt = -1
-      ENDELSE 
+      ENDELSE
     ENDIF
 ; define firstzw, firstzw, nzw
@@ -920,20 +919,20 @@
         lastzw = lastzt
         nzw = nzt
-      ENDIF ELSE BEGIN 
+      ENDIF ELSE BEGIN
         domz = where(gdepw ge vert1 and gdepw le vert2, nzw)
         IF nzw NE 0 THEN BEGIN
           firstzw = domz[0]
           lastzw = domz[nzw-1]
-        ENDIF ELSE BEGIN 
+        ENDIF ELSE BEGIN
           ras = report('WARNING, The box does not contain any W level...')
           firstzw = -1
           lastzw = -1
-        ENDELSE 
-      ENDELSE 
+        ENDELSE
+      ENDELSE
     ENDIF
 ;-------------------------------------------------------------------
 ; vertical domain defined with the Z index
 ;-------------------------------------------------------------------
-  ENDIF ELSE BEGIN 
+  ENDIF ELSE BEGIN
     CASE N_PARAMS() OF
       2:fstz = min([x1, x2], max = lstz)
@@ -951,5 +950,5 @@
       vert1t = min(gdept[fstz:lstz], max = vert2t)
       firstzt = fstz & lastzt = lstz & nzt = nz
-    ENDIF      
+    ENDIF
 ; find vert1w, vert2w, firstzw, firstzw, nzw
 ; according to (x1, x2) or (z1, z2)
@@ -957,5 +956,5 @@
       vert1w = min(gdepw[fstz:lstz], max = vert2w)
       firstzw = fstz & lastzw = lstz & nzw = nz
-    ENDIF      
+    ENDIF
     vert1 = min([vert1t, vert1w])
     vert2 = max([vert2t, vert2w])
@@ -965,7 +964,7 @@
   IF NOT keyword_set(key_forgetold) THEN BEGIN
 @updateold
-  ENDIF 
-;-------------------------------------------------------------------
-  if keyword_set(key_performance) THEN print, 'temps domdef', systime(1)-tempsun 
+  ENDIF
+;-------------------------------------------------------------------
+  if keyword_set(key_performance) THEN print, 'temps domdef', systime(1)-tempsun
 ;-------------------------------------------------------------------
 
