Index: /trunk/SRC/ToBeReviewed/CALCULS/grossemoyenne.pro
===================================================================
--- /trunk/SRC/ToBeReviewed/CALCULS/grossemoyenne.pro	(revision 423)
+++ /trunk/SRC/ToBeReviewed/CALCULS/grossemoyenne.pro	(revision 424)
@@ -20,4 +20,11 @@
 ; [vert2], [vert1, vert2],[lon1, lon2, lat1, lat2],
 ; [lon1, lon2, lat1, lat2, vert2],[lon1, lon2, lat1, lat2, vert1,vert2]
+;
+; @keyword KEEPBOTTOM {default=0}{type=scalar: 0 or 1}
+; used only with partial steps (key_partialstep /= 0). In partial
+; steps, bottom points are not located at the same depth => they
+; should not be averaged together along x and/or y direction if there
+; is no average along z. In this case bottom ponts are set to
+;!values.f_nan before doing any call to total.
 ;
 ; @keyword NAN
@@ -81,5 +88,5 @@
 ;
 ;-
-FUNCTION grossemoyenne, tab, direc, BOXZOOM=boxzoom, INTEGRATION=integration $
+FUNCTION grossemoyenne, tab, direc, BOXZOOM=boxzoom, INTEGRATION=integration, KEEPBOTTOM = keepbottom $
                       , NAN=nan, NODOMDEF=nodomdef, WDEPTH=wdepth $
                       , SPATIALFIRST=spatialfirst, TEMPORALFIRST=temporalfirst $
@@ -387,5 +394,5 @@
         echelle = reform(echelle, nx, ny, nz, jpt, /over)
         IF keyword_set(key_partialstep) AND bottom[0] NE -1 $
-          AND nx NE 1 THEN BEGIN
+          AND nx NE 1 AND NOT keyword_set(keepbottom) THEN BEGIN
           IF msknan[0] EQ -1 THEN BEGIN
             msknan = replicate(1b, nx, ny, nz, jpt)
@@ -416,5 +423,5 @@
         echelle = reform(echelle, nx, ny, nz, jpt, /over)
         IF keyword_set(key_partialstep) AND bottom[0] NE -1 $
-          AND ny NE 1 THEN BEGIN
+          AND ny NE 1 AND NOT keyword_set(keepbottom) THEN BEGIN
           IF msknan[0] EQ -1 THEN BEGIN
             msknan = replicate(1b, nx, ny, nz, jpt)
@@ -468,5 +475,5 @@
         echelle = reform(echelle, nx, ny, nz, jpt, /over)
         IF keyword_set(key_partialstep) AND bottom[0] NE -1 $
-          AND nx*ny NE 1 THEN BEGIN
+          AND nx*ny NE 1 AND NOT keyword_set(keepbottom) THEN BEGIN
           IF msknan[0] EQ -1 THEN BEGIN
             msknan = replicate(1b, nx, ny, nz, jpt)
Index: /trunk/SRC/ToBeReviewed/CALCULS/moyenne.pro
===================================================================
--- /trunk/SRC/ToBeReviewed/CALCULS/moyenne.pro	(revision 423)
+++ /trunk/SRC/ToBeReviewed/CALCULS/moyenne.pro	(revision 424)
@@ -23,4 +23,11 @@
 ;  [lon1, lon2, lat1, lat2, vert1,vert2]
 ;
+; @keyword KEEPBOTTOM {default=0}{type=scalar: 0 or 1}
+; used only with partial steps (key_partialstep /= 0). In partial
+; steps, bottom points are not located at the same depth => they
+; should not be averaged together along x and/or y direction if there
+; is no average along z. In this case bottom ponts are set to
+;!values.f_nan before doing any call to total.
+;
 ; @keyword NAN
 ; not a number, we activate it if we want to average without considerate some masked values of TAB.
@@ -65,7 +72,6 @@
 ;
 ;-
-FUNCTION moyenne, tab, direc, BOXZOOM=boxzoom, INTEGRATION=integration $
-                , NAN=nan, NODOMDEF=nodomdef, WDEPTH=wdepth $
-                , _EXTRA=ex
+FUNCTION moyenne, tab, direc, BOXZOOM=boxzoom, INTEGRATION=integration, KEEPBOTTOM = keepbottom $
+                , NAN=nan, NODOMDEF=nodomdef, WDEPTH=wdepth, _EXTRA=ex
 ;
   compile_opt idl2, strictarrsubs
@@ -363,5 +369,5 @@
         e13 = reform(e13, nx, ny, nz, /over)
         IF keyword_set(key_partialstep) AND bottom[0] NE -1 $
-          AND nx NE 1 THEN BEGIN
+          AND nx NE 1 AND NOT keyword_set(keepbottom) THEN BEGIN
           IF msknan[0] EQ -1 THEN BEGIN
             msknan = replicate(1b, nx, ny, nz)
@@ -391,5 +397,5 @@
         e23 = reform(e23, nx, ny, nz, /over)
         IF keyword_set(key_partialstep) AND bottom[0] NE -1 $
-          AND ny NE 1 THEN BEGIN
+          AND ny NE 1 AND NOT keyword_set(keepbottom) THEN BEGIN
           IF msknan[0] EQ -1 THEN BEGIN
             msknan = replicate(1b, nx, ny, nz)
@@ -443,5 +449,5 @@
         e123 = reform(e123, nx, ny, nz, /over)
         IF keyword_set(key_partialstep) AND bottom[0] NE -1 $
-          AND nx*ny NE 1 THEN BEGIN
+          AND nx*ny NE 1 AND NOT keyword_set(keepbottom) THEN BEGIN
           IF msknan[0] EQ -1 THEN BEGIN
             msknan = replicate(1b, nx, ny, nz)
