Index: trunk/SRC/Grid/computegrid.pro
===================================================================
--- trunk/SRC/Grid/computegrid.pro	(revision 251)
+++ trunk/SRC/Grid/computegrid.pro	(revision 252)
@@ -101,8 +101,7 @@
 ;
 ; @keyword PLAIN {default=0}{type=scalar: 0 or 1}
-;       Force PERIODIC = 0, SHIFT = 0, STRIDE = [1, 1, 1] and
-;       suppress the automatic redefinition of the domain in case of
-;       x periodicity overlap, y periodicity overlap (ORCA type only)
-;       and mask border to 0.
+;       Force YREVERSE = 0, ZREVERSE = 0, PERIODIC = 0, SHIFT = 0, STRIDE = [1, 1, 1] and
+;       suppress the automatic redefinition of the domain in case of x periodicity overlap,
+;       y periodicity overlap (ORCA type only) and mask border to 0.
 ;
 ; @keyword SHIFT {default=computed according to glamboundary}{type=scalar}
@@ -208,6 +207,14 @@
 ;       Used by xxx...
 ;
+; @keyword YREVERSE {default=computed according to gphit[0, 1:jpj-1] LT gphit[0, 0:jpj-2]}{type=scalar}
+;       Force the manual definition of the y reverse that must be apply to the data.
+;       The resulting value will be stored in the common (cm_4mesh) variable key_yreverse
+;
 ; @keyword ZAXIS {type=1D}
 ;       Specify the vertical axis. Must be sorted in the increasing or decreasing order
+;
+; @keyword ZREVERSE {default=computed according to gdept[0] GT gdept[1]}{type=scalar}
+;       Force the manual definition of the z reverse that must be apply to the data.
+;       The resulting value will be stored in the common (cm_4mesh) variable key_zreverse
 ;
 ; @keyword _EXTRA
@@ -219,4 +226,5 @@
 ; cm_4cal
 ;
+
 ; @restrictions
 ; if the grid has x/y periodicity overlap and/or if
@@ -249,4 +257,5 @@
                  , ONEARTH = onearth, PERIODIC = periodic $
                  , PLAIN = plain, SHIFT = shift, STRIDE = stride $
+                 , YREVERSE = yreverse, ZREVERSE = zreverse  $
                  , FULLCGRID = fullcgrid, XYINDEX = xyindex $
                  , UBASE2TBASE = ubase2tbase, VBASE2TBASE = vbase2tbase, FBASE2TBASE = fbase2tbase $
@@ -356,4 +365,6 @@
 ;
   IF keyword_set(plain) THEN BEGIN
+    yreverse = 0
+    zreverse = 0
     periodic = 0
     shift = 0
@@ -499,5 +510,5 @@
 ;====================================================
 ; check the peridicity if iyminmesh and iymaxmesh have the default definitions...
-  IF NOT keyword_set(plain) AND key_onearth EQ 1 AND key_stride[1] EQ 1 $
+  IF NOT keyword_set(plain) AND key_onearth EQ 1 $
     AND iyminmesh EQ 0l AND iymaxmesh eq jpjglo-1 AND jpj GE 3 AND jpi GE 2 THEN BEGIN
 
@@ -537,5 +548,5 @@
 ; check the peridicity if ixminmesh and ixmaxmesh have the default definitions...
   IF NOT keyword_set(plain) AND NOT keyword_set(forcenoperio) AND key_onearth EQ 1 $
-     AND key_stride[0] EQ 1 AND ixminmesh EQ 0l AND ixmaxmesh eq jpiglo-1 AND jpi GE 3 THEN BEGIN
+     AND ixminmesh EQ 0l AND ixmaxmesh eq jpiglo-1 AND jpi GE 3 THEN BEGIN
     CASE 0 OF
       total((glamt[0, *] - glamt[jpi-2, *]) MOD 360) $
@@ -576,11 +587,13 @@
 ;====================================================
 ;
-  IF jpj GT 1 THEN BEGIN
-    IF total(gphit[0, 1:jpj-1] LT gphit[0, 0:jpj-2]) GT jpj/2 THEN BEGIN
-      key_yreverse = 1
-      gphit = reverse(gphit, 2)
-      glamt = reverse(glamt, 2)
+  IF n_elements(yreverse) EQ 0 THEN BEGIN 
+    IF jpj GT 1 THEN BEGIN
+      IF total(gphit[0, 1:jpj-1] LT gphit[0, 0:jpj-2]) GT jpj/2 THEN key_yreverse = 1 ELSE key_yreverse = 0
     ENDIF ELSE key_yreverse = 0
-  ENDIF ELSE key_yreverse = 0
+  ENDIF ELSE key_yreverse = yreverse
+  IF keyword_set(key_yreverse) THEN BEGIN
+    gphit = reverse(gphit, 2)
+    glamt = reverse(glamt, 2)
+  ENDIF
 ;
 ;====================================================
@@ -978,10 +991,10 @@
       ELSE:BEGIN
         gdept = zaxis[izminmesh:izmaxmesh]
-        IF jpk GT 1 THEN BEGIN
-          if gdept[0] GT gdept[1] then begin
-            gdept = reverse(gdept)
-            key_zreverse = 1
+        IF n_elements(zreverse) EQ 0 THEN BEGIN
+          IF jpk GT 1 THEN BEGIN
+            if gdept[0] GT gdept[1] then key_zreverse = 1 ELSE key_zreverse = 0
           ENDIF ELSE key_zreverse = 0
-        ENDIF ELSE key_zreverse = 0
+        ENDIF ELSE key_zreverse = zreverse
+        IF keyword_set(key_zreverse) THEN gdept = reverse(gdept)
       END
     ENDCASE
@@ -1125,4 +1138,10 @@
       glamf = glamt + 0.5 * stepxf
     ENDIF ELSE glamf = glamt + 0.5
+    IF keyword_set(key_periodic) AND (max(glamf)-min(glamt)) GE 360 THEN BEGIN
+      IF NOT keyword_set(glamboundary) THEN BEGIN
+        bigger = where(glamf GE min(glamt)+360)
+        glamf[bigger] = glamf[bigger]-360.
+      ENDIF ELSE glamf = glamboundary[0] > temporary(glamf) < glamboundary[1]
+    ENDIF
     IF jpj GT 1 THEN BEGIN
 ; we must compute stepyf: y distance between T(i,j) T(i+1,j+1)
