Index: trunk/SRC/Interpolation/get_gridparams.pro
===================================================================
--- trunk/SRC/Interpolation/get_gridparams.pro	(revision 114)
+++ trunk/SRC/Interpolation/get_gridparams.pro	(revision 118)
@@ -1,57 +1,61 @@
 ;+
 ;
-; @file_comments 
+; @file_comments
 ;   1) extract from a NetCDF file the longitude, latidude, and their dimensions
-;      and make sure it is 1D or 2D arrays 
-;   
-;   or 2) given longitude and latitude arrays get their dimensions and make sure 
-;      they are 1D or 2D arrays 
+;      and make sure it is 1D or 2D arrays
+;
+;   or 2) given longitude and latitude arrays get their dimensions and make
+;  sure they are 1D or 2D arrays
 ;
 ; @categories interpolation
 ;
-; @examples 
-; 
+; @examples
+;
 ; 1) get_gridparams, file, lonname, latname, lon, lat, jpi, jpj, n_dimensions
 ;
-; or 
+; or
 ;
 ; 2) get_gridparams, lon, lat, jpi, jpj, n_dimensions
 ;
-; 1) 
-; @param in1 {in}{required}  the name of the netcdf file
-;  @param in2 {in}{required}  the name of the variable that contains the longitude in the NetCDF file
-;  @param in3 {in}{required}  the name of the variable that contains the latitude in the NetCDF file
-;  @param in4  {out} the number of points in the longitudinal direction
-;  @param in5  {out} the number of points in the latitudinal direction
+; 1)
+; @param in1 {in}{required} the name of the netcdf file
+; @param in2 {in}{required} the name of the variable that contains the longitude in the NetCDF file
+; @param in3 {in}{required} the name of the variable that contains the latitude in the NetCDF file
+; @param in4 {out} the number of points in the longitudinal direction
+; @param in5 {out} the number of points in the latitudinal direction
 ; @param in6 {out} the variable that will contain the longitudes
-;  @param in7  {out} the variable that will contain the latitudes
-;  @param in8 {out} 1 or 2 to specify if lon and lat should be 1D (jpi or jpj)
-;
-; or 
-;
-; 2) 
-; @param in1 {in}{required}  1d or 2D arrays defining longitudes and latitudes. 
-; @param in2 {in}{required}  1d or 2D arrays defining longitudes and latitudes. 
-;    Note that these arrays are also outputs and can therefore be modified. 
+; @param in7 {out} the variable that will contain the latitudes
+; @param in8 {out} 1 or 2 to specify if lon and lat should be 1D (jpi or jpj)
+;
+; or
+;
+; 2)
+; @param in1 {in}{required} 1d or 2D arrays defining longitudes and latitudes.
+; @param in2 {in}{required} 1d or 2D arrays defining longitudes and latitudes.
+;    Note that these arrays are also outputs and can therefore be modified.
 
 ; @param in1 {out} the variable that will contain the longitudes
-;  @param in2  {out} the variable that will contain the latitudes
-;  @param in3  {in} the number of points in the longitudinal direction
-;  @param in4  {in} the number of points in the latitudinal direction
-;  @param in5 {in} 1 or 2 to specify if lon and lat should be 1D (jpi or jpj)
+; @param in2 {out} the variable that will contain the latitudes
+; @param in3 {in} the number of points in the longitudinal direction
+; @param in4 {in} the number of points in the latitudinal direction
+; @param in5 {in} 1 or 2 to specify if lon and lat should be 1D (jpi or jpj)
 ;    arrays or 2D arrays (jpi,jpj). Note that of  n_dimensions = 1, then the
 ;    grid must be regular (each longitudes must be the same for all latitudes
-;    and each latitudes should be the sae for all longitudes). 
-;
-; @examples  
-; 
-; 1) ncdf_get_gridparams, 'coordinates_ORCA_R05.nc', 'glamt', 'gphit' $
+;    and each latitudes should be the sae for all longitudes).
+;
+; @keyword /DOUBLE use double precision to perform the computation
+;
+; @examples
+;
+; 1) IDL> ncdf_get_gridparams, 'coordinates_ORCA_R05.nc', 'glamt', 'gphit' $
 ;            , olon, olat, jpio, jpjo, 2
 ;
-; 2) ncdf_get_gridparams, olon, olat, jpio, jpjo, 2
+; 2) IDL> ncdf_get_gridparams, olon, olat, jpio, jpjo, 2
 ;
 ; @history
-;  November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr) 
-; 
+;  November 2005: Sebastien Masson (smasson\@lodyc.jussieu.fr)
+;
+; @version $Id$
+;
 ;-
 ;
@@ -59,5 +63,4 @@
 ;----------------------------------------------------------
 ;
-
 PRO get_gridparams, in1,   in2,   in3,     in4, in5, in6, in7, in8, DOUBLE = double
 ;                  file, lonname, latname, lon, lat, jpi, jpj, n_dimensions
@@ -70,5 +73,5 @@
     8:BEGIN
 ; get longitude and latitude
-      IF file_test(in1) EQ 0 THEN BEGIN 
+      IF file_test(in1) EQ 0 THEN BEGIN
         print, 'file ' + in1 + ' does not exist'
         stop
@@ -77,13 +80,13 @@
       ncdf_varget, cdfido, in2, lon
       ncdf_varget, cdfido, in3, lat
-      ncdf_close, cdfido 
+      ncdf_close, cdfido
       n_dimensions = in8
     END
-    5:BEGIN 
+    5:BEGIN
       lon = temporary(in1)
       lat = temporary(in2)
       n_dimensions = in5
     END
-    ELSE:BEGIN 
+    ELSE:BEGIN
       print, 'Bad nimber of input parameters'
       stop
@@ -93,14 +96,14 @@
   sizelon = size(lon)
   sizelat = size(lat)
-  CASE 1 OF 
+  CASE 1 OF
 ;-------
 ; lon and lat are 1D arrays
 ;-------
-    sizelon[0] EQ 1 AND sizelat[0] EQ 1:BEGIN 
+    sizelon[0] EQ 1 AND sizelat[0] EQ 1:BEGIN
 ; get jpi and jpj
       jpi = sizelon[1]
       jpj = sizelat[1]
 ; make sure that lon and lat have the good number of dimensions
-      CASE n_dimensions OF 
+      CASE n_dimensions OF
         1:
         2:BEGIN
@@ -115,5 +118,5 @@
 ; lon is 2D array and lat is 1D array
 ;-------
-    sizelon[0] EQ 2 AND sizelat[0] EQ 1:BEGIN 
+    sizelon[0] EQ 2 AND sizelat[0] EQ 1:BEGIN
 ; get jpi and jpj
       jpi = sizelon[1]
@@ -121,7 +124,7 @@
       IF jpj NE n_elements(lat) THEN stop
 ; make sure that lon and lat have the good number of dimensions
-      CASE n_dimensions OF 
-        1:BEGIN 
-          IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN 
+      CASE n_dimensions OF
+        1:BEGIN
+          IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN
             print, 'Longitudes are not the same for all latitudes, imposible to extract a 1D array of the longitudes'
             stop
@@ -136,5 +139,5 @@
 ; lon is 1D array and lat is 2D array
 ;-------
-    sizelon[0] EQ 1 AND sizelat[0] EQ 2:BEGIN 
+    sizelon[0] EQ 1 AND sizelat[0] EQ 2:BEGIN
 ; get jpi and jpj
       jpi = sizelat[1]
@@ -142,7 +145,7 @@
       IF jpi NE n_elements(lon) THEN stop
 ; make sure that lon and lat have the good number of dimensions
-      CASE n_dimensions OF 
-        1:BEGIN 
-          IF array_equal(lat, replicate(1, jpi) # lat[0, *]) NE 1 THEN BEGIN 
+      CASE n_dimensions OF
+        1:BEGIN
+          IF array_equal(lat, replicate(1, jpi) # lat[0, *]) NE 1 THEN BEGIN
             print, 'Latitudes are not the same for all longitudes, imposible to extract a 1D array of the latitudes'
             stop
@@ -157,18 +160,18 @@
 ; lon and lat are 2D arrays
 ;-------
-    sizelon[0] EQ 2 AND sizelat[0] EQ 2:BEGIN 
+    sizelon[0] EQ 2 AND sizelat[0] EQ 2:BEGIN
 ; get jpi and jpj
       IF array_equal(sizelon[1:2], sizelat[1:2]) NE 1 THEN stop
       jpi = sizelon[1]
-      jpj = sizelon[2]      
-; make sure that lon and lat have the good number of dimensions
-      CASE n_dimensions OF 
-        1:BEGIN 
-          IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN 
+      jpj = sizelon[2]
+; make sure that lon and lat have the good number of dimensions
+      CASE n_dimensions OF
+        1:BEGIN
+          IF array_equal(lon, lon[*, 0] # replicate(1, jpj)) NE 1 THEN BEGIN
             print, 'Longitudes are not the same for all latitudes, imposible to extract a 1D array of the longitudes'
             stop
           ENDIF
           lon = lon[*, 0]
-          IF array_equal(lat, replicate(1, jpi) # reform(lat[0, *])) NE 1 THEN BEGIN 
+          IF array_equal(lat, replicate(1, jpi) # reform(lat[0, *])) NE 1 THEN BEGIN
             print, 'Latitudes are not the same for all longitudes, imposible to extract a 1D array of the latitudes'
             stop
@@ -189,5 +192,5 @@
 ; double keyword
 ;-------
-  if keyword_set(double) then BEGIN 
+  if keyword_set(double) then BEGIN
     lon = double(temporary(lon))
     lat = double(temporary(lat))
