Index: trunk/SRC/Computation/grad.pro
===================================================================
--- trunk/SRC/Computation/grad.pro	(revision 168)
+++ trunk/SRC/Computation/grad.pro	(revision 226)
@@ -13,5 +13,5 @@
 ; 3D (xyz or yt) or 4D (xyzt) array or a structure readable by litchamp
 ; and containing a 2D (xy), 3D (xyz or yt) or 4D (xyzt) array.
-; note that the dimension of the arry must suit the domain dimension.
+; note that the dimension of the array must suit the domain dimension.
 ;
 ; @param DIREC {type=scalar string}
@@ -22,13 +22,13 @@
 ;
 ; @uses
-; cm_4cal, cm_4data, cm_4mmesh 
+; cm_4cal, cm_4data, cm_4mmesh
 ;
 ; @restrictions
-; - Works only for Arakawa C-grid. 
+; - Works only for Arakawa C-grid.
 ; - When computing the gradient, the result is not on the same grid point
 ;   than the input data. In consequence, we update, vargrid and the grid position
 ;   parameters (firstx[tuvf], lastx[tuvf], nx[tuvf], firsty[tuvf], lasty[tuvf],
 ;   ny[tuvf], firstz[tw], lastz[tw], nz[tw]).
-; - points that cannot be computed (domain bondaries, coastline) are set to NaN
+; - points that cannot be computed (domain boundaries, coastline) are set to NaN
 ; - the common variable jpt is used to differ xyz (jpt=1) and xyt (jpt\=1) cases.
 ;
@@ -54,5 +54,5 @@
 @cm_4cal   ; for jpt
 @cm_4data  ; for varname, vargrid, vardate, varunit, valmask
-@cm_4mesh 
+@cm_4mesh
 ;------------------------------------------------------------
 ;
@@ -64,5 +64,5 @@
   szres = size(res)
   grille, mask, glam, gphi, gdep, nx, ny, nz $
-          , firstx, firsty, firstz, lastx, lasty, lastz     
+          , firstx, firsty, firstz, lastx, lasty, lastz
 ;
   if n_elements(valmask) EQ 0 then valmask = 1.e20
@@ -72,9 +72,9 @@
     'T':BEGIN
       case direc of
-        'x':BEGIN 
+        'x':BEGIN
           divi = e1u[firstx:lastx, firsty:lasty]
           newmask = (umask())[firstx:lastx, firsty:lasty, firstz:lastz]
           vargrid = 'U'
-          firstxu = firstxt & lastxu = lastxt & nxu = nxt 
+          firstxu = firstxt & lastxu = lastxt & nxu = nxt
           firstyu = firstyt & lastyu = lastyt & nyu = nyt
         END
@@ -83,5 +83,5 @@
           newmask = (vmask())[firstx:lastx, firsty:lasty, firstz:lastz]
           vargrid = 'V'
-          firstxv = firstxt & lastxv = lastxt & nxv = nxt 
+          firstxv = firstxt & lastxv = lastxt & nxv = nxt
           firstyv = firstyt & lastyv = lastyt & nyv = nyt
         END
@@ -90,5 +90,5 @@
           newmask = mask
           vargrid = 'W'
-          firstzw = firstzt & lastzw = lastzt & nzw = nzt 
+          firstzw = firstzt & lastzw = lastzt & nzw = nzt
         END
         ELSE:return, report('Bad definition of direction argument')
@@ -97,9 +97,9 @@
     'W':BEGIN
       case direc of
-        'x':BEGIN 
+        'x':BEGIN
           divi = e1u[firstx:lastx, firsty:lasty]
           newmask = (umask())[firstx:lastx, firsty:lasty, firstz:lastz]
           vargrid = 'U'
-          firstxu = firstxt & lastxu = lastxt & nxu = nxt 
+          firstxu = firstxt & lastxu = lastxt & nxu = nxt
           firstyu = firstyt & lastyu = lastyt & nyu = nyt
         END
@@ -108,5 +108,5 @@
           newmask = (vmask())[firstx:lastx, firsty:lasty, firstz:lastz]
           vargrid = 'V'
-          firstxv = firstxt & lastxv = lastxt & nxv = nxt 
+          firstxv = firstxt & lastxv = lastxt & nxv = nxt
           firstyv = firstyt & lastyv = lastyt & nyv = nyt
         END
@@ -115,5 +115,5 @@
           newmask = mask
           vargrid = 'T'
-          firstzt = firstzw & lastzt = lastzw & nzt = nzw 
+          firstzt = firstzw & lastzt = lastzw & nzt = nzw
         END
         ELSE:return, report('Bad definition of direction argument')
@@ -126,5 +126,5 @@
           newmask = tmask[firstx:lastx, firsty:lasty, firstz:lastz]
           vargrid = 'T'
-          firstxt = firstxu & lastxt = lastxu & nxt = nxu 
+          firstxt = firstxu & lastxt = lastxu & nxt = nxu
           firstyt = firstyu & lastyt = lastyu & nyt = nyu
         END
@@ -133,5 +133,5 @@
           newmask = (fmask())[firstx:lastx, firsty:lasty, firstz:lastz]
           vargrid = 'F'
-          firstxf = firstxu & lastxf = lastxu & nxf = nxu 
+          firstxf = firstxu & lastxf = lastxu & nxf = nxu
           firstyf = firstyu & lastyf = lastyu & nyf = nyu
         END
@@ -140,5 +140,5 @@
           newmask = mask
           vargrid = 'W'
-          firstzw = firstzt & lastzw = lastzt & nzw = nzt 
+          firstzw = firstzt & lastzw = lastzt & nzw = nzt
         END
         ELSE:return, report('Bad definition of direction argument')
@@ -165,5 +165,5 @@
           newmask = mask
           vargrid = 'W'
-          firstzw = firstzt & lastzw = lastzt & nzw = nzt 
+          firstzw = firstzt & lastzw = lastzt & nzw = nzt
         END
         ELSE:return, report('Bad definition of direction argument')
@@ -191,13 +191,13 @@
       if land[0] NE -1 then res[temporary(land)] = !values.f_nan
       case direc of
-        'x':BEGIN 
+        'x':BEGIN
           res = (shift(res, -1, 0)-res)/temporary(divi)
           if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *] = !values.f_nan
           if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(temporary(res), 1, 0)
         END
-        'y':BEGIN 
+        'y':BEGIN
           res = (shift(res, 0, -1)-res)/temporary(divi)
           res[*, ny-1] = !values.f_nan
-          if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1)           
+          if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1)
         END
         ELSE:return,  report('Bad definition of direction argument for the type of array')
@@ -217,13 +217,13 @@
       divi = (temporary(divi))[*]#replicate(1., jpt)
       case direc of
-        'x':BEGIN 
+        'x':BEGIN
           res = (shift(res, -1, 0, 0)-res)/temporary(divi)
           if key_periodic EQ 0 OR nx NE jpi THEN res[nx-1, *, *] = !values.f_nan
           if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(temporary(res), 1, 0, 0)
         END
-        'y':BEGIN 
+        'y':BEGIN
           res = (shift(res, 0, -1, 0)-res)/temporary(divi)
           res[*, ny-1, *] = !values.f_nan
-          if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0)        
+          if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0)
         END
         ELSE:return,  report('Bad definition of direction argument for the type of array')
@@ -242,5 +242,5 @@
       if land[0] NE -1 then res[temporary(land)] = !values.f_nan
       case direc OF
-        'x':BEGIN 
+        'x':BEGIN
           divi = (temporary(divi))[*]#replicate(1., nz)
           res = (shift(res, -1, 0, 0)-res)/temporary(divi)
@@ -248,14 +248,14 @@
           if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(temporary(res), 1, 0, 0)
         END
-        'y':BEGIN 
+        'y':BEGIN
           divi = (temporary(divi))[*]#replicate(1., nz)
           res = (shift(res, 0, -1, 0)-res)/temporary(divi)
           res[*, ny-1, *] = !values.f_nan
-          if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0)        
+          if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0)
         END
         'z':BEGIN
           divi = replicate(1., nx*ny)#(temporary(divi))[*]
           if nx EQ 1 OR ny EQ 1 then res = reform(res, nx, ny, nz, /overwrite)
-          if vargrid EQ 'W' THEN BEGIN 
+          if vargrid EQ 'W' THEN BEGIN
             res = (shift(res, 0, 0, 1)-res)/temporary(divi)
             res[*, *, 0] = !values.f_nan
@@ -279,5 +279,5 @@
       ENDIF
       case direc OF
-        'x':BEGIN 
+        'x':BEGIN
           divi = (temporary(divi))[*]#replicate(1., nz*jpt)
           res = (shift(res, -1, 0, 0, 0)-res)/temporary(divi)
@@ -285,9 +285,9 @@
           if vargrid EQ 'T' OR vargrid EQ 'V' then res = shift(temporary(res), 1, 0, 0, 0)
         END
-        'y':BEGIN 
+        'y':BEGIN
           divi = (temporary(divi))[*]#replicate(1., nz*jpt)
           res = (shift(res, 0, -1, 0, 0)-res)/temporary(divi)
           res[*, ny-1, *, *] = !values.f_nan
-          if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0, 0)        
+          if vargrid EQ 'T' OR vargrid EQ 'U' then res = shift(temporary(res), 0, 1, 0, 0)
         END
         'z':BEGIN
@@ -295,5 +295,5 @@
           divi = (temporary(divi))[*]#replicate(1L, jpt)
           if nx EQ 1 OR ny EQ 1 then res = reform(res, nx, ny, nz, jpt, /overwrite)
-          if vargrid EQ 'W' THEN BEGIN 
+          if vargrid EQ 'W' THEN BEGIN
             res = (shift(res, 0, 0, 1, 0)-res)/temporary(divi)
             res[*, *, 0, *] = !values.f_nan
