Index: /trunk/SRC/Documentation/xmldoc/savesaxo.sh
===================================================================
--- /trunk/SRC/Documentation/xmldoc/savesaxo.sh	(revision 196)
+++ /trunk/SRC/Documentation/xmldoc/savesaxo.sh	(revision 197)
@@ -573,5 +573,5 @@
     # copy files in a temporary directory
     mkdir /tmp/download_${$}/
-    cp -rp ../xmldoc/ /tmp/download_${$}/
+    cp -rp ../xmldoc /tmp/download_${$}/
     cp -rp ../idldoc_html_output /tmp/download_${$}/
     #
@@ -594,5 +594,7 @@
      mv ${file_html}_${$} ${file_html}
     done
-    scp -rp /tmp/download_${$}/* ${lgforge}@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
+    echo
+    echo give SAXO password if asked
+    scp -rp /tmp/download_${$}/* saxo@forge.ipsl.jussieu.fr:/ipsl/forge/projets/saxo/download/
     rm -rf /tmp/download_${$}/
 fi
Index: /trunk/SRC/Grid/checkperio.pro
===================================================================
--- /trunk/SRC/Grid/checkperio.pro	(revision 197)
+++ /trunk/SRC/Grid/checkperio.pro	(revision 197)
@@ -0,0 +1,265 @@
+;+
+; @file_comments
+; check ORCA2 and ORCA05 periodicity (east-west and noth fold) for files related to the T GRID ONLY
+;
+; @categories
+; Grid
+;
+; @param file {in}{required}{type=scalar string}
+; A string giving the name of the NetCdf file
+; 
+; @keyword WRITE {default=0}{type=scalar: 0 or 1}
+; Define to 1 to write the good periodicity in the file.
+; By default print only mesage of periodicity errors
+;
+; @restrictions
+; Works only for grid T points
+; if the WRITE keyword is activated, we need the writing access on the file!
+;
+; @examples
+;    IDL> checkperio, '/Users/smasson/OPA/modipsl/bin/runoff_1m_nomask.nc'
+;    checkperio, '/Users/smasson/OPA/modipsl/bin/runoff_1m_nomask.nc'
+;    nav_lon bad y periodicity (1)
+;    nav_lon bad y periodicity (2)
+;    nav_lon bad x periodicity (1)
+;    nav_lon bad x periodicity (2)
+;    nav_lat bad y periodicity (1)
+;    nav_lat bad y periodicity (2)
+;    nav_lat bad x periodicity (1)
+;    nav_lat bad x periodicity (2)
+;    socoefr bad y periodicity (1)
+;    socoefr bad x periodicity (1)
+;    socoefr bad x periodicity (2)
+;    sorunoff bad x periodicity (1)
+;    sorunoff bad x periodicity (2)
+;    IDL> checkperio, '/Users/smasson/OPA/modipsl/bin/runoff_1m_nomask.nc', /WRITE
+;    IDL> checkperio, '/Users/smasson/OPA/modipsl/bin/runoff_1m_nomask.nc'
+;
+; @history
+; October 2006: Sebastien Masson (smasson\@locean-ipsl.upmc.fr)
+;    
+; @version
+; $Id$
+;-
+PRO checkperio, file, WRITE = write
+
+  IF file_test(file) EQ 0 THEN BEGIN 
+    print, 'file '+file+' not found'
+    RETURN
+  ENDIF
+
+  cdfid = ncdf_open(file, WRITE = write)
+  finq = ncdf_inquire(cdfid)
+;
+  dimsz = lonarr(finq.ndims)
+  FOR did = 0, finq.ndims-1 DO BEGIN 
+    ncdf_diminq, cdfid, did, name, size
+    dimsz[did] = size
+  ENDFOR
+;
+  FOR vid = 0, finq.nvars-1 DO BEGIN 
+    vinq =  ncdf_varinq(cdfid, vid)
+    IF vinq.ndims GE 2 THEN BEGIN
+      vdimsz = dimsz[vinq.dim]
+      jpi = vdimsz[0]
+      jpj = vdimsz[1]
+      CASE vinq.ndims OF
+;------------------------------
+; 2D VAR
+;------------------------------
+        2:BEGIN 
+; y periodicity (1)
+          CASE 1 OF
+            array_equal([182, 149], vdimsz[0:1]):BEGIN ; ORCA2
+              ncdf_varget, cdfid, vid, part1, count = [jpi-2, 1], offset = [1, jpj-1]
+              ncdf_varget, cdfid, vid, part2, count = [jpi-2, 1], offset = [1, jpj-3]
+              part2 = reverse(shift(part2, -1))
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (1)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [jpi-2, 1], offset = [1, jpj-1]
+              ENDIF
+            END
+            array_equal([722, 511], vdimsz[0:1]):BEGIN ; ORCA05
+              ncdf_varget, cdfid, vid, part1, count = [jpi-2, 1], offset = [1, jpj-1]
+              ncdf_varget, cdfid, vid, part2, count = [jpi-2, 1], offset = [1, jpj-2]
+              part2 = reverse(part2)
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (1)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [jpi-2, 1], offset = [1, jpj-1]
+              ENDIF
+            END
+            ELSE:print, vinq.name+' nothing to check'
+          ENDCASE
+; y periodicity (2)
+          CASE 1 OF
+            array_equal([182, 149], vdimsz[0:1]):BEGIN ; ORCA2
+              ncdf_varget, cdfid, vid, part1, count = [(jpi-1)/2-2+1, 1], offset = [(jpi-1)/2+2, jpj-2]
+              ncdf_varget, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1], offset = [          2, jpj-2]
+              part2 = reverse(part2)
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (2)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1], offset = [(jpi-1)/2+2, jpj-2]
+              ENDIF
+            END
+            array_equal([722, 511], vdimsz[0:1]):BEGIN ; ORCA05
+            END
+            ELSE:print, vinq.name+' nothing to check'
+          ENDCASE
+; x periodicity (1)
+          ncdf_varget, cdfid, vid, part1, count = [1, jpj], offset = [0, 0]
+          ncdf_varget, cdfid, vid, part2, count = [1, jpj], offset = [jpi-2, 0]
+          IF array_equal(part1, part2) NE 1 THEN BEGIN 
+            print, vinq.name+' bad x periodicity (1)'
+            IF keyword_set(write) THEN $
+               ncdf_varput, cdfid, vid, part2, count = [1, jpj], offset = [0, 0]
+          ENDIF
+; x periodicity (2)
+          ncdf_varget, cdfid, vid, part1, count = [1, jpj], offset = [jpi-1, 0]
+          ncdf_varget, cdfid, vid, part2, count = [1, jpj], offset = [1, 0]
+          IF array_equal(part1, part2) NE 1 THEN BEGIN 
+            print, vinq.name+' bad x periodicity (2)'
+            IF keyword_set(write) THEN $
+               ncdf_varput, cdfid, vid, part2, count = [1, jpj], offset = [jpi-1, 0]
+          ENDIF
+        END
+;------------------------------
+; 3D VAR
+;------------------------------
+        3:BEGIN 
+          jpk = vdimsz[2]
+; y periodicity (1)
+          CASE 1 OF
+            array_equal([182, 149], vdimsz[0:1]):BEGIN ; ORCA2
+              ncdf_varget, cdfid, vid, part1, count = [jpi-2, 1, jpk], offset = [1, jpj-1, 0]
+              ncdf_varget, cdfid, vid, part2, count = [jpi-2, 1, jpk], offset = [1, jpj-3, 0]
+              IF jpk EQ 1 THEN part2 = reform(part2, jpi-2, 1, jpk, /over)
+              part2 = reverse(shift(part2, -1, 0, 0), 1)
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (1)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [jpi-2, 1, jpk], offset = [1, jpj-1, 0]
+              ENDIF
+            END
+            array_equal([722, 511], vdimsz[0:1]):BEGIN ; ORCA05
+              ncdf_varget, cdfid, vid, part1, count = [jpi-2, 1, jpk], offset = [1, jpj-1, 0]
+              ncdf_varget, cdfid, vid, part2, count = [jpi-2, 1, jpk], offset = [1, jpj-2, 0]
+              IF jpk EQ 1 THEN part2 = reform(part2, jpi-2, 1, jpk, /over)
+              part2 = reverse(part2, 1)
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (1)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [jpi-2, 1, jpk], offset = [1, jpj-1, 0]
+              ENDIF
+            END
+            ELSE:print, vinq.name+' nothing to check'
+          ENDCASE
+; y periodicity (2)
+          CASE 1 OF
+            array_equal([182, 149], vdimsz[0:1]):BEGIN ; ORCA2
+              ncdf_varget, cdfid, vid, part1, count = [(jpi-1)/2-2+1, 1, jpk], offset = [(jpi-1)/2+2, jpj-2, 0]
+              ncdf_varget, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1, jpk], offset = [          2, jpj-2, 0]
+              part2 = reverse(part2, 1)
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (2)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1, jpk], offset = [(jpi-1)/2+2, jpj-2, 0]
+              ENDIF
+            END
+            array_equal([722, 511], vdimsz[0:1]):BEGIN ; ORCA05
+            END
+            ELSE:print, vinq.name+' nothing to check'
+          ENDCASE
+; x periodicity (1)
+          ncdf_varget, cdfid, vid, part1, count = [1, jpj, jpk], offset = [0, 0, 0]
+          ncdf_varget, cdfid, vid, part2, count = [1, jpj, jpk], offset = [jpi-2, 0, 0]
+          IF array_equal(part1, part2) NE 1 THEN BEGIN 
+            print, vinq.name+' bad x periodicity (1)'
+            IF keyword_set(write) THEN $
+               ncdf_varput, cdfid, vid, part2, count = [1, jpj, jpk], offset = [0, 0, 0]
+          ENDIF
+; x periodicity (2)
+          ncdf_varget, cdfid, vid, part1, count = [1, jpj, jpk], offset = [jpi-1, 0, 0]
+          ncdf_varget, cdfid, vid, part2, count = [1, jpj, jpk], offset = [1, 0, 0]
+          IF array_equal(part1, part2) NE 1 THEN BEGIN 
+            print, vinq.name+' bad x periodicity (2)'
+            IF keyword_set(write) THEN $
+               ncdf_varput, cdfid, vid, part2, count = [1, jpj, jpk], offset = [jpi-1, 0, 0]
+          ENDIF
+        END
+;------------------------------
+; 4D VAR
+;------------------------------
+        4:BEGIN 
+          jpk = vdimsz[2]
+          jpt = vdimsz[3]
+; y periodicity (1)
+          CASE 1 OF
+            array_equal([182, 149], vdimsz[0:1]):BEGIN ; ORCA2
+              ncdf_varget, cdfid, vid, part1, count = [jpi-2, 1, jpk, jpt], offset = [1, jpj-1, 0, 0]
+              ncdf_varget, cdfid, vid, part2, count = [jpi-2, 1, jpk, jpt], offset = [1, jpj-3, 0, 0]
+              IF jpt EQ 1 THEN part2 = reform(part2, jpi-2, 1, jpk, jpt, /over)
+              part2 = reverse(shift(part2, -1, 0, 0, 0), 1)
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (1)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [jpi-2, 1, jpk, jpt], offset = [1, jpj-1, 0, 0]
+              ENDIF
+            END
+            array_equal([722, 511], vdimsz[0:1]):BEGIN ; ORCA05
+              ncdf_varget, cdfid, vid, part1, count = [jpi-2, 1, jpk, jpt], offset = [1, jpj-1, 0, 0]
+              ncdf_varget, cdfid, vid, part2, count = [jpi-2, 1, jpk, jpt], offset = [1, jpj-2, 0, 0]
+              IF jpt EQ 1 THEN part2 = reform(part2, jpi-2, 1, jpk, jpt, /over)
+              part2 = reverse(part2, 1)
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (1)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [jpi-2, 1, jpk, jpt], offset = [1, jpj-1, 0, 0]
+              ENDIF
+            END
+            ELSE:print, vinq.name+' nothing to check'
+          ENDCASE
+; y periodicity (2)
+          CASE 1 OF
+            array_equal([182, 149], vdimsz[0:1]):BEGIN ; ORCA2
+              ncdf_varget, cdfid, vid, part1, count = [(jpi-1)/2-2+1, 1, jpk, jpt], offset = [(jpi-1)/2+2, jpj-2, 0, 0]
+              ncdf_varget, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1, jpk, jpt], offset = [          2, jpj-2, 0, 0]
+              part2 = reverse(part2, 1)
+              IF array_equal(part1, part2) NE 1 THEN BEGIN 
+                print, vinq.name+' bad y periodicity (2)'
+                IF keyword_set(write) THEN $
+                   ncdf_varput, cdfid, vid, part2, count = [(jpi-1)/2-2+1, 1, jpk, jpt], offset = [(jpi-1)/2+2, jpj-2, 0, 0]
+              ENDIF
+            END
+            array_equal([722, 511], vdimsz[0:1]):BEGIN ; ORCA05
+            END
+            ELSE:print, vinq.name+' nothing to check'
+          ENDCASE
+; x periodicity (1)
+          ncdf_varget, cdfid, vid, part1, count = [1, jpj, jpk, jpt], offset = [0, 0, 0, 0]
+          ncdf_varget, cdfid, vid, part2, count = [1, jpj, jpk, jpt], offset = [jpi-2, 0, 0, 0]
+          IF array_equal(part1, part2) NE 1 THEN BEGIN 
+            print, vinq.name+' bad x periodicity (1)'
+            IF keyword_set(write) THEN $
+               ncdf_varput, cdfid, vid, part2, count = [1, jpj, jpk, jpt], offset = [0, 0, 0, 0]
+          ENDIF
+; x periodicity (2)
+          ncdf_varget, cdfid, vid, part1, count = [1, jpj, jpk, jpt], offset = [jpi-1, 0, 0, 0]
+          ncdf_varget, cdfid, vid, part2, count = [1, jpj, jpk, jpt], offset = [1, 0, 0, 0]
+          IF array_equal(part1, part2) NE 1 THEN BEGIN 
+            print, vinq.name+' bad x periodicity (2)'
+            IF keyword_set(write) THEN $
+               ncdf_varput, cdfid, vid, part2, count = [1, jpj, jpk, jpt], offset = [jpi-1, 0, 0, 0]
+          ENDIF
+        END
+        ELSE:print, vinq.name+' nothing to check'
+      ENDCASE
+    ENDIF    
+  ENDFOR
+
+  ncdf_close, cdfid
+
+  RETURN
+END
Index: /trunk/SRC/Grid/numbisland.pro
===================================================================
--- /trunk/SRC/Grid/numbisland.pro	(revision 197)
+++ /trunk/SRC/Grid/numbisland.pro	(revision 197)
@@ -0,0 +1,96 @@
+;+
+; @hidden
+;
+; @file_comments
+; recursive function.
+; for one given point on an island, check if its neighbourgs are on the same island
+;
+; @param msk {in}{required}{type=2D array of 0 and 1}
+; land-sea mask with 0 on the land and 1 on the ocean
+;
+; @param nx {in}{required}{type=scalar}
+; x size of the mask
+;
+; @param ny {in}{required}{type=scalar}
+; y size of the mask
+;
+; @param indin {in}{required}{type=1D array}
+; index listing the point of the mask which are on the island
+;
+; @param numb {in}{required}{type=scalar}
+; number of the island
+;
+;-
+PRO mskneig, msk, nx, ny, indin, numb
+; flag the point
+  msk[indin] = numb
+; find its neighbourgs
+  indx = (indin MOD nx) + [-1L, 0L, 1L] 
+  indx = (temporary(indx) + nx) MOD nx ; x periodicity
+  indy = (indin/nx) + [-1L, 0L, 1L] 
+  indy = 0 > temporary(indy) < (ny-1L) ; y periodicity
+; build 1d index
+  ind = temporary(indx)#replicate(1L, 3) + replicate(nx, 3)#temporary(indy)
+; for each neighbourgs on the same island, call again mskneig
+  FOR i = 0, n_elements(ind)-1 DO BEGIN  
+    IF msk[ind[i]] EQ 0 THEN mskneig, msk, nx, ny, ind[i], numb
+  ENDFOR 
+
+  return
+END
+
+;+
+; @file_comments
+; given a 2D land-se mask, give a number to each islands
+;
+; @categories
+; Grid
+;
+; @param mskin {in}{required}{type=2D array of 0 and 1}
+; land-sea mask with 0 on the land and 1 on the ocean
+;
+; @returns
+; A 2d array with 0 on the ocean and a different number for each island
+;
+; @restrictions
+;    - mask must be periodic along the x direction.
+;    - Periodicity along y direction is not taken into account
+;    - must have less than ~32700 islands;
+;
+; @examples
+;   IDL> a = numbisland(tmask[*,*,0])
+;
+; @history
+;  Jan 2006: sebastien masson (smasson\@locean-ipsl.upmc.fr)
+;
+; @version
+; $Id$
+;-
+;
+FUNCTION numbisland, mskin
+  time1 = systime(1) ; performance measurment
+  szmsk = size(reform(mskin))
+  IF szmsk[0] NE 2 THEN stop
+  nx = szmsk[1]
+  ny = szmsk[2]
+  msk = fix(mskin)
+
+  islnumb = 10 ; default value
+
+  land = (where(msk EQ 0, count))[0]
+  WHILE count NE 0 DO BEGIN
+    IF (islnumb-9) MOD 10 EQ 0 THEN print,  'island number :'+strtrim(islnumb-9, 1)
+
+    mskneig, msk, nx, ny, land, islnumb 
+    
+    land = (where(msk EQ 0, count))[0]
+    islnumb = islnumb + 1
+  ENDWHILE
+
+  msk = msk-9
+  msk[where(msk EQ -8)] = 0
+
+  print, 'time:', systime(1)-time1 
+
+  RETURN, msk
+END
Index: /trunk/SRC/Utilities/mergeonline_help.pro
===================================================================
--- /trunk/SRC/Utilities/mergeonline_help.pro	(revision 196)
+++ /trunk/SRC/Utilities/mergeonline_help.pro	(revision 197)
@@ -6,9 +6,5 @@
 ; Documentation
 ;
-; @uses
-; mergeonline_help.sh
-;
 ; @restrictions
-; Works only with "Unix" type machine
 ; Needs at least version 6.2 
 ;
@@ -24,5 +20,6 @@
 ;
 ; is the IDL version at least 6.2 ?
-  IF float(strmid(!version.release, 0, 3)) LT 6.2 THEN BEGIN
+  idlversion = float(strmid(!version.release, 0, 3))
+  IF idlversion LT 6.2 THEN BEGIN
     print, 'Warning: You need at least IDL 6.2 to use SAXO/IDL merged online help'
     return
@@ -57,5 +54,5 @@
   IF homesrc EQ '' THEN return
 
-  homesaxo = file_dirname(find('buildinit.pro'), /mark_directory) + 'Documentation/idldoc_assistant_output/'
+  homesaxo = file_dirname((find('buildinit.pro'))[0], /mark_directory) + 'Documentation/idldoc_assistant_output/'
   IF file_test(homesaxo + 'idldoc-lib.adp') EQ 0 THEN BEGIN
     print, 'Error when looking for the file '+ homesaxo + 'idldoc-lib.adp...'
@@ -84,7 +81,13 @@
 ; are the 2 revision tags the same??
         IF array_equal(old, new) THEN BEGIN
-          !help_path = homesrc
-          print, 'Use SAXO/IDL merged online help...'
-          return
+; is IDL version the same of homesrc + 'home.html' ?
+          homehtml = getfile(homesrc+'home.html')
+          line = strmatch(homehtml, '*IDL '+ string(idlversion, format = '(f3.1)') + '*')
+          line = (where(line EQ 1))[0]
+          IF line NE -1 THEN  BEGIN
+            !help_path = homesrc
+            print, 'Use SAXO/IDL merged online help...'
+            return
+          ENDIF
         ENDIF
       ENDIF
