Index: trunk/SRC/Interpolation/compute_fromreg_bilinear_weigaddr.pro
===================================================================
--- trunk/SRC/Interpolation/compute_fromreg_bilinear_weigaddr.pro	(revision 121)
+++ trunk/SRC/Interpolation/compute_fromreg_bilinear_weigaddr.pro	(revision 125)
@@ -1,16 +1,17 @@
 ;+
-; @file_comments compute the weight and address needed to interpolate data from a
-;          "regular grid" to any grid using the bilinear method
-;   
+; @file_comments 
+; compute the weight and address needed to interpolate data from a
+; "regular grid" to any grid using the bilinear method
+;
 ; @categories interpolation
 ;
-; @param alonin {in}{required} longitudeof the input data 
-; @param alatin  {in}{required} latitude of the input data 
-; @param olonin {in}{required} longitude of the output data 
-; @param olat  {in}{required} latitude of the output data 
-;
-; @keyword     /NONORTHERNLINE activate if you don't whant to take into
+; @param alonin {in}{required} longitudeof the input data
+; @param alatin  {in}{required} latitude of the input data
+; @param olonin {in}{required} longitude of the output data
+; @param olat  {in}{required} latitude of the output data
+;
+; @keyword NONORTHERNLINE activate if you don't want to take into
 ;          account the northen line of the input data when perfoming the
-; @keyword     /NOSOUTHERNLINE activate if you don't whant to take into
+; @keyword NOSOUTHERNLINE activate if you don't want to take into
 ;          account the southern line of the input data when perfoming the
 ;          interpolation.
@@ -24,21 +25,18 @@
 ;
 ; @restrictions
-;  -  the input grid must be a "regular grid", defined as a grid for which each
-;     lontitudes lines have the same latitude and each latitudes columns have the
-;     same longitude.
-;  -  We supposed the data are located on a sphere, with a periodicity along
-;     the longitude.
-;  -  points located out of the southern and northern boundaries are interpolated
-;     using a linear interpolation only along the longitudinal direction.
-; 
+;  - the input grid must be a "regular grid", defined as a grid for which each
+;  lontitudes lines have the same latitude and each latitudes columns have the
+;  same longitude.
+;  - We supposed the data are located on a sphere, with a periodicity along
+;  the longitude.
+;  - points located out of the southern and northern boundaries are interpolated
+;  using a linear interpolation only along the longitudinal direction.
+;
 ; @history
-;  November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 
-; 
+;  November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr)
+;
 ; @version $Id$
 ;
 ;-
-;
-;----------------------------------------------------------
-;----------------------------------------------------------
 ;
 PRO compute_fromreg_bilinear_weigaddr, alonin, alatin, olonin, olat, weig, addr $
@@ -61,11 +59,11 @@
   IF maxalon-minalon GE 360. THEN stop
 ; alon must be monotonically increasing
-  IF array_equal(sort(alon), lindgen(jpia)) NE 1 THEN BEGIN 
+  IF array_equal(sort(alon), lindgen(jpia)) NE 1 THEN BEGIN
     shiftx = -(where(alon EQ min(alon)))[0]
     alon = shift(alon, shiftx)
     IF array_equal(sort(alon), lindgen(jpia)) NE 1 THEN stop
   ENDIF ELSE shiftx = 0
-; for longitude periodic bondary condition we add the fist
-; column on the right side of the array and 
+; for longitude periodic boundary condition we add the fist
+; column on the right side of the array and
   alon = [alon, alon[0]+360.]
   jpia = jpia+1L
@@ -76,9 +74,9 @@
   IF array_equal(sort(alat), lindgen(jpja)) NE 1 THEN stop
 ;
-  if keyword_set(nonorthernline) then BEGIN 
+  if keyword_set(nonorthernline) then BEGIN
     jpja = jpja - 1L
     alat = alat[0: jpja-1L]
   ENDIF
-  if keyword_set(nosouthernline) then BEGIN 
+  if keyword_set(nosouthernline) then BEGIN
     alat = alat[1: jpja-1L]
     jpja = jpja - 1L
@@ -103,5 +101,5 @@
 ; if the ocean point is out of the atm grid, we use closest neighbor
 ; interpolation
-; 
+;
 ; for each T point of oce grid, we find in which armospheric cell it is
 ; located.
@@ -113,9 +111,9 @@
 ; for longitude, each ocean points must be located in atm cell.
   IF (where(pos[0, *] EQ -1))[0] NE -1 THEN stop
-; no ocean point should be located westward of the left bondary of the
-; atm cell in which it is supposed to be located 
+; no ocean point should be located westward of the left boundary of the
+; atm cell in which it is supposed to be located
   IF total(olon LT alon[pos[0, *]]) NE 0 THEN stop
-; no ocean point should be located eastward of the right bondary of the
-; atm cell in which it is supposed to be located 
+; no ocean point should be located eastward of the right boundary of the
+; atm cell in which it is supposed to be located
   IF total(olon GT alon[pos[0, *]+1]) NE 0 THEN stop
 ;
@@ -124,5 +122,5 @@
 ; we change the coordinates of each ocean points to fit into a
 ; rectangle defined by:
-; 
+;
 ;  y2 *------------*
 ;     |            |
@@ -143,5 +141,5 @@
   IF max(indx) GT jpia-2 THEN stop ; checks...
   IF max(indy) GT jpja-2 THEN stop ; checks...
-; x coordinates of the atm cell 
+; x coordinates of the atm cell
   x1 = alon[indx]
   x2 = alon[indx+1]
@@ -149,7 +147,7 @@
   divi = temporary(x2)-x1
   glamnew = (olon-x1)/temporary(divi)
-  x1 = -1 ; free memory 
-  olon = -1 ; free memory 
-; y coordinates of the atm cell 
+  x1 = -1 ; free memory
+  olon = -1 ; free memory
+; y coordinates of the atm cell
   y1 = alat[indy]
   y2 = alat[indy+1]             ;
@@ -159,5 +157,5 @@
   IF zero[0] NE -1 THEN divi[zero] = 1.
   gphinew = (olat-y1)/temporary(divi)
-  y1 = -1 ; free memory 
+  y1 = -1 ; free memory
 ; checks...
   IF min(glamnew) LT 0 THEN stop
@@ -166,9 +164,9 @@
 ; weight and address array used for bilinear interpolation.
   xaddr = lonarr(4, jpio*jpjo)
-  xaddr[0, *] = indx  
+  xaddr[0, *] = indx
   xaddr[1, *] = indx + 1L
   xaddr[2, *] = indx + 1L
-  xaddr[3, *] = indx  
-; 
+  xaddr[3, *] = indx
+;
   yaddr = lonarr(4, jpio*jpjo)
   yaddr[0, *] = indy
@@ -181,5 +179,5 @@
   weig[1, *] =     glamnew  * (1.-gphinew)
   weig[2, *] =     glamnew  *     gphinew
-  weig[3, *] = (1.-glamnew) *     gphinew 
+  weig[3, *] = (1.-glamnew) *     gphinew
 ; free memory
   gphinew = -1
@@ -190,6 +188,6 @@
     ybad = olat[bad]
 ; the ocean points that are not located into an atm cell should be
-; located northward of the northern boundary of the atm grid 
-;      or southward of the southern boundary of the atm grid 
+; located northward of the northern boundary of the atm grid
+;      or southward of the southern boundary of the atm grid
     IF total(ybad GE min(alat) AND ybad LE max(alat)) GE 1 THEN stop
 ;
@@ -223,5 +221,5 @@
   IF revy EQ 1 THEN yaddr = jpja - 1L - temporary(yaddr)
 ;                         ;
-  addr = temporary(yaddr)*jpia + temporary(xaddr) 
+  addr = temporary(yaddr)*jpia + temporary(xaddr)
 ;
   return
