Index: /tags/libIGCM_v1_1/AA_additionnal
===================================================================
--- /tags/libIGCM_v1_1/AA_additionnal	(revision 19)
+++ /tags/libIGCM_v1_1/AA_additionnal	(revision 19)
@@ -0,0 +1,95 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J ATL_ADD           # Nom du job
+#-Q- platine #BSUB -N                   # message a la fin du job
+#-Q- platine #BSUB -n 1                 # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00              # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #QSUB -r ATL_ADD             # Nom du job
+#-Q- sx8brodie #QSUB -lT 2:00:00            # limite en temps total
+#-Q- sx8brodie #QSUB -eo                    # rassemble standard error et output
+#-Q- sx8brodie #QSUB -J m
+#-Q- sx8brodie #QSUB -l mpp_p=2
+#-Q- sx8brodie #QSUB -s /bin/ksh            # shell du job
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N  ATL_ADD            # Nom du job
+#-Q- sx8mercure #PBS -j o                   # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh        # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb       # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=2:00:00  # Limite temps a 2 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+
+#########################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     ; #IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   ; #IGCM_card_Check
+
+#######################################################################
+
+#set -vx
+
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_OCE=${R_SAVE}/OCE
+
+cd ${RUN_DIR_PATH}
+
+# --------------------------------------------
+# Insert your commands between III...III lines 
+# and precise produced directories to save
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+IGCM_sys_Get ${R_IN}/BC/OCE/${config_UserChoices_TagName}/${RESOL_OCE}/LEVITUS_1m_Temperature_Pot_Ice_nomask.nc .
+IGCM_sys_Get ${R_IN}/BC/OCE/${config_UserChoices_TagName}/${RESOL_OCE}/LEVITUS_1m_Salinity_Ice_nomask.nc .
+
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_T.nc ${RUN_DIR_PATH}/SE_grid_T.nc
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_U.nc ${RUN_DIR_PATH}/SE_grid_U.nc
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_V.nc ${RUN_DIR_PATH}/SE_grid_V.nc
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_W.nc ${RUN_DIR_PATH}/SE_grid_W.nc
+
+#ferret -gif -script news2.jnl "${YEARS}" "${config_UserChoices_JobName}" "${RESOL_OCE}"
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/ADD -p landscape=true,angle=-90,nup=1x1 ${FER_ATLAS}/atlas_p_ORCA2_add_*.cfg ${config_UserChoices_JobName}
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Put ferret journal files together
+for file in $( ls ${R_ATLAS}/ADD/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/ADD/allferretscript.txt
+
+# Clear some files
+find . \( -name "*.stdout" -o -name "*.jnl" \) -print -exec rm -f {} \;
+
+# Save files
+IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+
+IGCM_sys_Rm -Rf ATLAS
+IGCM_sys_Rm -f SE_grid_?.nc
+
+# DODS copy
+[ -d ${R_SAVE}/${R_ATLAS} ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+date
Index: /tags/libIGCM_v1_1/AA_atlas_LMDZ
===================================================================
--- /tags/libIGCM_v1_1/AA_atlas_LMDZ	(revision 19)
+++ /tags/libIGCM_v1_1/AA_atlas_LMDZ	(revision 19)
@@ -0,0 +1,88 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J ATL_LMDZ          # Nom du job
+#-Q- platine #BSUB -N                   # message a la fin du job
+#-Q- platine #BSUB -n 1                 # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00              # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #QSUB -r ATL_LMDZ            # Nom du job
+#-Q- sx8brodie #QSUB -lT 2:00:00            # limite en temps total
+#-Q- sx8brodie #QSUB -eo                    # rassemble standard error et output
+#-Q- sx8brodie #QSUB -J m
+#-Q- sx8brodie #QSUB -l mpp_p=2
+#-Q- sx8brodie #QSUB -s /bin/ksh            # shell du job
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N  ATL_LMDZ           # Nom du job
+#-Q- sx8mercure #PBS -j o                   # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh        # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb       # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=2:00:00  # Limite temps a 2 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+
+######################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     ; #IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   ; #IGCM_card_Check
+
+######################################################################
+
+#set -vx 
+
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_ATM=${R_SAVE}/ATM
+
+cd ${RUN_DIR_PATH}
+
+# --------------------------------------------
+# Insert your commands between III...III lines 
+# and precise produced directories to save
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+IGCM_sys_Get ${R_OUT_ATM}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc         ${RUN_DIR_PATH}
+
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/ATM -l ${FER_ATLAS}/atlas_p_LMDZ3.3_diag1_*.cfg    ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Put ferret journal files together
+for file in $( ls ${R_ATLAS}/ATM/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/ATM/allferretscript.txt
+
+# Clear some files
+find . \( -name "*.stdout" -o -name "*.jnl" \) -print -exec rm -f {} \;
+
+# Save files
+IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+
+IGCM_sys_Rm -Rf ATLAS
+IGCM_sys_Rm ${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc
+
+# DODS copy
+[ -d ${R_SAVE}/${R_ATLAS} ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+date
Index: /tags/libIGCM_v1_1/AA_atlas_LMDZOR
===================================================================
--- /tags/libIGCM_v1_1/AA_atlas_LMDZOR	(revision 19)
+++ /tags/libIGCM_v1_1/AA_atlas_LMDZOR	(revision 19)
@@ -0,0 +1,100 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J ATL_LMDO          # Nom du job
+#-Q- platine #BSUB -N                   # message a la fin du job
+#-Q- platine #BSUB -n 1                 # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00              # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #QSUB -r ATL_LMDO             # Nom du job
+#-Q- sx8brodie #QSUB -lT 2:00:00             # limite en temps total
+#-Q- sx8brodie #QSUB -eo                     # rassemble standard error et output
+#-Q- sx8brodie #QSUB -J m
+#-Q- sx8brodie #QSUB -l mpp_p=4
+#-Q- sx8brodie #QSUB -s /bin/ksh             # shell du job
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N  ATL_LMDO            # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=2:00:00   # Limite temps a 2 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+
+########################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     ; #IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   ; #IGCM_card_Check
+
+########################################################################
+
+#set -vx 
+
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_ATM=${R_SAVE}/ATM
+R_OUT_SRF=${R_SAVE}/SRF
+
+cd ${RUN_DIR_PATH}
+
+# --------------------------------------------
+# Insert your commands between III...III lines 
+# and precise produced directories to save
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+IGCM_sys_Get ${R_OUT_ATM}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc         ${RUN_DIR_PATH}
+IGCM_sys_Get ${R_OUT_SRF}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_sechiba_history.nc ${RUN_DIR_PATH}
+
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/ATM -l ${FER_ATLAS}/atlas_p_LMDZ3.3_diag1_*.cfg    ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/SRF -l ${FER_ATLAS}/atlas_p_ORCHIDEE_diag1_*.cfg \
+                                           ${FER_ATLAS}/atlas_p_SECHIBA_diag1_*.cfg  \
+                                           ${FER_ATLAS}/atlas_p_ORCHIDEE_diag2_a.cfg   ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_sechiba_history.nc
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Put ferret journal files together
+for file in $( ls ${R_ATLAS}/ATM/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/ATM/allferretscript.txt
+
+# Put ferret journal files together
+for file in $( ls ${R_ATLAS}/SRF/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/SRF/allferretscript.txt
+
+# Clear some files
+find . \( -name "*.stdout" -o -name "*.jnl" \) -print -exec rm -f {} \;
+
+# Save files
+IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+
+IGCM_sys_Rm -Rf ATLAS
+IGCM_sys_Rm ${config_UserChoices_JobName}_SE_${YEARS}_1M_sechiba_history.nc
+IGCM_sys_Rm ${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc
+
+# DODS copy
+[ -d ${R_SAVE}/${R_ATLAS} ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+date
Index: /tags/libIGCM_v1_1/AA_atlas_ORCA_LIM
===================================================================
--- /tags/libIGCM_v1_1/AA_atlas_ORCA_LIM	(revision 19)
+++ /tags/libIGCM_v1_1/AA_atlas_ORCA_LIM	(revision 19)
@@ -0,0 +1,147 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J ATL_OPA           # Nom du job
+#-Q- platine #BSUB -N                   # message a la fin du job
+#-Q- platine #BSUB -n 1                 # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00              # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #QSUB -r ATL_OPA              # Nom du job
+#-Q- sx8brodie #QSUB -lT 3:00:00             # limite en temps total
+#-Q- sx8brodie #QSUB -eo                     # rassemble standard error et output
+#-Q- sx8brodie #QSUB -J m
+#-Q- sx8brodie #QSUB -l mpp_p=2
+#-Q- sx8brodie #QSUB -s /bin/ksh             # shell du job
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N  ATL_OPA             # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=2:00:00   # Limite temps a 2 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+#set -vx 
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+
+########################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     ; #IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   ; #IGCM_card_Check
+
+########################################################################
+
+#set -vx 
+
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_OCE=${R_SAVE}/OCE
+R_OUT_ICE=${R_SAVE}/ICE
+
+cd ${RUN_DIR_PATH}
+
+# --------------------------------------------
+# Insert your commands between III...III lines
+# and precise produced directories to save
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_T.nc ${RUN_DIR_PATH}
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_U.nc ${RUN_DIR_PATH}
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_V.nc ${RUN_DIR_PATH}
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_W.nc ${RUN_DIR_PATH}
+IGCM_sys_Get ${R_OUT_ICE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_icemod.nc      ${RUN_DIR_PATH}
+
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/OCE_T -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag1_[ab].cfg     ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_T.nc
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/OCE_U -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag0_U.cfg        ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_U.nc
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/OCE_V -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag0_V.cfg        ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_V.nc
+#atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/OCE_W -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag0_W.cfg        ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_W.nc
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/OCE   -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag0_[de].cfg     ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_T.nc
+atlas -o ${RUN_DIR_PATH}/${R_ATLAS}/ICE   -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}LIM_diag0_[abc].cfg ${RUN_DIR_PATH}/${config_UserChoices_JobName}_SE_${YEARS}_1M_icemod.nc
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Put ferret journal files together
+for file in $( ls ${R_ATLAS}/OCE_T/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/OCE_T/allferretscript.txt
+
+for file in $( ls ${R_ATLAS}/OCE_U/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/OCE_U/allferretscript.txt
+
+for file in $( ls ${R_ATLAS}/OCE_V/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/OCE_V/allferretscript.txt
+
+for file in $( ls ${R_ATLAS}/OCE/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/OCE/allferretscript.txt
+
+for file in $( ls ${R_ATLAS}/ICE/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/ICE/allferretscript.txt
+
+# Clear some files
+find . \( -name "*.stdout" -o -name "*.jnl" \) -print -exec rm -f {} \;
+
+# Save files
+IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+
+IGCM_sys_Rm -Rf ATLAS
+
+IGCM_sys_Rm ${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_[TUVW].nc 
+IGCM_sys_Rm ${config_UserChoices_JobName}_SE_${YEARS}_1M_icemod.nc      
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+# Additionnal post-processing
+
+#IGCM_sys_Get /u/rech/ces/rces599/CPL/ORCA2xLMD9671/Oce/LEVITUS_1m_Temperature_Pot_Ice_nomask.nc .
+#IGCM_sys_Get /u/rech/ces/rces599/CPL/ORCA2xLMD9671/Oce/LEVITUS_1m_Salinity_Ice_nomask.nc .
+#IGCM_sys_Get /u/rech/psl/rpsl655/database/climato/ORCA2.0_Levitus.nc .
+
+#ferret -gif -script news2.jnl "${YEARS}" "${EXP}"
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Put ferret journal files together
+#for file in $( ls */*jnl ) ; do  
+#    echo -e "\n\n################################" ; 
+#    echo -e "$file\n" ; cat $file ; 
+#done  > allferretscript.txt
+
+# Clear some files
+#find . \( -name "*.stdout" -o -name "*.jnl" \) -print -exec rm -f {} \;
+
+# Save files
+#IGCM_sys_Put_Dir Images ${R_SAVE}/ATLAS
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# DODS copy
+[ -d ${R_SAVE}/${R_ATLAS} ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+date
Index: /tags/libIGCM_v1_1/AA_atlas_ORCHIDEE
===================================================================
--- /tags/libIGCM_v1_1/AA_atlas_ORCHIDEE	(revision 19)
+++ /tags/libIGCM_v1_1/AA_atlas_ORCHIDEE	(revision 19)
@@ -0,0 +1,104 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J ATL_ORCH          # Nom du job
+#-Q- platine #BSUB -N                   # message a la fin du job
+#-Q- platine #BSUB -n 1                 # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00              # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #QSUB -r ATL_ORCH             # Nom du job
+#-Q- sx8brodie #QSUB -lT 01:00:00            # limite en temps total
+#-Q- sx8brodie #QSUB -eo                     # rassemble standard error et output
+#-Q- sx8brodie #QSUB -J m
+#-Q- sx8brodie #QSUB -l mpp_p=4
+#-Q- sx8brodie #QSUB -s /bin/ksh             # shell du job
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N  ATL_ORCH            # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=1:00:00   # Limite temps a 2 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+
+#set -vx
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+DEBUG_debug=${DEBUG_debug:=false}
+
+if [ ${DEBUG_debug} = true ] ; then
+    echo $RUN_DIR_PATH
+    MYWORK=$(echo $HOME | sed -e "s|home|scratchdir|")
+    RUN_DIR_PATH=${MYWORK}/IGCM_OUT/${config_UserChoices_TagName}/${config_UserChoices_JobName}/MO2SE.${an_fin}
+fi
+
+########################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     ; #IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   ; #IGCM_card_Check
+
+########################################################################
+
+#set -vx 
+
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_SRF=${R_SAVE}/SRF
+
+RUN_DIR=${RUN_DIR_PATH}/ATLAS_ORCHIDEE_${YEARS}
+IGCM_sys_MkdirWork ${RUN_DIR}
+IGCM_sys_Cd ${RUN_DIR}
+
+# --------------------------------------------
+# Insert your commands between III...III lines 
+# and precise produced directories to save
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+IGCM_sys_Get ${R_OUT_SRF}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_sechiba_history.nc ${RUN_DIR}
+
+atlas -o ${RUN_DIR}/${R_ATLAS}/SRF -l ${FER_ATLAS}/atlas_p_ORCHIDEE_diag1_*.cfg \
+                                       ${FER_ATLAS}/atlas_p_SECHIBA_diag1_*.cfg \
+                                       ${FER_ATLAS}/atlas_p_ORCHIDEE_diag2_a.cfg  ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_sechiba_history.nc
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Put ferret journal files together
+for file in $( ls ${R_ATLAS}/SRF/*/*jnl ) ; do  
+    echo -e "\n\n################################" ; 
+    echo -e "$file\n" ; cat $file ; 
+done  > ${R_ATLAS}/SRF/allferretscript.txt
+
+# Clear some files
+find . \( -name "*.stdout" -o -name "*.jnl" \) -print -exec rm -f {} \;
+
+# Save files
+IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+
+IGCM_sys_Rm -Rf ATLAS
+IGCM_sys_Rm ${config_UserChoices_JobName}_SE_${YEARS}_1M_sechiba_history.nc
+
+# DODS copy
+[ -d ${R_SAVE}/${R_ATLAS} ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+date
Index: /tags/libIGCM_v1_1/AA_create_se
===================================================================
--- /tags/libIGCM_v1_1/AA_create_se	(revision 19)
+++ /tags/libIGCM_v1_1/AA_create_se	(revision 19)
@@ -0,0 +1,459 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ###################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ###################
+#-Q- platine #BSUB -J SE                     # Nom du job
+#-Q- platine #BSUB -N                        # message a la fin du job
+#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00                   # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #QSUB -r SE                   # Nom du job
+#-Q- sx8brodie #QSUB -lT 1:00:00             # limite en temps total
+#-Q- sx8brodie #QSUB -lt 1:00:00             # limite en temps par process
+#-Q- sx8brodie #QSUB -lM 1Gb
+#-Q- sx8brodie #QSUB -eo                     # rassemble standard error et output
+#-Q- sx8brodie #QSUB -J m
+#-Q- sx8brodie #QSUB -l mpp_p=4
+#-Q- sx8brodie #QSUB -s /bin/ksh             # shell du job
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N SE                   # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=1:00:00   # Limite temps a 1 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Flag to determine atlas job's output directory
+#D- Default : value from libIGCM_post.ksh if any
+POST_DIR=${POST_DIR:=${PBS_O_WORKDIR}}
+
+#D- Increased verbosity (1, 2, 3)
+#D- Default : value from AA_job if any
+Verbosity=${Verbosity:=3}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+DEBUG_debug=${DEBUG_debug:=false}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+libIGCM=${libIGCM:=/home/rech/ces/rces452/libIGCM}
+
+#D- TEMPORARY Flag to determine atmospheric resolution
+#D- Default : value from atmospheric driver if any
+RESOL_ATM=${RESOL_ATM:=LMD144142}
+
+#D- TEMPORARY Flag to determine ocean resolution
+#D- Default : value from ocean driver if any
+RESOL_OCE=${RESOL_OCE:=ORCA2}
+
+#D- TEMPORARY Flag to determine ice resolution
+#D- Default : value from ice driver if any
+RESOL_ICE=${RESOL_ICE:=ORCA2}
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SRF=${RESOL_SRF:=LMD144142}
+
+########################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     #; IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   #; IGCM_card_Check
+. ${libIGCM}/libIGCM_date/libIGCM_date.ksh   #; IGCM_date_Check
+
+########################################################################
+
+#set -vx
+
+if [ ${DEBUG_debug} = true ] ; then
+    IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+    echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+fi
+IGCM_sys_Cd ${RUN_DIR_PATH}
+
+if [ ${StandAlone} = true ] ; then
+    CARD_DIR=${SUBMIT_DIR}
+else
+    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
+    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
+fi
+
+#
+# First of all
+#
+IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card UserChoices
+typeset option
+for option in ${config_UserChoices[*]} ; do
+    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
+done
+#
+echo
+IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
+IGCM_debug_PrintVariables 3 config_UserChoices_JobName
+IGCM_debug_PrintVariables 3 config_UserChoices_LongName
+IGCM_debug_PrintVariables 3 config_UserChoices_TagName
+IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
+IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
+IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
+IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
+echo
+
+#==================================
+
+R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+#
+IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card ListOfComponents
+#
+IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
+#
+# Determine period for seasonnal average. Default : value from AA_job if any
+#
+DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
+#
+PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
+#
+freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
+#
+an_fin=$( expr $( IGCM_date_ConvertGregorianDateToJulian $PeriodDateEnd ) / 1000 )
+an_deb=$( IGCM_date_YearDigit $(( an_fin - freq + 1 )) )
+an_fin=$( IGCM_date_YearDigit ${an_fin} )
+#
+# For each component selected determine which files need post-processing
+#
+for comp in ${config_ListOfComponents[*]} ; do
+    #
+    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    #
+    card=${CARD_DIR}/COMP/${compname}.card
+    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
+    #
+    ListFilesName=${compname}_OutputFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+    #
+    if [ X${FileName0} != X${NULL_STR} ] ; then
+	#
+	#IGCM_debug_Print 1 "Component      : ${compname}"
+	#
+	# INITIALISATION
+	#
+	eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+	typeset i=0
+	#
+	until [ $i -eq $NbFiles ]; do
+	    #
+	    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	    eval file_in=${file_in_}
+	    let $(( i_ = i+2 ))
+	    eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	    eval flag_post=${flag_post_}
+	    #
+	    if [ X${flag_post} != XNONE ] ; then
+		#
+		# Initialize ${flag_post}_${compname}_${post_freq}
+		#
+		eval ${flag_post}_${compname}_SeasonalFrequency=true
+	    fi
+	    let $(( i=i+3 ))
+	done
+    fi
+
+    for element in $( set | grep Post_ | grep ${compname}_SeasonalFrequency | grep -i "=true" ) ; do
+        #
+	FILE=$( echo ${element} | awk -F "_${compname}" '{print $1}' | awk "-FPost_" '{print $2}' )
+        #
+	IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
+	#
+	# CREATE LIST
+	#
+	DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
+	#
+	TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
+	#
+	if [ ! -f ${DIRECTORY}/${TestedFile} ] ; then
+	    eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE}
+	    eval set +A LISTE_PATCHES_${FILE} \$\{${compname}_Post_${FILE}_Patches[*]}
+	    if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) !=  X${NULL_STR} ]; then
+		for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do
+		    if [ Xload${Patch} != X ] ; then
+			. ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh
+			eval load${Patch}=loaded
+		    fi
+		done
+	    fi
+	fi
+	   #
+    done   # for element
+done       # for comp
+
+for comp in ${config_ListOfComponents[*]} ; do
+    #
+    eval R_OUT_${comp}=${R_SAVE}/${comp}
+    #
+    i=0
+    for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
+	#
+	# Determine in which output can we find file
+	# IE : Output/MO or Output/DA or ...
+	#
+	FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
+	case ${FlagDir} in
+	    1Y)    FreqDir=YE  ;;
+       	    1M)    FreqDir=MO  ;;
+	    5D|1D) FreqDir=DA  ;;
+	    HF)    FreqDir=HF  ;;
+	    INS)   FreqDir=INS ;;
+        esac
+	#
+	RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc
+	# Do not redoo an existing SE
+	if [ -f ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE} ] ; then
+	    continue
+	fi
+	#
+	eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/
+	#
+	case ${config_UserChoices_PeriodLength} in
+	# For Yearly simulation :
+	1Y|1y)
+	  (( an = an_deb ))
+          # Initialize array
+	  set -A liste_file_se
+	  set -A liste_file_se_tmp
+	  while [ ${an} -le ${an_fin} ] ; do
+	      moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
+	      #
+	      an4=$(printf "%04i\n" ${an} )
+	      #
+	      diy=$( IGCM_date_DaysInYear $an4 )
+	      afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) )
+	      date=${an4}0101_${afin}
+	      set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
+	      set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
+	      (( an = an + 1 ))
+	  done
+	  #
+	  IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
+	  eval ExitFlag=false
+	  IGCM_debug_Verif_Exit_Post
+	  
+	  # Apply IGCM_Patch if needed
+	  if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
+	      for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
+		  for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
+		      IGCM_${Patch} ${file_t}
+		  done
+	      done
+	  fi
+
+	  for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
+	  #
+	      (( nb = ${mois} - 1 ))
+	  #
+	      OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
+	      IGCM_sys_ncra -O -d time_counter,${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
+	  done
+	  IGCM_sys_Rm ${liste_file_se_tmp[*]}
+	  eval ExitFlag=false
+	  IGCM_debug_Verif_Exit_Post
+	  ;;
+	# For Monthly simulation :
+	1M|1m)
+	  for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
+	      #
+	      (( nb = ${mois} - 1 ))
+	      #
+	      OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
+	      #
+	      (( an = an_deb ))
+	      # Initialize array
+	      set -A liste_file_se
+	      set -A liste_file_se_tmp
+	      while [ ${an} -le ${an_fin} ] ; do
+		  moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
+		  #
+		  an4=$(printf "%04i\n" ${an} )
+	          #
+		  date=${an4}${mois}01_${an4}${mois}${moisL}
+		  set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
+		  set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
+		  (( an = an + 1 ))
+	      done
+	      #
+	      IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
+	      eval ExitFlag=false
+	      IGCM_debug_Verif_Exit_Post
+	      
+	      # Apply IGCM_Patch if needed
+	      if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
+		  for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
+		      for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
+			  IGCM_${Patch} ${file_t}
+		      done
+		  done
+	      fi
+	      
+	      IGCM_sys_ncra -O ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
+	      IGCM_sys_Rm ${liste_file_se_tmp[*]}
+	      eval ExitFlag=false
+	      IGCM_debug_Verif_Exit_Post
+	  done
+	  ;;
+	*D|*d)
+	  for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
+	      #
+	      (( nb = ${mois} - 1 ))
+	      #
+	      OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
+	      #
+	      (( an = an_deb ))
+	      # Initialize array
+	      set -A liste_file_se
+	      set -A liste_file_se_tmp
+	      while [ ${an} -le ${an_fin} ] ; do
+		  moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
+		  #
+		  an4=$(printf "%04i\n" ${an} )
+	          #
+		  length_d=$(( ${config_UserChoices_PeriodLength} - 1 ))
+		  # for one day
+		  if [ ${length_d} -eq 1 ] ; then
+		      (( length_d = 0 ))
+		  fi
+		  (( day  = 1 ))
+		  while [ ${day} -le ${moisL} ] ; do
+		      day2=$(printf "%02i\n" ${day} )
+		      day_beg=${an4}${mois}${day2}
+		      day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} )
+		      date=${an4}${mois}${day_beg}_${an4}${mois}${day_end}
+		      set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
+		      set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
+		      (( day = day + 1 ))
+		  done
+		  (( an = an + 1 ))
+	      done
+	      #
+	      IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
+	      eval ExitFlag=false
+	      IGCM_debug_Verif_Exit_Post
+	      
+	      # Apply IGCM_Patch if needed
+	      if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
+		  for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
+		      for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
+			  IGCM_${Patch} ${file_t}
+		      done
+		  done
+	      fi
+
+	      IGCM_sys_ncra -O ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
+	      IGCM_sys_Rm ${liste_file_se_tmp[*]}
+	      eval ExitFlag=false
+	      IGCM_debug_Verif_Exit_Post
+	  done
+	  ;;
+        esac
+	#
+	IGCM_sys_ncrcat -O ${OUT_SE[*]} ${RESULT_SE}
+	#
+	IGCM_sys_Rm ${OUT_SE[*]}
+	#
+	${ncatted} -a modulo,time_counter,c,c," " ${RESULT_SE}
+	#
+	eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE}
+	IGCM_sys_Rm ${RESULT_SE}
+	#
+	eval ExitFlag=false
+	IGCM_debug_Verif_Exit_Post
+    done
+done
+
+# DODS copy
+for comp in ${config_ListOfComponents[*]} ; do
+    for SE_Dir in $( ls ${R_SAVE}/${comp}/Analyse/ 2>&1 | grep SE ) ; do
+	[ -d ${R_SAVE}/${comp}/Analyse/${SE_Dir} ] && IGCM_sys_Put_Dods ${comp}/Analyse/${SE_Dir}
+    done
+done
+
+YEARS=${an_deb}_${an_fin}
+
+# clean environment variables and export usefull one :
+if [ X$( hostname -s ) = Xrhodes ] ; then
+    LISTE_ENV=$( env | grep -iv MYLANG | grep -iv HOST | grep -iv LOGIN | grep -iv config_ | grep -iv R_ | grep -iv libIGCM | grep -iv PERIOD \
+	| grep -iv DMFDIR | grep -iv AN_| grep -iv YEARS | grep -iv ex | grep -iv RESOL_ | grep -iv PATH | grep -iv WORKDIR | grep -iv USER   \
+	| grep -iv LOGNAME | grep -iv PROFILE | grep -iv ENV | grep -iv TMPDIR | grep -iv POST_DIR | grep -iv DB |awk -F= '{print $1}' )
+    
+    for variables in ${LISTE_ENV} ; do
+	unset ${variables}
+    done
+fi
+
+export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone
+export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_SRF
+export R_SAVE; export config_UserChoices_JobName; export config_UserChoices_TagName; export YEARS; 
+listVarEnv="POST_DIR,SUBMIT_DIR,libIGCM,R_INIT,R_BC,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF,R_SAVE,config_UserChoices_JobName,config_UserChoices_TagName,YEARS"
+export listVarEnv;
+
+#D-
+# --------------------------------------------------------------------
+#D- Test if all was right before ATLAS
+# --------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+
+if [ ${config_UserChoices_TagName} = "IPSLCM4_v1_OASIS3" ] || \
+   [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ]        || \
+   [ ${config_UserChoices_TagName} = "IPSLCM5" ]           || \
+   [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then
+    #
+    IGCM_sys_QsubPost atlas_ORCHIDEE     ;
+    IGCM_sys_QsubPost atlas_LMDZ         ;
+    IGCM_sys_QsubPost atlas_ORCA_LIM     ;
+    IGCM_sys_QsubPost additionnal        ;
+    #
+elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ]  || \
+     [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] || \
+     [ ${config_UserChoices_TagName} = "LMDz4OR_v2" ] ; then
+    #
+    IGCM_sys_QsubPost atlas_LMDZ         ;
+    IGCM_sys_QsubPost atlas_ORCHIDEE     ;
+    #
+elif [ ${config_UserChoices_TagName} = "OL" ]      || \
+     [ ${config_UserChoices_TagName} = "OL2" ] ; then
+    #
+    IGCM_sys_QsubPost atlas_ORCHIDEE     ;
+    #
+elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ] ; then
+    #
+    IGCM_sys_QsubPost atlas_ORCA_LIM     ;
+    IGCM_sys_QsubPost additionnal        ;
+    #
+fi
Index: /tags/libIGCM_v1_1/AA_create_ts
===================================================================
--- /tags/libIGCM_v1_1/AA_create_ts	(revision 19)
+++ /tags/libIGCM_v1_1/AA_create_ts	(revision 19)
@@ -0,0 +1,699 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J TS                     # Nom du job
+#-Q- platine #BSUB -N                        # message a la fin du job
+#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00                   # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #QSUB -r TS                   # Nom du job
+#-Q- sx8brodie #QSUB -lT 1:00:00             # limite en temps total
+#-Q- sx8brodie #QSUB -lt 1:00:00             # limite en temps par process
+#-Q- sx8brodie #QSUB -lM 1Gb  
+#-Q- sx8brodie #QSUB -eo                     # rassemble standard error et output
+#-Q- sx8brodie #QSUB -J m
+#-Q- sx8brodie #QSUB -l mpp_p=4
+#-Q- sx8brodie #QSUB -s /bin/ksh             # shell du job
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N TS                   # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=2:00:00   # Limite temps a 2 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Flag to determine job's output directory
+#D- Default : value from libIGCM_post.ksh if any
+POST_DIR=${POST_DIR:=${PBS_O_WORKDIR}}
+
+#D- Increased verbosity (1, 2, 3)
+#D- Default : value from AA_job if any
+Verbosity=${Verbosity:=3}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+DEBUG_debug=${DEBUG_debug:=false}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+libIGCM=${libIGCM:=/work/cont003/p86denv/PARA_SX8_ORCA2xLMD144142/Prelude/modipsl/libIGCM}
+
+#D- TEMPORARY Flag to determine atmospheric resolution
+#D- Default : value from atmospheric driver if any
+RESOL_ATM=${RESOL_ATM:=LMD144142}
+
+#D- TEMPORARY Flag to determine ocean resolution
+#D- Default : value from ocean driver if any
+RESOL_OCE=${RESOL_OCE:=ORCA2}
+
+#D- TEMPORARY Flag to determine ice resolution
+#D- Default : value from ice driver if any
+RESOL_ICE=${RESOL_ICE:=ORCA2}
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SRF=${RESOL_SRF:=LMD144142}
+
+########################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     #; IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   #; IGCM_card_Check
+. ${libIGCM}/libIGCM_date/libIGCM_date.ksh   #; IGCM_date_Check
+
+########################################################################
+
+#set -vx
+
+# Max number of files we use with a command (ex : ncrcat, ...)
+UNIX_MAX_LIMIT=120
+
+# Useful cleaning function
+MENAGE () 
+{ 
+    [ -f $3 ] & ( rm -f $1/$2 ;) 
+}
+
+########################################################################
+
+#set -vx
+
+if [ ${DEBUG_debug} = true ] ; then
+    IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+    echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+fi
+IGCM_sys_Cd ${RUN_DIR_PATH}
+
+if [ ${StandAlone} = true ] ; then
+    CARD_DIR=${SUBMIT_DIR}
+else
+    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
+    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
+fi
+
+#
+# First of all
+#
+IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
+typeset option
+for option in ${config_UserChoices[*]} ; do
+    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
+done
+#
+echo
+IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
+IGCM_debug_PrintVariables 3 config_UserChoices_JobName
+IGCM_debug_PrintVariables 3 config_UserChoices_LongName
+IGCM_debug_PrintVariables 3 config_UserChoices_TagName
+IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
+IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
+IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
+IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
+echo
+
+#==================================
+
+R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+#
+IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card ListOfComponents
+#
+# Determine period for time series. Default : value from AA_job if any
+#
+DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
+#
+PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
+
+########################################################################
+#
+#      Depending on requested time series fill following variables :
+#
+#                           - LISTE_FILE_${comp}[*]
+#                           - LISTE_VARS_${file}[*]
+#                           - LISTE_AXIS_${file}[*]
+#                           - LISTE_PATCH_${file}[*]
+########################################################################
+
+#
+# For each selected component determine which files need post-processing
+#
+DoJob=false
+for comp in ${config_ListOfComponents[*]} ; do
+    #
+    ActiveComp=false
+    #
+    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
+    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+    #
+    card=${CARD_DIR}/COMP/${compname}.card
+    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
+    #
+    ListFilesName=${compname}_OutputFiles_List
+    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+    #
+    if [ X${FileName0} != X${NULL_STR} ] ; then
+	#
+	#IGCM_debug_Print 1 "Component      : ${compname}"
+	#
+	# INITIALISATION
+	#
+	eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+	typeset i=0
+	#
+	until [ $i -eq $NbFiles ]; do
+	    #
+	    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	    eval file_in=${file_in_}
+	    let $(( i_ = i+2 ))
+	    eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+	    eval flag_post=${flag_post_}
+	    #
+	    if [ X${flag_post} != XNONE ] ; then
+		#
+	        # Initialize ${flag_post}_${compname}_${post_freq}
+		#
+		eval ${flag_post}_${compname}_TimeSeriesFrequency=true
+	    fi
+	    let $(( i=i+3 ))
+	done
+    fi
+
+    for element in $( set | grep Post_ | grep ${compname}_TimeSeriesFrequency | grep -i "=true" ) ; do
+	#
+	FILE=$( echo ${element} | awk -F "_${compname}" '{print $1}' | awk "-FPost_" '{print $2}' )
+	#
+	# For each comp and each file who needs post-processing
+	# determine which variables need time series.
+	#
+	IGCM_card_DefineArrayFromOption ${card} Post_${FILE} TimeSeriesVars
+	#
+	if [ $( eval echo \$\{${compname}_Post_${FILE}_TimeSeriesVars} ) = ${NULL_STR} ] ; then
+	    #
+	    IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}"
+	    continue
+	    #
+	fi
+	#
+	IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
+	#
+	# So we need coordinates axis to properly fill produced time series
+	#
+	IGCM_card_DefineArrayFromOption ${card} Post_${FILE} GatherWithInternal
+	#
+	if [ $( eval echo \$\{${compname}_Post_${FILE}_GatherWithInternal} ) = ${NULL_STR} ] ; then
+	    #
+	    IGCM_debug_Print 1 "ERROR !! We miss coordinate axis for ${FILE} according to ${card}"
+	    IGCM_debug_Print 1 "So no time series will be produced for ${FILE} !!"
+	    continue
+	    #
+	fi
+	#
+	# CREATE LIST
+	#
+	FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' )
+	case ${FlagDir} in
+	    1Y)    TS_Dir=TS_YE  ;;
+	    1M)    TS_Dir=TS_MO  ;;
+	    5D|1D) TS_Dir=TS_DA  ;;
+	    HF)    TS_Dir=TS_HF  ;;
+	    INS)   TS_Dir=TS_INS ;;
+	esac
+
+	count=0
+	for var in $( eval echo \$\{${compname}_Post_${FILE}_TimeSeriesVars[*]} ) ; do
+	    #
+	    DIRECTORY=${R_SAVE}/${comp}/Analyse/${TS_Dir}
+	    TestedFile=${config_UserChoices_JobName}_${DateBegin}_${PeriodDateEnd}_${FlagDir}_${var}.nc
+	    #
+	    if [ ! -f ${DIRECTORY}/${TestedFile} ] ; then
+		eval set +A LISTE_VARS_${FILE} \$\{LISTE_VARS_${FILE}[*]} ${var}
+		ActiveComp=true
+		(( count = count + 1 ))
+	    fi
+	done
+
+	if [ ${count} -gt 0 ] ; then
+	    #
+	    eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE}
+	    eval set +A LISTE_AXIS_${FILE} \$\{${compname}_Post_${FILE}_GatherWithInternal[*]}
+	    eval set +A LISTE_PATCHES_${FILE} \$\{${compname}_Post_${FILE}_Patches[*]}
+	    if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) !=  X${NULL_STR} ]; then
+		for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do
+		    if [ Xload${Patch} != X ] ; then
+			. ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh
+			eval load${Patch}=loaded
+		    fi
+		done
+	    fi
+	    #
+	fi
+    done
+
+    if [ ${ActiveComp} = true ] ; then
+	set +A ActiveListOfComponents ${ActiveListOfComponents[*]} ${comp}
+    fi
+
+done
+
+set -A config_ListOfComponents ${ActiveListOfComponents[*]}
+[ ! -z "${ActiveListOfComponents}" ] && DoJob=true
+
+########################################################################
+#
+#                          DEFINE DATE FUNCTIONS
+#
+########################################################################
+
+# Give the end of the next $1 period from $2 date
+function create_ts_next_date {
+    IGCM_debug_PushStack "create_ts_next_date" $@
+    typeset year month Length
+    case ${1} in
+	1Y|1y)
+	    IGCM_date_GetYearMonth ${2} year month
+	    Length=$( IGCM_date_DaysInYear $(( year + 1 )) ) ;;
+	1M|1m)
+	    IGCM_date_GetYearMonth ${2} year month
+	    if [ $month -lt 12 ] ; then
+		Length=$( IGCM_date_DaysInMonth $year $(( month + 1 )) )
+	    else
+		Length=$( IGCM_date_DaysInMonth $(( year + 1 )) 1 )
+	    fi ;;
+	*D|*d)
+	    Length=$( echo ${1} | sed -e "s/[dD]//" ) ;;
+	*)
+	    IGCM_debug_Exit "create_ts " ${1} " invalid PeriodLength : choose in 1Y, 1M, 5D, 1D."
+	    IGCM_debug_Verif_Exit_Post ;;
+    esac
+    echo ${Length}
+
+    IGCM_debug_PopStack "create_ts_next_date"
+}
+
+# Give the end of the actual $1 period from $2 date
+function create_ts_begin_date {
+    IGCM_debug_PushStack "create_ts_begin_date" $@
+    typeset year month Length
+    case ${1} in
+	1Y|1y)
+	    IGCM_date_GetYearMonth ${2} year month
+	    Length=$( IGCM_date_DaysInYear $year ) ;;
+	1M|1m)
+	    IGCM_date_GetYearMonth ${2} year month
+	    Length=$( IGCM_date_DaysInMonth $year $month ) ;;
+	*D|*d)
+	    Length=$( echo ${1} | sed -e "s/[dD]//" ) ;;
+	*)
+	    IGCM_debug_Exit "create_ts " ${1} " invalid PeriodLength : choose in 1Y, 1M, 5D, 1D."
+	    IGCM_debug_Verif_Exit_Post ;;
+    esac
+    echo ${Length}
+
+    IGCM_debug_PopStack "create_ts_begin_date"
+}
+
+########################################################################
+#
+#               IS THERE SOME ALLREADY PRODUCED TIME SERIES ?
+#                 IF SO BRING THEM IN THE WORKING DIRECTORY
+#
+# PS : Keep in mind that IGCM_sys_Get here is a weak link :
+#      - especially for IDRiS
+#      - no special protection against "command too long" !
+#      - libIGCM_sys should handle that or modify following code part
+#
+########################################################################
+
+if [ ${StandAlone} != true ] ; then
+    Running_Flag=$( IGCM_sys_RshMaster "IGCM_card_DefineVariableFromOption \
+       ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning ; \
+       echo \${run_PostProcessing_TimeSeriesRunning}" )
+
+    if [ X${Running_Flag} = Xy ] ; then
+        # Time Series Job allready running
+	IGCM_debug_Print 1 "Time Series Job allready running exit"
+	exit
+    fi
+    # Now run.card know we are running
+    IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "y"
+    # Get information from last execution
+    CompletedFlag=$( IGCM_sys_RshMaster \
+	"IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted ;\
+        echo \${run_PostProcessing_TimeSeriesCompleted}" )
+fi
+
+# Is it the first submission or not ?
+if [ X${CompletedFlag} = X ] ; then
+    # First Time Series Submission
+    FIRST_PASS=TRUE
+    Length=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DateBegin} )
+    DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) )
+else
+    # Last Completed Time Series
+    FIRST_PASS=FALSE
+    DATE_FIN_JOB_B=${CompletedFlag}
+    date=${DateBegin}_${DATE_FIN_JOB_B}
+    for comp in ${config_ListOfComponents[*]} ; do
+	#
+	IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp}
+        #
+	IGCM_sys_Cd ${RUN_DIR_PATH}/${comp}
+	#
+	set -A liste_file
+	#
+	file_path=${R_SAVE}/${comp}/Analyse
+	#
+	i=0
+	file=${NULL_STR}
+	#
+	for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
+	    #
+	    # Determine in which output can we find file
+	    # IE : Analyse/TS or Analyse/DA2TS or ...
+	    #
+	    FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
+	    case ${FlagDir} in
+		1Y)    TS_Dir=TS_YE  ;;
+		1M)    TS_Dir=TS_MO  ;;
+		5D|1D) TS_Dir=TS_DA  ;;
+		HF)    TS_Dir=TS_HF  ;;
+		INS)   TS_Dir=TS_INS ;;
+	    esac
+	    for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do
+		#
+		set +A liste_file ${liste_file[*]} ${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc
+		#
+	    done
+	done
+	if [ X${file} != X${NULL_STR} ] ; then
+	    IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp}
+	    IGCM_debug_Verif_Exit_Post
+	fi
+    done
+    #
+    LEVEL=0
+    #
+fi
+
+########################################################################
+#
+#                          DEFINE LOOP PARAMETERS
+#
+########################################################################
+
+DATE_COUNT=${DATE_FIN_JOB_B}
+DATE_FIN_JOB_B_LOOP=${DATE_FIN_JOB_B}
+
+( [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] ) && NBRE_FILE_TOT=0 || NBRE_FILE_TOT=1
+
+if [ ${DoJob} = true ] ; then
+    while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do
+	(( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 ))
+	Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_COUNT} )
+	DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} )
+    done
+else
+    NBRE_FILE_TOT=0
+fi
+
+if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then
+    NBRE_TOUR=1 
+elif [ ${NBRE_FILE_TOT}%${UNIX_MAX_LIMIT} -eq 0 ] ; then
+    let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT} 
+else
+    let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT}+1
+fi
+
+CURRENT_LOOP=1
+# THIS LOOP GIVES PARAMETERS FOR THE DATE'S LOOP ie : DATE_COURANTE, DATE_FIN.
+# WE HAVE 3 LEVELS 
+#    - LEVEL 1 : JUST ONE LOOP TO COMPLETE
+#    - LEVEL 2 : WE ARE IN THE "DEEP" LOOP
+#    - LEVEL 3 : WE ARE IN THE LAST LOOP
+
+while [ ${CURRENT_LOOP} -le  ${NBRE_TOUR} ] ; do
+      
+    if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then 
+        # - LEVEL 1 : JUST ONE LOOP TO COMPLETE
+	NBRE_FILE_LOOP=${NBRE_FILE_TOT}
+
+        if [ ${FIRST_PASS} = TRUE ] ; then
+	    DATE_COURANTE=${DATE_FIN_JOB_B_LOOP}
+	else
+	    Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN_JOB_B_LOOP} )
+	    DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} )
+	fi
+
+	DATE_FIN=${PeriodDateEnd}
+	DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP}
+
+	[ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
+	[ -n "${LEVEL}" ] && FLAG_B="TRUE" || FLAG_B="FALSE"
+
+	LEVEL=1
+	DEPOT="TRUE"	 
+    elif [ ${CURRENT_LOOP} -ne  ${NBRE_TOUR} ] ; then
+	# - LEVEL 2 : WE ARE IN THE "DEEP" LOOP
+	NBRE_FILE_LOOP=${UNIX_MAX_LIMIT}
+
+        if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then
+	    Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN_JOB_B_LOOP} )
+	    DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} )
+	elif [ -z "${DATE_COURANTE}" ] ; then
+	    DATE_COURANTE=${DATE_FIN_JOB_B}
+	else
+	    Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN} )
+	    DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} )
+	fi
+	 
+	(( TotLength = 0 ))
+	COMPTEUR=1
+	DATE_LOOP=${DATE_COURANTE}
+
+	while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do
+	    #
+	    Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} )
+	    DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} )
+	    (( TotLength = TotLength + Length ))
+	    (( COMPTEUR = COMPTEUR + 1 ))
+	    #
+	done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done
+	DATE_FIN=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} ${TotLength} )
+
+	[ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
+	[ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] && FLAG_B="TRUE" || [ ${CURRENT_LOOP} -gt 1 ] && FLAG_B="TRUE" || FLAG_B="FALSE"
+	DEPOT="FALSE"
+	LEVEL=2
+    else
+	# - LEVEL 3 : WE ARE IN THE LAST LOOP
+	NBRE_FILE_LOOP=$( expr ${NBRE_FILE_TOT} % $(( UNIX_MAX_LIMIT * $(( CURRENT_LOOP - 1 )) )) )
+	[ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT}
+
+	Length=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_FIN} )
+	DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} )
+	DATE_FIN=${PeriodDateEnd}
+	[ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP}
+
+	LEVEL=3
+	DEPOT="TRUE"
+	FLAG_B="TRUE"
+    fi
+
+    # THEN FOR EACH FILE TYPE WE LOOP BETWEEN DATE_COURANTE AND DATE_FIN.
+    for comp in ${config_ListOfComponents[*]} ; do
+	#
+	IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp}
+        #
+	IGCM_sys_Cd ${RUN_DIR_PATH}/${comp}
+	#
+	eval R_OUT_${comp}=${R_SAVE}/${comp}
+	#
+	i=0
+	#
+	for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
+	    #
+	    # Determine in which output can we find file
+	    # IE : Output/MO or Output/DA or ...
+	    #
+	    FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
+	    case ${FlagDir} in
+		1Y)    TS_Dir=TS_YE  ; FreqDir=AN  ;;
+		1M)    TS_Dir=TS_MO  ; FreqDir=MO  ;;
+		*D)    TS_Dir=TS_DA  ; FreqDir=DA  ;;
+		HF)    TS_Dir=TS_HF  ; FreqDir=HF  ;;
+		INS)   TS_Dir=TS_INS ; FreqDir=INS ;;
+		*) 
+	               IGCM_debug_Print 1 "Error in FlagDir=${FlagDir} for file ${file}."
+		       IGCM_sys_Exit "Job create_ts" ;;
+	    esac
+
+	    # Initialize array
+	    set -A liste_file
+	    set -A liste_file_tmp
+
+	    eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/
+
+	    COMPTEUR=1
+	    DATE_LOOP=${DATE_COURANTE}
+
+	    while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do
+		#
+		Length1=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} )
+	        DATE_TAB=$(  IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP}
+
+		Length2=$( create_ts_next_date ${config_UserChoices_PeriodLength} ${DATE_LOOP} )
+		DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} )
+
+	        set +A liste_file ${liste_file[*]} ${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
+	        set +A liste_file_tmp ${liste_file_tmp[*]} ${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
+	        (( COMPTEUR = COMPTEUR + 1 ))
+		#
+	    done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done
+	    DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} -${Length2} )
+
+	    # Get selected files
+	    IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp}
+	    eval ExitFlag=false
+	    IGCM_debug_Verif_Exit_Post
+
+	    # Apply IGCM_Patch if needed
+	    if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
+		for file_t in $( eval echo ${liste_file_tmp[*]} ); do		
+		    for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
+			IGCM_${Patch} ${file_t}
+		    done
+		done
+	    fi
+
+	    # WE CAN CONCATENATE FILES AT THIS POINT
+	    [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC}
+	    Length=$( create_ts_begin_date ${config_UserChoices_PeriodLength} ${DATE_COURANTE} )
+	    DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) )
+	    DATE_BUILD=${DATE_BUILD1}_${DATE_FIN}
+	    DATE_BUILD_END=${DateBegin}_${DATE_FIN}
+
+	    liste_coord=" "
+	    for axis in $( eval echo \${LISTE_AXIS_${file}[*]} ); do
+	      liste_coord=${liste_coord}${axis}","
+	    done
+
+	    # Time axis must be the last dimension
+	    time_axis=${axis}
+
+	    # SWITCH BETWEEN MODEL TO FIT PARTICULAR CASE
+	    for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do
+		#
+	        IGCM_sys_ncrcat --hst -v ${liste_coord}${var} ${liste_file_tmp[*]} ${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
+	        #
+#                 # Change time axis name to be CF compliant
+#                 if [ ${time_axis} != time_counter ]; then
+# 		    IGCM_sys_ncrename -O -v ${time_axis},time_counter ${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
+#                 fi
+		#
+	        if [ "${FLAG_B}" = "TRUE" ] ; then
+		    # WE CONCATENATE WITH EXISTING FILES
+		    file1=${config_UserChoices_JobName}_${DATE_BUILD_B}_${FlagDir}_${var}.nc
+		    file2=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
+		    file_out=${config_UserChoices_JobName}_${DATE_BUILD_END}_${FlagDir}_${var}.nc
+		    IGCM_sys_ncrcat --hst ${file1} ${file2} ${file_out}
+		    #
+		    IGCM_sys_Rm ${file1} ${file2}
+	        fi
+		#
+	        if [ "${DEPOT}" = "TRUE" ] ; then
+		    # WE PUT FINAL FILE ON FILE SYSTEM
+		    [ "${FLAG_B}" = "FALSE" ] && file_out=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc
+		    #${ncatted} -a modulo,time_counter,c,c," " ${file_out}
+		    file_before=${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_${FlagDir}_${var}.nc
+		    eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}}/Analyse/${TS_Dir}/${file_out}
+		    [ "${FLAG_B}" = "TRUE" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/${TS_Dir} ${file_before} ${file_out}
+		    IGCM_sys_Rm ${file_out}
+		    #
+	        fi
+		#
+		eval ExitFlag=false
+		IGCM_debug_Verif_Exit_Post
+	    done     # for var in ${liste_var} ; do
+	    IGCM_sys_Rm ${liste_file_tmp[*]}
+	done         # for file in ${liste_file_brut} do
+    done             # for comp in ${config_ListOfComponents[*]} ; do
+    eval ExitFlag=false
+    IGCM_debug_Verif_Exit_Post
+    # GO AHEAD IN DEEPEST LOOP
+    (( CURRENT_LOOP = CURRENT_LOOP + 1 ))
+done                 # while [ ${CURRENT_LOOP} -le  ${NBRE_TOUR} ] do
+# FINISH
+
+# DODS copy
+for comp in ${config_ListOfComponents[*]} ; do
+    for TS_Dir in $( ls ${R_SAVE}/${comp}/Analyse/ 2>&1 | grep TS_ ) ; do
+	[ -d ${R_SAVE}/${comp}/Analyse/${TS_Dir} ] && IGCM_sys_Put_Dods ${comp}/Analyse/${TS_Dir}
+    done
+done
+
+# clean environment variables and export usefull one :
+if [ X$( hostname -s ) = Xrhodes ] ; then
+    LISTE_ENV=$( env | grep -iv MYLANG | grep -iv HOST | grep -iv LOGIN | grep -iv config_ | grep -iv R_ | grep -iv libIGCM | grep -iv PERIOD \
+	| grep -iv DMFDIR | grep -iv AN_| grep -iv YEARS | grep -iv ex | grep -iv RESOL_ | grep -iv PATH | grep -iv WORKDIR | grep -iv USER   \
+	| grep -iv LOGNAME | grep -iv PROFILE | grep -iv ENV | grep -iv TMPDIR | grep -iv POST_DIR | grep -iv StandAlone | grep -iv DB | awk -F= '{print $1}' )
+ 
+    for variables in ${LISTE_ENV} ; do
+	unset ${variables}
+    done
+fi
+
+export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone
+export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_SRF
+
+listVarEnv="POST_DIR,SUBMIT_DIR,libIGCM,R_INIT,R_BC,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
+export listVarEnv
+
+#D-
+# --------------------------------------------------------------------
+#D- Test if all was right
+# --------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+# --------------------------------------------------------------------
+#D- Submit MONITORING
+# --------------------------------------------------------------------
+IGCM_sys_QsubPost monitoring
+
+#D-
+# --------------------------------------------------------------------
+#D- Update the run.card
+# --------------------------------------------------------------------
+if [ ${StandAlone} != true ] ; then
+    # Put in run.card end period of time series
+    IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted "${DATE_FIN}"
+    # We have finish the job !
+    IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "n"
+fi
+date
Index: /tags/libIGCM_v1_1/AA_job
===================================================================
--- /tags/libIGCM_v1_1/AA_job	(revision 19)
+++ /tags/libIGCM_v1_1/AA_job	(revision 19)
@@ -0,0 +1,393 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J ::Jobname::       # nom de la requete
+#-Q- platine #BSUB -N                   # message a la fin du job
+#-Q- platine #BSUB -o Script_Output_::Jobname::.1    # nom du fichier de sortie
+#-Q- platine #BSUB -n ::JobNumProcTot::             # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00           # Limite temps
+#-Q- platine BATCH_NUM_PROC_TOT=$SLURM_NPROCS 
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #PBS -N ::Jobname::         # nom de la requete
+#-Q- sx8brodie #PBS -m a                   # message a la fin du job
+#-Q- sx8brodie #PBS -j o                   # regroupement des sorties du job : standard error et output
+#-Q- sx8brodie #PBS -o Script_Output_::Jobname::.1  # nom du fichier de sortie
+#-Q- sx8brodie #PBS -S /usr/bin/ksh        # shell de soumission
+#-Q- sx8brodie #PBS -v BATCH_NUM_PROC_TOT=::JobNumProcTot::
+#-Q- sx8brodie #PBS -q ::JobClass::                # classe multi pour BATCH_NUM_PROC_TOT superieur a 2, mono sinon
+#-Q- sx8brodie #PBS -l cpunum_job=${BATCH_NUM_PROC_TOT}  # reservation des processeurs pour le job
+#-Q- sx8brodie #PBS -l memsz_job=6.0gb     # Limite memoire
+#-Q- sx8brodie #PBS -l cputim_job=1:00:00  # Limite temps
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N ::Jobname::           # nom de la requete
+#-Q- sx8mercure #PBS -m a                     # message a la fin du job
+#-Q- sx8mercure #PBS -j o                     # regroupement des sorties du job : standard error et output
+#-Q- sx8mercure #PBS -o Script_Output_::Jobname::.1   # nom du fichier de sortie
+#-Q- sx8mercure #PBS -S /usr/bin/ksh          # shell de soumission
+#-Q- sx8mercure #PBS -v BATCH_NUM_PROC_TOT=::JobNumProcTot::
+#-Q- sx8mercure #PBS -l cpunum_job=${BATCH_NUM_PROC_TOT}          # reservation des processeurs pour le job
+#-Q- sx8mercure #PBS -l memsz_job=6.0gb       # limite memoire
+#-Q- sx8mercure #PBS -l elapstim_req=00:30:00 # limite en temps elapsed
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+#-Q- default #For MPI use, uncomment next line : 
+#-Q- default #BATCH_NUM_PROC_TOT=::JobNumProcTot::
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+#set -eu
+#set -vx
+
+date
+echo
+echo "#######################################"
+echo "#       ANOTHER GREAT SIMULATION      #"
+echo "#######################################"
+echo
+
+#D--------------------------------------------------------------------==
+#D--------------------------------------------------------------------==
+#D-
+#D-                      Job to launch IGCM models
+#D-
+#D--------------------------------------------------------------------==
+#D--------------------------------------------------------------------==
+#D-
+
+MODIPSL=::modipsl::
+libIGCM=${MODIPSL}/libIGCM
+
+#D--------------------------------------------------------------------==
+#D-                   -1. User modification place
+#D-                      - Job Verbosity
+#D-                      - PeriodNb
+#D--------------------------------------------------------------------==
+
+#D- Increased verbosity (1, 2, 3)
+Verbosity=3
+#D- Number of execution in one job
+PeriodNb=1
+
+#D-
+# --------------------------------------------------------------------
+#D- ! Optionnal features /!\ Use with care !
+# --------------------------------------------------------------------
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default=true
+DEBUG_debug=false
+
+#D- Set DEBUG_sys to false to disable output calls of function
+#D- Default=true
+#DEBUG_sys=false
+
+#D- Define running directory
+#D- Default=${TMPDIR} ie temporary batch directory
+#RUN_DIR_PATH=/workdir4/rech/ces/rces452/BABATEST/TESTPOST
+
+#D- Define submit directory
+#D- Default= where you launch qsub
+#SUBMIT_DIR=/workdir4/rech/ces/rces452/SCRIPT_V1/modipsl/config/IPSLCM4_v1_OASIS3/EXP01
+
+#D- Turn in dry run mode ? (0,1,2,3)
+#D- Default=0
+#DRYRUN=3
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#D- Define input file root directory
+#D- Default=/u/rech/ces/rces452/IGCM
+#R_IN=/u/rech/por/rpor111/DATA
+
+#D-
+#D--------------------------------------------------------------------==
+#D-                   0. System Environment 
+#D-                      - Define variables for Number of processors
+#D-                      - Define MPI variables
+#D-                      - Define batch scheduler variables
+#D-                      - Source IGCM Library
+#D-                      - Get RESOLution in .resol file (temporary)
+#D--------------------------------------------------------------------==
+
+#D--------------------------------------------------------------------==
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+        ( ${DEBUG_debug} ) && IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+       ( ${DEBUG_debug} ) && IGCM_card_Check
+. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
+       ( ${DEBUG_debug} ) && IGCM_date_Check
+#-------
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
+. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
+. ${libIGCM}/libIGCM_comp/libIGCM_comp.ksh
+. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
+
+#D--------------------------------------------------------------------==
+
+#-- Resolution FLAG for oasis input
+RESOL=$(cat ${SUBMIT_DIR}/../.resol)
+#RESOL="ORCA2xLMD9671"
+
+#D-
+#D--------------------------------------------------------------------==
+#D-           1. INITIALIZE CONFIGURATION AND THEN COMPONENTS
+#D--------------------------------------------------------------------==
+
+# --------------------------------------------------------------------==
+#D- Initialize configuration : 
+#D-              - Simulation configuration
+#D-              - Simulation parameters 
+#D-              - Execution parameter
+#D-              - Define input files directory
+#D-              - Read or initialize CumulPeriod
+#D-              - run.card
+#D-
+# --------------------------------------------------------------------==
+IGCM_config_Initialize
+
+# --------------------------------------------------------------------==
+#D- Define, create and cd RUN_DIR
+#D-  
+# --------------------------------------------------------------------==
+RUN_DIR=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+IGCM_sys_MkdirWork ${RUN_DIR}
+IGCM_sys_Cd ${RUN_DIR}
+
+# --------------------------------------------------------------------==
+#D- Initialize each components taking part
+#D- into simulation configuration :
+#D-         - Define component executable
+#D-         - Define Write Frequency by component "1M" "1D" ...
+#D-         - Source ${comp}.driver
+#D-         - Define Storage Places by component
+#D-         - ${comp}_Initialize :
+#D-         - Patterns to sed
+#D-         - Variables from namelist
+#D-
+# --------------------------------------------------------------------==
+IGCM_comp_Initialize
+
+# --------------------------------------------------------------------==
+#D- Verify compatibility of period length and write frequencies
+#D-
+# --------------------------------------------------------------------==
+#IGCM_config_Check
+
+#D--------------------------------------------------------------------==
+#D-                  2. ENTER THE DEEP EXECUTION LOOP
+#D-                  !!!! FASTEN YOUR SEAT BELTS !!!!
+#D-                  !!!!!      PLEASE.          !!!!
+#D-                  !! WE WILL CROSS TURBULENCES. !!
+#D--------------------------------------------------------------------==
+
+Period=1
+while [ ${Period} -le ${PeriodNb} ]; do
+
+    echo
+    echo "Starting iteration ${Period} / ${PeriodNb}"
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- COMPUTE AND DEFINE DATE STUFF.
+    # ------------------------------------------------------------------
+    IGCM_config_PeriodStart
+    #D- => ${PeriodDateBegin}
+    #D- => ${PeriodDateEnd}
+    #D- => ${CumulPeriod}
+    #D- => ${DatesPeriod}=${PeriodDateBegin}_${PeriodDateEnd}
+    #D- => ${PeriodLength} => JOURS=31 , 28, 29, 30 ; MOIS=0 ; ANS=0
+    #D- => update run.card value
+    
+    #D-
+    # ------------------------------------------------------------------
+    #D- Get parameters text files updated by job (.def, namelist ...)
+    #D- READ AND USE BY GCM AT EACH EXECUTION.
+    # ------------------------------------------------------------------
+    IGCM_comp_GetInputParametersFiles
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Get initial state (Etat0, carteveg,relief...)
+    #D- NECESSARY ONLY IF CumulPeriod= (=> NUMERO) == 1
+    #D- AND ???_Restart=NO
+    #D- READ AND USE BY GCM FOR ONLY ONE EXECUTION.
+    # ------------------------------------------------------------------
+    IGCM_comp_GetInputInitialStateFiles
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Get Boundaries Conditions (SST, WIND[X,Y,Z], LAI ...)
+    #D- READ AND USE BY GCM AT EACH EXECUTION.
+    # ------------------------------------------------------------------
+    IGCM_comp_GetInputBoundaryFiles
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Get restart files (restartphy.nc, orca_restart.nc ...)
+    #D- READ AND USE BY GCM AT EACH EXECUTION.
+    #D-
+    #D- IF A COMPONENT DO NOT RESTART FROM PREVIOULSY COMPUTED RESTART
+    #D- ONLY IF CumulPeriod= (=> NUMERO) == 1
+    #D- MUST EXECUTE CREATE ETAT0_LIMIT (TYPICALLY LMDZ AND ./create_etat0_limit.e)
+    #D-
+    #D- IF CumulPeriod == 1
+    #D- AND A COMPONENT RESTART FROM PREVIOULSY COMPUTED RESTART
+    #D- MUST BRING THIS RESTART IN ${RUN_DIR_PATH}
+    #D-
+    #D- ELSE BRING RESTART FROM ${JobName} IN ${RUN_DIR_PATH}
+    # ------------------------------------------------------------------
+    IGCM_comp_GetInputRestartFiles
+    
+    #D-
+    # ------------------------------------------------------------------
+    #D- Test if all was right before Update
+    # ------------------------------------------------------------------
+    IGCM_debug_Verif_Exit
+
+    # ------------------------------------------------------------------
+    #D- Activate running environnement variables
+    # ------------------------------------------------------------------
+    IGCM_sys_activ_variables
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- UPDATE ParametersFiles (.def, namelist ...) with 
+    #D- current value of (ORCA_NIT00, ORCA_LRSTAR, RAZ_DATE, ...)
+    # ------------------------------------------------------------------
+    IGCM_comp_Update
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Test if all was right before execution
+    # ------------------------------------------------------------------
+    IGCM_debug_Verif_Exit
+
+    #D-
+    #D----------------------------------------------------------------==
+    #D-                          3. Execution
+    #D----------------------------------------------------------------==
+
+    echo
+    echo "#######################################"
+    echo "#      DIR BEFORE RUN EXECUTION       #"
+    echo "#######################################"
+    echo
+    ls -lrt
+
+    echo "========================================================================"
+    if ( [ X${BATCH_NUM_PROC_TOT} != X ] && [ "${BATCH_NUM_PROC_TOT}" -gt 1 ] ) ; then
+	MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND}
+	eval MPIRUN_OPTIONS=${config_UserChoices_JobRunOptions}
+    else
+	MPIRUN_COMMAND=${MPIRUN_COMMAND:="time "}
+	MPIRUN_OPTIONS=${MPIRUN_OPTIONS:=""}
+    fi
+
+    if [ ${DRYRUN} -le 1 ] ; then
+	REAL_DATE_INIT=$( date )
+        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} > ${Exe_Output} 2>&1"
+	typeset RET
+	${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} > ${Exe_Output} 2>&1
+	RET=$?
+	if [ ${RET} -gt 0 ] ; then
+	    echo "Return code of executable :" ${RET}
+	    IGCM_debug_Exit "EXECUTABLE"
+	    IGCM_sys_Cp ${Exe_Output} ${SUBMIT_DIR}/${PREFIX}_${Exe_Output}_error
+	fi
+	echo ${REAL_DATE_INIT} >> ${Exe_Output}
+	date >> ${Exe_Output}
+    else
+	echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} simulated for DRYRUN = " $DRYRUN
+	echo "FOR EXECUTION DRYRUN mode = " $DRYRUN >> stack
+    fi
+    echo "========================================================================"
+
+    echo
+    echo "#######################################"
+    echo "#       DIR AFTER RUN EXECUTION       #"
+    echo "#######################################"
+    echo
+    ls -lrt
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Desactivate running environnement variables
+    # ------------------------------------------------------------------
+    IGCM_sys_desactiv_variables
+
+    #D-
+    #D----------------------------------------------------------------==
+    #D-                    4. Post execution operations
+    #D----------------------------------------------------------------==
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Save on archive machine netcdf outputs, restarts
+    #D- and text files of models
+    # ------------------------------------------------------------------
+    IGCM_comp_Finalize
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Test if all was right after Finalize
+    # ------------------------------------------------------------------
+    IGCM_debug_Verif_Exit
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Launch post-treatment process if necessary
+    # ------------------------------------------------------------------
+    IGCM_post_Initialize
+
+    #D-
+    # ------------------------------------------------------------------
+    #D- Save job output
+    #D- Manage executable size to save only different binary
+    #D- Write in run.card user, system and elapse time
+    #D- Check that everything went well ! No ? then we stop.
+    #D- Determine next computed period 
+    # ------------------------------------------------------------------
+    IGCM_config_PeriodEnd
+
+    echo "Ending iteration ${Period}"
+    (( Period = Period + 1 ))
+
+    # End loop if date end is reached
+    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
+	break ;
+    fi
+
+done 
+
+#D-
+#D--------------------------------------------------------------------==
+#D-     5. Submit next job or send mail if simulation over.
+#D--------------------------------------------------------------------==
+IGCM_config_Finalize
+
+date
Index: /tags/libIGCM_v1_1/AA_monitoring
===================================================================
--- /tags/libIGCM_v1_1/AA_monitoring	(revision 19)
+++ /tags/libIGCM_v1_1/AA_monitoring	(revision 19)
@@ -0,0 +1,107 @@
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J MONITORING             # Nom du job
+#-Q- platine #BSUB -N                        # message a la fin du job
+#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
+#-Q- platine #BSUB -W 1:00                   # Limite temps
+#-Q- platine #BSUB -q post              # Passage en queue post
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie #QSUB -r MONITORING           # Nom du job
+#-Q- sx8brodie #QSUB -lT 1:00:00             # limite en temps total
+#-Q- sx8brodie #QSUB -eo                     # rassemble standard error et output
+#-Q- sx8brodie #QSUB -J m
+#-Q- sx8brodie #QSUB -l mpp_p=4
+#-Q- sx8brodie #QSUB -s /bin/ksh             # shell du job
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N  MONITORING          # Nom du job
+#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
+#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
+#-Q- sx8mercure #PBS -l memsz_job=1gb        # Limite memoire a 1 Go
+#-Q- sx8mercure #PBS -l cputim_job=1:00:00   # Limite temps a 2 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+
+######################################################################
+
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     ; #IGCM_debug_Check
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   ; #IGCM_card_Check
+
+######################################################################
+
+#set -vx 
+
+#===========================================
+cd ${RUN_DIR_PATH}
+
+if [ ${StandAlone} = true ] ; then
+    CARD_DIR=${SUBMIT_DIR}
+else
+    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
+    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
+fi
+
+#
+# First of all
+#
+IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
+typeset option
+for option in ${config_UserChoices[*]} ; do
+    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
+done
+IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card ListOfComponents
+
+R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+
+#
+IGCM_sys_Get_Dir ${R_SAVE}/MONITORING ${RUN_DIR_PATH}
+
+# --------------------------------------------
+# Insert your commands between III...III lines 
+# and precise produced directories to save
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+for comp in ${config_ListOfComponents[*]} ; do
+    liste_file_monitoring=""
+    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
+    eval compname=\${config_ListOfComponents_${comp}[0]}                > /dev/null 2>&1
+    eval monitoring_file=monitoring01_${compname}_\${RESOL_${comp}}.cfg > /dev/null 2>&1
+    #
+    [ -f ${FER_ATLAS}/${monitoring_file} ] && liste_file_monitoring=$( monitoring01 -q -l2 ${FER_ATLAS}/${monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_MO )
+    #
+    if [ ! "X${liste_file_monitoring}" = X ] ; then
+	IGCM_sys_Get /l liste_file_monitoring ${RUN_DIR_PATH}
+	monitoring01 -q -p ${comp} -t "${config_UserChoices_JobName} monitoring" -o ${RUN_DIR_PATH}/MONITORING ${FER_ATLAS}/${monitoring_file} ${RUN_DIR_PATH}
+    fi
+    #
+done
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Save files
+IGCM_sys_Put_Dir MONITORING ${R_SAVE}
+
+# Dods copy
+IGCM_sys_Put_Dods MONITORING
+
+exit
Index: /tags/libIGCM_v1_1/libIGCM_CeCILL.LIC
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_CeCILL.LIC	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_CeCILL.LIC	(revision 19)
@@ -0,0 +1,40 @@
+The following licence information concerns ONLY the libIGCM tools
+==================================================================
+
+Copyright © Centre National de la Recherche Scientifique CNRS  
+            Commissariat à l'Énergie Atomique CEA
+
+libIGCM : Library for Portable Models Computation of IGCM Group.
+
+IGCM Group is the french IPSL Global Climate Model Group.
+
+This library is a set of shell scripts and functions whose purpose is
+the management of the initialization, the launch, the transfer of
+output files, the post-processing and the monitoring of datas produce
+by any numerical program on any plateforme.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
Index: /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_PrintOption.awk
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_PrintOption.awk	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_PrintOption.awk	(revision 19)
@@ -0,0 +1,141 @@
+#!/usr/bin/awk -f
+
+#**************************************************************
+# Author: Patrick Brockmann
+# Contact: Patrick.Brockmann@cea.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#==========================
+function myprint(str) {
+	if (debug) {
+		print str
+	}
+}
+
+#==========================
+BEGIN {
+
+nbarg=ARGC
+if (match(ARGV[1],"-d")) {
+        debug=1
+        file=ARGV[2]
+        section=ARGV[3]
+        option=ARGV[4]
+        delete ARGV[1] ; delete ARGV[3] ; delete ARGV[4]
+	nbarg--
+} else {
+        debug=0
+        file=ARGV[1]
+        section=ARGV[2]
+        option=ARGV[3]
+        delete ARGV[2] ; delete ARGV[3]
+}
+
+# When exit statement, 'END' rule is always executed, so defined a exit_value to manage this
+exit_value=0
+if (nbarg != 4) {
+	print "Usage: IGCM_card_PrintOption [-d] file section option" 
+	print 
+	print "Args:"
+	print "      file = file at CARD format" 
+	print "      section = section to find" 
+	print "      option = option to find" 
+	print 
+	print "Options:" 
+	print "       -d = debug mode" 
+	print 
+	exit_value=1
+	exit
+}
+
+section_found=0
+option_found=0
+
+}
+
+#==========================
+{
+
+myprint($0) 
+
+# Do not consider commented lines (#...)
+if (! match($0,/^#/)) {
+
+# Find section with delimiters '[' and ']'
+if (match($0, "\\[" section "\\]")) {
+
+	myprint("---->section found")
+	section_found=1
+
+} else if (section_found == 1 && (match($0, option "[ ]*="))) {
+
+	myprint("---->option found")
+	option_found=1
+	
+	# Extract string after '='
+	option_value=substr($0, index($0, "=")+1)
+
+	# Remove space after '='
+	gsub(/^[ ]*/, "", option_value)
+
+	# If continuation character '\' get next lines
+	if (match($0,/\\$/)) {
+		tmp=$0
+		tmp=substr(tmp, 1, length(tmp)-1)
+		gsub(/[ \t]*/, "", tmp)
+		option_value=tmp
+		getline tmp
+		while (match(tmp,/\\$/)) {
+			tmp=substr(tmp, 1, length(tmp)-1)
+			gsub(/[ \t]*/, "", tmp)
+			option_value=option_value " " tmp
+			getline tmp 
+			}
+		gsub(/[ \t]*/, "", tmp)
+		option_value=option_value " " tmp
+	}
+
+	exit
+
+} else if (section_found == 1 && match($0, /^[\[*\]]/)) {
+
+	myprint("---->end section")
+	exit
+
+}
+
+}
+
+}
+
+#==========================
+END {
+
+if (! exit_value ) {
+
+myprint("###############################")
+myprint("section      ====> " section)
+myprint("option       ====> " option)
+myprint("value        ====> " option_value)
+
+if (section_found == 0) {
+	print "Error: Section not found"
+} else if (option_found == 0) {
+	print "Error: Option not found"
+} else {
+	print option_value
+}
+
+}
+
+}
+ 
+#==========================
Index: /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_PrintSection.awk
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_PrintSection.awk	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_PrintSection.awk	(revision 19)
@@ -0,0 +1,124 @@
+#!/usr/bin/awk -f
+
+#**************************************************************
+# Author: Patrick Brockmann
+# Contact: Patrick.Brockmann@cea.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#==========================
+function myprint(str) {
+	if (debug) {
+		print str
+	}
+}
+
+#==========================
+BEGIN {
+
+nbarg=ARGC
+if (match(ARGV[1],"-d")) {
+        debug=1
+        file=ARGV[2]
+        section=ARGV[3]
+        delete ARGV[1] ; delete ARGV[3]
+	nbarg--
+} else {
+        debug=0
+        file=ARGV[1]
+        section=ARGV[2]
+        delete ARGV[2]
+}
+
+# When exit statement, 'END' rule is always executed, so defined a exit_value to manage this
+exit_value=0
+if (nbarg != 3) {
+	print "Usage: IGCM_card_PrintSection [-d] file section" 
+	print 
+	print "Args:"
+	print "      file = file at CARD format" 
+	print "      section = section to find" 
+	print 
+	print "Options:" 
+	print "       -d = debug mode" 
+	print 
+	exit_value=1
+	exit
+}
+
+section_found=0
+option_list="null"
+
+}
+
+#==========================
+{
+
+myprint($0) 
+
+# Do not consider commented lines (#...)
+if (! match($0,/^#/)) {
+
+# Find section with delimiters '[' and ']'
+if (match($0, "\\[" section "\\]")) {
+
+	myprint("---->section found")
+	section_found=1
+
+} else if (section_found == 1 && (match($0, "[.]*="))) {
+
+	myprint("---->option found")
+
+	# Extract string after '='
+	option_value=substr($0, 1, index($0, "=")-1)
+
+	# Remove space before '='
+	gsub(/[ ]*/, "", option_value)
+
+	# Add options
+	# If 1st option
+	if (match(option_list,"null")) {
+		option_list=option_value
+	} else {
+		option_list=option_list " " option_value
+	}
+
+} else if (section_found == 1 && match($0, /^[\[*\]]/)) {
+
+	myprint("---->end section")
+	exit
+
+}
+
+}
+
+}
+
+#==========================
+END {
+
+if (! exit_value ) {
+
+myprint("###############################")
+myprint("section      ====> " section)
+
+if (section_found == 0) {
+	print "Error: Section not found"
+} else if (match(option_list,"null")) {
+	print "Error: Options not found"
+} else {
+	print option_list
+}
+
+}
+
+}
+ 
+#==========================
Index: /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_Test.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_Test.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_Test.ksh	(revision 19)
@@ -0,0 +1,85 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Patrick Brockmann
+# Contact: Patrick.Brockmann@cea.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+# This script is used to generate a reference file with command :
+# IGCM_card_Test.ksh > IGCM_card_Test.ref 2>&1  
+# The reference file produced is used by the function IGCM_card_Check
+# to verify that the libIGCM_card produce the same results
+
+#=================================================
+libIGCM=`dirname $0`/..
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+
+#=================================================
+cat ${libIGCM}/libIGCM_card/TestFile.card
+
+#=================================================
+# function IGCM_card_PrintOption
+
+IGCM_card_PrintOption ${libIGCM}/libIGCM_card/TestFile.card Messages Option1
+IGCM_card_PrintOption ${libIGCM}/libIGCM_card/TestFile.card Messages Option2
+IGCM_card_PrintOption ${libIGCM}/libIGCM_card/TestFile.card ColorValues Red
+IGCM_card_PrintOption ${libIGCM}/libIGCM_card/TestFile.card ColorValues Blue
+IGCM_card_PrintOption ${libIGCM}/libIGCM_card/TestFile.card ColorValues Green 
+
+#=================================================
+# function IGCM_card_PrintSection
+
+IGCM_card_PrintSection ${libIGCM}/libIGCM_card/TestFile.card Recipes
+IGCM_card_PrintSection ${libIGCM}/libIGCM_card/TestFile.card Couples
+
+#==================================================
+# function IGCM_card_DefineVariableFromOption
+
+IGCM_card_DefineVariableFromOption ${libIGCM}/libIGCM_card/TestFile.card Messages Option2
+echo ${TestFile_Messages_Option2}
+IGCM_card_DefineVariableFromOption ${libIGCM}/libIGCM_card/TestFile.card ColorValues Red
+echo ${TestFile_ColorValues_Red}
+
+#==================================================
+# function IGCM_card_DefineArrayFromOption
+
+IGCM_card_DefineArrayFromOption ${libIGCM}/libIGCM_card/TestFile.card Couples List1
+echo ${TestFile_Couples_List1[*]}
+IGCM_card_DefineArrayFromOption ${libIGCM}/libIGCM_card/TestFile.card Couples List2
+echo ${TestFile_Couples_List2[*]}
+
+#=================================================
+# function IGCM_card_DefineArrayFromSection
+
+IGCM_card_DefineArrayFromSection ${libIGCM}/libIGCM_card/TestFile.card ColorValues
+echo ${TestFile_ColorValues[*]}
+
+#==================================================
+# function IGCM_card_WriteOption
+
+#-------------------------
+cp ${libIGCM}/libIGCM_card/TestFile.card NewTestFile.card
+IGCM_card_WriteOption NewTestFile.card Messages Option2 '"Hello Mercure"'
+
+IGCM_card_WriteOption NewTestFile.card Messages ListVal1 '( 1, 2, 3 )'
+listname="(Sebastien, Martial, Patrick)"
+IGCM_card_WriteOption NewTestFile.card Messages ListVal2 "${listname}"
+
+set -A tableau one, two, three, four
+echo ${tableau[*]}
+IGCM_card_WriteOption NewTestFile.card Messages ListVal3 "( ${tableau[*]} )"
+
+IGCM_card_WriteOption NewTestFile.card ColorValues Red 888
+
+diff ${libIGCM}/libIGCM_card/TestFile.card NewTestFile.card
+rm -f NewTestFile.card
+
Index: /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_Test.ref
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_Test.ref	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_Test.ref	(revision 19)
@@ -0,0 +1,53 @@
+
+[Messages]
+Option1= "Hello Earth"
+Option2= "Hello Mars"
+ListVal1= ()
+ListVal2= ()
+ListVal3= ()
+
+# My comments
+[Recipes]
+Cake= "file1.doc"
+Starter= "file2.doc"
+
+[ColorValues]
+Red= 120
+Blue= 230
+Green= 178
+AnotherRed= 234
+
+[Couples]
+List1=   (up, down), \
+         (humid, dry), \
+         (hot, cold), \
+         (far, close)
+List2=   (ice, fire, air, water)
+
+"Hello Earth"
+"Hello Mars"
+120
+230
+178
+Cake Starter
+List1 List2
+Hello Mars
+120
+up down humid dry hot cold far close
+ice fire air water
+Red Blue Green AnotherRed
+one, two, three, four
+4,7c4,7
+< Option2= "Hello Mars"
+< ListVal1= ()
+< ListVal2= ()
+< ListVal3= ()
+---
+> Option2= "Hello Mercure"
+> ListVal1= ( 1, 2, 3 )
+> ListVal2= (Sebastien, Martial, Patrick)
+> ListVal3= ( one, two, three, four )
+15c15
+< Red= 120
+---
+> Red= 888
Index: /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_WriteOption.awk
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_WriteOption.awk	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_card/IGCM_card_WriteOption.awk	(revision 19)
@@ -0,0 +1,121 @@
+#!/usr/bin/awk -f
+
+#**************************************************************
+# Author: Patrick Brockmann
+# Contact: Patrick.Brockmann@cea.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#==========================
+function myprint(str) {
+	if (debug) {
+		print str
+	}
+}
+
+#==========================
+BEGIN {
+
+nbarg=ARGC
+if (match(ARGV[1],"-d")) {
+        debug=1
+        file=ARGV[2]
+        section=ARGV[3]
+        option=ARGV[4]
+        value=ARGV[5]
+        delete ARGV[1] ; delete ARGV[3] ; delete ARGV[4] ; delete ARGV[5]
+	nbarg--
+} else {
+        debug=0
+        file=ARGV[1]
+        section=ARGV[2]
+        option=ARGV[3]
+        value=ARGV[4]
+        delete ARGV[2] ; delete ARGV[3] ; delete ARGV[4]
+}
+
+
+# When exit statement, 'END' rule is always executed, so defined a exit_value to manage this
+exit_value=0
+if (nbarg != 5) {
+	print "Usage: IGCM_card_WriteOption [-d] file section option value"
+	print 
+	print "Args:"
+	print "      file = file at CARD format" 
+	print "      section = section to find" 
+	print "      option = option to find" 
+	print "      value = value option to write" 
+	print 
+	print "Options:" 
+	print "       -d = debug mode" 
+	print
+	exit_value=1
+        exit
+}
+
+section_found=0
+section_inside=0
+option_found=0
+}
+
+#==========================
+{
+
+myprint($0) 
+
+# Find section with delimiters '[' and ']'
+if (match($0, "\\[" section "\\]")) {
+
+	myprint("---->section found")
+	section_found=1
+	section_inside=1
+	print $0
+
+} else if (section_inside == 1 && (match($0, "^[ ]*" option "[ ]*="))) {
+
+	myprint("---->option found")
+	option_found=1
+
+	print option "= " value
+	myprint("---->new value ")
+
+} else if (section_inside == 1 && match($0, /^[\[*\]]/)) {
+
+	myprint("---->end section")
+	section_inside=0
+	print $0
+
+} else {
+	print $0
+}
+
+}
+
+#==========================
+END {
+
+if (! exit_value ) {
+
+myprint("###############################")
+myprint("section      ====> " section)
+myprint("option       ====> " option)
+myprint("value        ====> " value)
+
+if (section_found == 0) {
+	print "Error: Section not found"
+} else if (option_found == 0) {
+	print "Error: Option not found"
+}	
+
+}
+
+}
+ 
+#==========================
Index: /tags/libIGCM_v1_1/libIGCM_card/TestFile.card
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_card/TestFile.card	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_card/TestFile.card	(revision 19)
@@ -0,0 +1,26 @@
+
+[Messages]
+Option1= "Hello Earth"
+Option2= "Hello Mars"
+ListVal1= ()
+ListVal2= ()
+ListVal3= ()
+
+# My comments
+[Recipes]
+Cake= "file1.doc"
+Starter= "file2.doc"
+
+[ColorValues]
+Red= 120
+Blue= 230
+Green= 178
+AnotherRed= 234
+
+[Couples]
+List1=   (up, down), \
+         (humid, dry), \
+         (hot, cold), \
+         (far, close)
+List2=   (ice, fire, air, water)
+
Index: /tags/libIGCM_v1_1/libIGCM_card/libIGCM_card.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_card/libIGCM_card.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_card/libIGCM_card.ksh	(revision 19)
@@ -0,0 +1,234 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Patrick Brockmann
+# Contact: Patrick.Brockmann@cea.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#==================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#==================================================
+ 
+#D-#==================================================================
+#D-libIGCM_card
+#D-This ksh library handles extraction of information from configuration file
+#D-called "card" file (en français fichier "carte").
+#D-All function described bellow must be prefixed by IGCM_card.
+#D-A card file is organized as follows :
+#D- ---------------------
+#D-[Messages]
+#D-Option1= "Hello Earth"
+#D-Option2= "Hello Mars"
+#D-
+#D-# My comments 
+#D-[Recipes]
+#D-Cake= "file1.doc" 
+#D-Starter= "file2.doc" 
+#D-
+#D-[ColorValues]
+#D-Red= 120
+#D-Blue= 230 
+#D-Green= 178 
+#D-
+#D-[Couples]
+#D-List1=   (up, down), \
+#D-         (humid, dry), \
+#D-         (hot, cold), \
+#D-         (far, close)
+#D-List2=   (ice, fire, air, water)
+#D- ---------------------
+#D-
+
+#D-#==================================================================
+#D-function IGCM_card_PrintOption
+#D-* Purpose: Print an option from a given file.card and section
+#D-* Usage: IGCM_card_PrintOption file.card section option
+#D-
+function IGCM_card_PrintOption
+{
+    IGCM_debug_PushStack "IGCM_card_PrintOption" $@
+    if [ -r "$1" ] ; then
+	awk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintOption.awk "$@"
+    else
+        echo "--Error--> IGCM_card_PrintOption $@"
+        echo "           $1 is not readable"
+	IGCM_debug_Exit "IGCM_card_PrintOption"
+    fi
+    IGCM_debug_PopStack "IGCM_card_PrintOption"
+}
+
+#D-#==================================================================
+#D-function IGCM_card_PrintSection
+#D-* Purpose: Print all options from a given file.card and section
+#D-* Usage: IGCM_card_PrintSection file.card section
+#D-
+function IGCM_card_PrintSection
+{
+    IGCM_debug_PushStack "IGCM_card_PrintSection" $@
+    if [ -r "$1" ] ; then
+	awk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintSection.awk -- "$@"
+    else
+        echo "--Error--> IGCM_card_PrintSection $@"
+        echo "           $1 is not readable"
+	IGCM_debug_Exit "IGCM_card_PrintSection"
+    fi
+    IGCM_debug_PopStack "IGCM_card_PrintSection"
+}
+
+#D-#==================================================================
+#D-function IGCM_card_DefineVariableFromOption
+#D-* Purpose: Define a variable from a given file.card, section and option
+#D-*          Variable name is automatically defined as file_section_option
+#D-* Usage: IGCM_card_DefineVariableFromOption file.card section option
+#D-
+function IGCM_card_DefineVariableFromOption
+{
+    IGCM_debug_PushStack "IGCM_card_DefineVariableFromOption" $@
+    if [ -r "$1" ] ; then
+	# Get basename of card file ($1)
+	typeset name1=${1##*/}
+	# Build name of variable as $1_$2_$3 (cardname_Section_Option)
+	typeset name=${name1%%.*}_${2}_${3}
+	typeset value=$( awk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintOption.awk -- "$@" )
+
+	if [ "${value}" = "Error: Option not found" ] ; then
+	    echo "Error with readding of ${name} variable in ${1} ."
+	    echo "Error: Option not found."
+	    IGCM_debug_Exit
+	    IGCM_debug_Verif_Exit
+	fi
+	eval ${name}=${value}
+    else
+        echo "--Error--> IGCM_card_DefineVariableFromOption $@"
+        echo "           $1 is not readable"
+	IGCM_debug_Exit "IGCM_card_DefineVariableFromOption"
+    fi
+    IGCM_debug_PopStack "IGCM_card_DefineVariableFromOption"
+}
+
+#D-#==================================================================
+#D-function IGCM_card_DefineArrayFromOption
+#D-* Purpose: Define an array variable from a given file.card, section and option
+#D-*          Array variable is automatically defined as file_section_option
+#D-* Usage: IGCM_card_DefineArrayFromOption file.card section option
+#D-
+function IGCM_card_DefineArrayFromOption
+{
+    IGCM_debug_PushStack "IGCM_card_DefineArrayFromOption" $@
+    if [ -r "$1" ] ; then
+	# Get basename of card file ($1)
+	typeset name1=${1##*/}
+	# Build name of array as $1_$2_$3 (cardname_Section_Option)
+	typeset name=${name1%%.*}_${2}_${3}
+	set -A ${name} -- ${NULL_STR}
+	set +A ${name} -- $( awk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintOption.awk -- "$@" | awk -- 'BEGIN {FS="[() ,]+"} {for (i=2; i <= NF-1; i++) printf("%s ",$i)}' )
+    else
+        echo "--Error--> IGCM_card_DefineArrayFromOption $@"
+        echo "           $1 is not readable"
+	IGCM_debug_Exit "IGCM_card_DefineArrayFromOption"
+    fi
+    IGCM_debug_PopStack "IGCM_card_DefineArrayFromOption"
+}
+
+#D-#==================================================================
+#D-function IGCM_card_DefineArrayFromSection
+#D-* Purpose: Define an array variable from a given file.card and section
+#D-*          Array variable is automatically defined as file_section
+#D-* Usage: IGCM_card_DefineArrayFromSection file.card section
+#D-
+function IGCM_card_DefineArrayFromSection
+{
+    IGCM_debug_PushStack "IGCM_card_DefineArrayFromSection" $@
+    if [ -r "$1" ] ; then
+	# Get basename of card file ($1)
+	typeset name1=${1##*/}
+	# Build name of array as $1_$2 (cardname_Section)
+	typeset name=${name1%%.*}_${2}
+	set -A ${name} -- ${NULL_STR}
+	set +A ${name} -- $( awk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintSection.awk -- "$@" )
+    else
+        echo "--Error--> IGCM_card_DefineArrayFromSection $@"
+        echo "           $1 is not readable"
+	IGCM_debug_Exit "IGCM_card_DefineArrayFromSection"
+    fi
+    IGCM_debug_PopStack "IGCM_card_DefineArrayFromSection"
+}
+
+#D-#==================================================================
+#D-function IGCM_card_WriteOption
+#D-* Purpose: Write an option from a given file.card and section
+#D-* Usage: IGCM_card_WriteOption file.card section newvalue
+#D-* Examples: IGCM_card_WriteOption file.card Recipes Red 150
+#D-            IGCM_card_WriteOption file.card Messages Option2 '"Hello Mercure"'
+#D-            IGCM_card_WriteOption file.card Messages ListVal1 '( 1, 2, 3 )'
+#D-            listname="(Sebastien, Martial, Patrick)"
+#D-            IGCM_card_WriteOption NewTestFile.card Messages ListVal2 "${listname}"
+#D-
+function IGCM_card_WriteOption
+{
+    IGCM_debug_PushStack "IGCM_card_WriteOption" $@
+    if [ -r "$1" ] && [ -w "$1" ] ; then
+	typeset tmpfile=tmpfile_$$
+	( awk -f ${libIGCM}/libIGCM_card/IGCM_card_WriteOption.awk -- "$@" 2> /dev/null ) > ${tmpfile}
+	mv ${tmpfile} $1
+    else
+        echo "--Error--> IGCM_card_WriteOption $@"
+        echo "           $1 is not readable or not writable"
+	IGCM_debug_Exit "IGCM_card_WriteOption"
+    fi
+    IGCM_debug_PopStack "IGCM_card_WriteOption"
+}
+
+#D-#==================================================================
+#D-function IGCM_card_Check
+#D-* Purpose: Check the present file by comparison with a reference file
+#D-* Usage: IGCM_card_Check
+#D-
+function IGCM_card_Check
+{
+    IGCM_debug_PushStack "IGCM_card_Check" 
+#---------------------
+    if [ ! -n "${libIGCM}" ] ; then
+	echo "Check libIGCM_card ...........................................[ FAILED ]"
+        echo "--Error--> libIGCM variable is not defined"
+	IGCM_debug_Exit "IGCM_card_Check"
+    fi
+
+#---------------------
+    whence -v awk > /dev/null 2>&1
+    if [ ! $? -eq 0 ] ; then
+	echo "Check libIGCM_card ...........................................[ FAILED ]"
+        echo "--Error--> awk command is not defined"
+	IGCM_debug_Exit "IGCM_card_Check"
+    fi
+
+#---------------------
+    ${libIGCM}/libIGCM_card/IGCM_card_Test.ksh > IGCM_card_Test.ref.failed 2>&1
+    sleep 2
+
+    if diff IGCM_card_Test.ref.failed ${libIGCM}/libIGCM_card/IGCM_card_Test.ref > /dev/null 2>&1 ; then 
+	echo "Check libIGCM_card ...............................................[ OK ]"
+	rm -f IGCM_card_Test.ref.failed
+    else 
+	echo "Check libIGCM_card ...........................................[ FAILED ]"
+        echo "--Error--> Execution of ${libIGCM}/libIGCM_card/IGCM_card_Test.ksh"
+        echo "           has produced the file IGCM_card_Test.ref.failed"
+        echo "           Please analyse differences with the reference file by typing:"
+        echo "           diff IGCM_card_Test.ref.failed ${libIGCM}/libIGCM_card/IGCM_card_Test.ref"
+	echo "           Report errors to the author: Patrick.Brockmann@cea.fr"
+	IGCM_debug_Exit "IGCM_card_Check"
+    fi
+
+#---------------------
+    IGCM_debug_PopStack "IGCM_card_Check" 
+}
Index: /tags/libIGCM_v1_1/libIGCM_comp/libIGCM_comp.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_comp/libIGCM_comp.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_comp/libIGCM_comp.ksh	(revision 19)
@@ -0,0 +1,650 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip
+# Contact: Sebastien.Denvil@ipsl.jussieu.fr Martial.Mancip@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#========================================================================
+function IGCM_comp_Initialize
+{
+    IGCM_debug_PushStack "IGCM_comp_Initialize"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_Initialize :"
+    echo
+
+    typeset comp compname comptagname CompatibilityTag auxprint card_UserChoices first_option
+    for comp in ${config_ListOfComponents[*]} ; do
+        # Debug Print
+	IGCM_debug_Print 1 ${comp}
+	# Define component 
+        IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp}
+	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+	# Read libIGCM compatibility version in ${compname}.card
+	card=${SUBMIT_DIR}/COMP/${compname}.card
+	IGCM_card_DefineVariableFromOption ${card} Compatibility libIGCM
+	eval CompatibilityTag=\${${compname}_Compatibility_libIGCM} > /dev/null 2>&1	
+
+	if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then
+	    IGCM_debug_Exit "${compname}.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ."
+	fi
+
+	# Manage component executable
+	IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card Executable ${comp}
+
+	# Read component Write Frequency in config.card
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} WriteFrequency
+	# Debug Print :
+	eval auxprint=\${config_${comp}_WriteFrequency}
+	IGCM_debug_Print 1 "Write frequency for ${compname} : ${auxprint} "
+        #2> /dev/null
+
+	# Debug Print :
+	IGCM_debug_Print 1 "Initialize following component library :"
+	IGCM_debug_Print 1 ${SUBMIT_DIR}/COMP/${compname}.driver
+	IGCM_debug_Print 3 "With tag : ${comptagname}"
+	# Source component library
+	. ${SUBMIT_DIR}/COMP/${compname}.driver
+
+	# Debug Print
+	IGCM_debug_Print 3 "Initialize ${comp} output directory."
+	# Define Dirs	
+	eval R_OUT_${comp}=${R_SAVE}/${comp}
+	eval IGCM_sys_MkdirArchive \${R_OUT_${comp}}
+
+	eval R_OUT_${comp}_O=\${R_OUT_${comp}}/Output
+	eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_O}
+
+	eval R_OUT_${comp}_R=\${R_OUT_${comp}}/Restart
+	eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_R}
+
+	eval R_OUT_${comp}_D=\${R_OUT_${comp}}/Debug
+	eval IGCM_sys_MkdirArchive \${R_OUT_${comp}_D}
+
+ 	eval R_OUT_${comp}_O_I=\${R_OUT_${comp}_O}/INS
+ 	eval R_OUT_${comp}_O_H=\${R_OUT_${comp}_O}/HF
+ 	eval R_OUT_${comp}_O_D=\${R_OUT_${comp}_O}/DA
+ 	eval R_OUT_${comp}_O_M=\${R_OUT_${comp}_O}/MO
+	eval R_OUT_${comp}_O_Y=\${R_OUT_${comp}_O}/YE
+
+
+	# Read UserChoices section of component card
+	IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_UserChoices ${card}"
+	IGCM_card_DefineArrayFromSection ${card} UserChoices
+	eval first_option=\${${compname}_UserChoices[0]} > /dev/null 2>&1
+	if [ X${first_option} != X"Error:" ] ; then
+	    eval IGCM_debug_Print 2 "${compname}_UserChoices_Options:" \${${compname}_UserChoices[*]}
+	    if [ X${card_UserChoices[0]} != X ] ; then
+		unset card_UserChoices
+	    fi
+	    eval set +A card_UserChoices -- \${${compname}_UserChoices[*]} > /dev/null 2>&1
+	    typeset option
+	    for option in ${card_UserChoices[*]} ; do
+		IGCM_card_DefineVariableFromOption ${card} UserChoices ${option}
+		eval IGCM_debug_Print 3 "${compname}_UserChoices_values: ${card_UserChoices[*]}"
+	    done
+	fi
+
+	# Debug Print
+	IGCM_debug_Print 3 "Initialize ${compname} with driver."
+	# INIT component
+	${comp}_Initialize
+	echo
+    done
+    echo "-----"
+
+    echo
+    IGCM_debug_Print 1 "DefineArrayFromOption  : ListOfComponents"
+    IGCM_debug_PrintVariables 3 config_ListOfComponents
+
+    IGCM_debug_PopStack "IGCM_comp_Initialize"
+}
+
+#=======================================================================
+function IGCM_comp_PrepareDeletedFiles
+{
+    IGCM_debug_PushStack "IGCM_comp_PrepareDeletedFiles" $@
+    
+    if [ X${2} != X. ] ; then
+	eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${2} ) > /dev/null 2>&1
+    else
+	eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( basename ${1} ) > /dev/null 2>&1
+    fi
+
+    IGCM_debug_PopStack "IGCM_comp_PrepareDeletedFiles"
+}
+
+#=======================================================================
+function IGCM_comp_GetInputInitialStateFiles
+{
+    IGCM_debug_PushStack "IGCM_comp_GetInputInitialStateFiles"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_GetInputInitialStateFiles :"
+    echo
+
+    # Only the first time step need InitialStateFiles 
+    # otherwise it's BoundaryConditions
+    if ( ${FirstInitialize} ) ; then
+      typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
+      typeset file_in_ file_in file_out_ file_out do_init 
+      for comp in ${config_ListOfComponents[*]} ; do
+	  # Initialize
+	  do_init="y"
+	  # Do we need to bring initial state file for this component
+	  if [ "${config_Restarts_OverRule}" = "y" ] ; then
+	      eval do_init="n"
+	  else
+	      # Read component Restarts parameters
+	      IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
+	      eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
+	      if [ "${do_start}" = "y" ] ; then
+		    do_init="n"
+	      else
+		    do_init="y"
+	      fi
+	  fi
+
+	  if [ "${do_init}" = "y" ] ; then
+	      # Define component 
+	      eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+	      eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+	      # Debug Print :
+	      IGCM_debug_Print 3 "Initialisation files ${compname}"
+
+	      card=${SUBMIT_DIR}/COMP/${compname}.card
+
+	      IGCM_card_DefineArrayFromOption ${card} InitialStateFiles List
+	      ListFilesName=${compname}_InitialStateFiles_List
+
+	      eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+	      if [ X${FileName0} != X${NULL_STR} ] ; then
+		  eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+		  (( i=0 ))
+		  until [ $i -ge $NbFiles ]; do
+		      eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+		      eval file_in=${file_in_}
+		      (( i_ = i+1 ))
+		      eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		      eval file_out=${file_out_}
+		      
+		      IGCM_sys_Get ${file_in} ${file_out}
+
+		      IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+
+		      (( i=i+2 ))
+		  done
+	      fi
+	  fi
+      done
+    fi
+    IGCM_debug_PopStack "IGCM_comp_GetInputInitialStateFiles"
+}
+
+#=======================================================================
+function IGCM_comp_GetInputBoundaryFiles
+{
+    IGCM_debug_PushStack "IGCM_comp_GetInputBoundaryFiles"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_GetInputBoundaryFiles :"
+    echo
+
+    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
+    typeset file_in_ file_in file_out_ file_out 
+
+    if [ ${Period} = 1 ]; then
+	ListFixBoundary=" "
+    fi
+
+    for comp in ${config_ListOfComponents[*]} ; do
+
+	echo "-----"
+	# Define component
+	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+        # Debug Print :
+	IGCM_debug_Print 3 "Boundary files ${compname}"
+
+	card=${SUBMIT_DIR}/COMP/${compname}.card
+
+	IGCM_card_DefineArrayFromOption ${card} BoundaryFiles List
+	ListFilesName=${compname}_BoundaryFiles_List
+ 	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+	if [ X${FileName0} != X${NULL_STR} ] ; then
+	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+	    (( i=0 ))
+	    until [ $i -ge $NbFiles ]; do
+		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+		eval file_in=${file_in_}
+		(( i_ = i+1 ))
+		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		eval file_out=${file_out_}
+
+		IGCM_sys_Get ${file_in} ${file_out}
+
+		IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+
+		(( i=i+2 ))
+	    done
+	fi
+
+	# Get non deleted files
+	if [ ${Period} = 1 ]; then
+
+	    IGCM_card_DefineArrayFromOption ${card} BoundaryFiles ListNonDel
+	    ListFilesName=${compname}_BoundaryFiles_ListNonDel
+	    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+	    
+	    if [ X${FileName0} != X${NULL_STR} ] ; then
+		eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+		
+		(( i=0 ))
+		until [ $i -ge $NbFiles ]; do
+		    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+		    eval file_in=${file_in_}
+		    (( i_ = i+1 ))
+		    eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		    eval file_out=${file_out_}
+
+		    IGCM_sys_Get ${file_in} ${file_out}
+
+		    if [ X${file_out} != X. ] ; then
+			ListFixBoundary=${ListFixBoundary}" "${file_out}
+		    else
+			ListFixBoundary=${ListFixBoundary}" "$( basename ${file_in} )
+		    fi
+
+		    (( i=i+2 ))
+		done
+	    fi
+	fi
+    done
+    
+    IGCM_debug_PopStack "IGCM_comp_GetInputBoundaryFiles"
+}
+
+#=======================================================================
+function IGCM_comp_DelFixeBoundaryFiles
+{
+    IGCM_debug_PushStack "IGCM_comp_DelFixeBoundaryFiles"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_DelFixeBoundaryFiles :"
+    echo
+
+    ls -l ${ListFixBoundary}
+    rm -f ${ListFixBoundary}
+
+    IGCM_debug_PopStack "IGCM_comp_DelFixeBoundaryFiles"
+}
+
+#=======================================================================
+function IGCM_comp_GetInputParametersFiles
+{
+    IGCM_debug_PushStack "IGCM_comp_GetInputParametersFiles"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_GetInputParametersFiles :"
+    echo
+
+    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ file_in file_out
+    for comp in ${config_ListOfComponents[*]} ; do
+	# Define component 
+	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+	# Debug Print :
+	IGCM_debug_Print 3 "Parameters ${compname}"
+
+	card=${SUBMIT_DIR}/COMP/${compname}.card	
+
+	IGCM_card_DefineArrayFromOption ${card} ParametersFiles List
+	ListFilesName=${compname}_ParametersFiles_List
+ 	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+	if [ X${FileName0} != X${NULL_STR} ] ; then
+	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+	    (( i=0 ))
+	    until [ $i -ge $NbFiles ]; do
+		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+		eval file_in=${file_in_}
+		(( i_ = i+1 ))
+		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		eval file_out=${file_out_} 
+
+		IGCM_sys_Cp ${file_in} ${file_out} 
+
+		IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+
+		(( i=i+2 ))
+	    done
+	fi
+    done
+
+    IGCM_debug_PopStack "IGCM_comp_GetInputParametersFiles"
+}
+
+#=======================================================================
+function IGCM_comp_GetInputRestartFiles
+{
+    IGCM_debug_PushStack "IGCM_comp_GetInputRestartFiles"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles :"
+    echo
+
+    typeset Date_tmp Date_r Path_r do_start CompOldName
+    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
+    typeset file_in file_out file_in_ file_out_ file_in_Name
+
+    for comp in ${config_ListOfComponents[*]} ; do
+	# Define component 
+	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+	# Debug Print :
+	IGCM_debug_Print 3 "restart ${compname}"
+
+	card=${SUBMIT_DIR}/COMP/${compname}.card	
+
+	if ( ${FirstInitialize} ) ; then
+
+	    if [ "${config_Restarts_OverRule}" = "y" ] ; then
+		eval config_${comp}_Restart="y"
+		eval config_${comp}_RestartDate=${config_Restarts_RestartDate}
+		eval config_${comp}_RestartJobName=${config_Restarts_RestartJobName}
+		eval config_${comp}_RestartPath=${config_Restarts_RestartPath}
+		eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
+		eval CompOldName=${comp}
+	    else
+	        # Read component Restarts parameters
+		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
+		eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
+
+		if [ "${do_start}" = "y" ] ; then
+		    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartDate
+		    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartJobName
+		    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} RestartPath
+		else
+		    eval config_${comp}_RestartDate=-1
+		    eval config_${comp}_RestartJobName=${NULL_STR}
+		    eval config_${comp}_RestartPath=${NULL_STR}
+		fi
+		IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} OldName
+		eval CompOldName=\${config_${comp}_OldName}
+		if [ X${CompOldName} = X ] ; then
+		    eval CompOldName=${comp}
+		fi
+	    fi
+
+	    if [ "${do_start}" = "y" ] ; then
+
+		IGCM_card_DefineArrayFromOption ${card} RestartFiles List
+		ListFilesName=${compname}_RestartFiles_List
+		eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+		
+		if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
+		    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+		    (( i=1 ))
+		    until [ $i -gt $NbFiles ]; do
+			eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+			eval file_in=${file_in_}
+
+			(( i_ = i+1 ))
+			eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+			eval file_out=${file_out_}
+			
+			eval Date_tmp=\${config_${comp}_RestartDate}
+			Date_r=$( IGCM_date_ConvertFormatToGregorian ${Date_tmp} )
+			eval Path_r=\${config_${comp}_RestartPath}/\${config_${comp}_RestartJobName}/${CompOldName}/Restart
+			eval file_in_Name=\${config_${comp}_RestartJobName}_${Date_r}_${file_in}
+
+			eval IGCM_sys_Get ${Path_r}/${file_in_Name} ${file_out} 
+
+			IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+		
+			(( i=i+3 ))
+		    done
+		else
+		    if [ X${FileName0} != XNONE ] ; then
+			IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}."
+		    else
+			IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}."
+		    fi
+		fi
+	    fi
+	else
+            # if not FirstInitialize
+
+	    # Restore Restarts files
+	    #-----------------------
+	    IGCM_card_DefineArrayFromOption ${card} RestartFiles List
+	    ListFilesName=${compname}_RestartFiles_List
+	    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+	    
+	    if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
+		eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+		(( i=1 ))
+		until [ $i -gt $NbFiles ]; do
+		    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+		    eval file_in=${file_in_}
+		    (( i_ = i+1 ))
+		    eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		    eval file_out=${file_out_}
+		    
+		    file_in_Name=${run_Configuration_OldPrefix}_${file_in}
+		    eval IGCM_sys_Get \${R_OUT_${comp}_R}/${file_in_Name} ${file_out}
+
+		    IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+
+		    (( i=i+3 ))
+		done
+	    else
+		if [ X${FileName0} != XNONE ] ; then
+		    IGCM_debug_Exit "IGCM_comp_GetInputRestartFiles : No file in list for ${compname}."
+		else
+		    IGCM_debug_Print 1 "IGCM_comp_GetInputRestartFiles : NONE specified in Restart List ${compname}."
+		fi
+	    fi
+	fi
+    done
+    IGCM_sys_Chmod -R u+rw .
+
+    IGCM_debug_PopStack "IGCM_comp_GetInputRestartFiles"
+}
+
+#=======================================================================
+function IGCM_comp_Update
+{
+    IGCM_debug_PushStack "IGCM_comp_Update"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_Update :"
+    echo
+
+    typeset ExeNameIn ExeNameOut 
+    typeset comp compname comptagname
+    for comp in ${config_ListOfComponents[*]} ; do
+	# Define component 
+	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+	# Copy executable for this component
+	eval ExeNameIn=\${config_Executable_${comp}[0]}
+	eval ExeNameOut=\${config_Executable_${comp}[1]}
+	if [ -f ${R_EXE}/${ExeNameIn} ]  ; then
+	    eval IGCM_sys_Cp ${R_EXE}/${ExeNameIn} ${ExeNameOut}
+	    if [ -f ${RUN_DIR}/${ExeNameOut} ] ; then
+                eval IGCM_sys_Chmod +rx ${RUN_DIR}/${ExeNameOut}
+            fi
+	fi
+
+	# Debug Print
+	IGCM_debug_Print 3 "Update ${compname} Parameter Files."
+	# UPDATE component
+        ${comp}_Update
+
+    done
+
+    IGCM_debug_PopStack "IGCM_comp_Update"
+}
+
+#=======================================================================
+function IGCM_comp_Finalize
+{
+    IGCM_debug_PushStack "IGCM_comp_Finalize"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_Finalize :"
+    echo
+
+    typeset ListTextName TextName0
+    typeset comp compname comptagname card ListFilesName FileName0 NbFiles 
+    typeset i i_ file_in file_in_ file_out file_out_ generic_file_name nb_rebuild_file
+    for comp in ${config_ListOfComponents[*]} ; do
+	# Define component 
+	eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+	eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
+
+	# Debug Print
+	IGCM_debug_Print 1 "Finalize ${compname} component."
+	# FINALIZE component
+        ${comp}_Finalize
+
+	card=${SUBMIT_DIR}/COMP/${compname}.card	
+
+	# Save Restarts files
+	#--------------------
+	IGCM_card_DefineArrayFromOption ${card} RestartFiles List
+	ListFilesName=${compname}_RestartFiles_List
+	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+	
+	if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != XNONE ] ) ; then
+	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+	    
+	    (( i=0 ))
+	    until [ $i -ge $NbFiles ]; do
+		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+		eval file_in=${file_in_}
+
+		(( i_ = i+1 ))
+		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		eval file_out=${file_out_}
+		
+		eval IGCM_sys_Put_Rest ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
+
+		eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
+
+		(( i=i+3 ))
+	    done
+	else
+	    if [ X${FileName0} != XNONE ] ; then
+		IGCM_debug_Exit "IGCM_comp_Finalize : No file in restart list for ${compname}."
+	    else
+		IGCM_debug_Print 1 "IGCM_comp_Finalize : NONE specified in Restart List ${compname}."
+	    fi
+	fi
+
+	# Save Output files
+	#------------------
+	IGCM_card_DefineArrayFromOption ${card} OutputFiles List
+	ListFilesName=${compname}_OutputFiles_List
+ 	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+	if [ X${FileName0} != X${NULL_STR} ] ; then
+	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+
+	    (( i=0 ))
+	    until [ $i -ge $NbFiles ]; do
+		eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+		eval file_in=${file_in_}
+		(( i_ = i+1 ))
+		eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		eval file_out=${file_out_}
+
+		generic_file_name=$( basename ${file_in} .nc )
+		nb_rebuild_file=$( ls | grep "${generic_file_name}[_0-9]*.nc" | wc -l )
+		if [ ${nb_rebuild_file} -gt 1 ] ; then
+		    IGCM_debug_Print 2 "Rebuilding  ${file_in}"
+		    IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc
+		    # DEBUG Rebuild :
+		    #eval IGCM_sys_Cp ${generic_file_name}_*.nc \${R_OUT_${comp}_O_M}/
+		elif [ -f ${generic_file_name}_0000.nc ] ; then
+		    IGCM_sys_Mv ${generic_file_name}_0000.nc ${file_in}
+		fi
+
+		IGCM_sys_Put_Out ${file_in} ${file_out}
+		if [ $? -eq 0 ] ; then
+		    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
+		    if [ ${nb_rebuild_file} -gt 1 ] ; then
+			eval FileToBeDeleted[${#FileToBeDeleted[@]}]=$( ls | grep "${generic_file_name}_[0-9]*.nc" ) > /dev/null 2>&1
+		    fi
+		fi
+		(( i=i+3 ))
+	    done
+	fi
+
+	# Save Output Text files of models
+	#---------------------------------
+	
+	IGCM_card_DefineArrayFromOption ${card} OutputText List
+	ListTextName=${compname}_OutputText_List
+	
+ 	eval TextName0=\${${ListTextName}[0]} > /dev/null 2>&1
+	if [ X${TextName0} != X${NULL_STR} ] ; then
+	    eval NbFiles=\${#${ListTextName}[@]} > /dev/null 2>&1
+
+	    (( i=0 ))
+	    until [ $i -eq $NbFiles ]; do
+		eval file_in=\${${ListTextName}[$i]} > /dev/null 2>&1
+		(( i=i+1 ))
+
+		nb_text_file=$( ls ${file_in}* 2>/dev/null | wc -l )
+		if [ ${nb_text_file} -gt 1 ] ; then
+		    list_file=$( ls ${file_in}* )
+		    for file in ${list_file}
+		      do
+		      eval IGCM_sys_Put_Out ${file} \${R_OUT_${comp}_D}/${PREFIX}_${file}
+		      eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1
+		    done
+		else
+		    if ( [ -f ${file_in}_0000 ] || [ -f ${file_in}0 ] ) ; then
+			eval IGCM_sys_Mv ${file_in}* ${file_in}
+		    fi
+		    eval IGCM_sys_Put_Out ${file_in} \${R_OUT_${comp}_D}/${PREFIX}_${file_in}
+		    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
+		fi
+	    done
+	fi
+    done
+
+    IGCM_debug_PopStack "IGCM_comp_Finalize"
+}
Index: /tags/libIGCM_v1_1/libIGCM_config/libIGCM_config.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_config/libIGCM_config.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_config/libIGCM_config.ksh	(revision 19)
@@ -0,0 +1,555 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip
+# Contact: Sebastien.Denvil@ipsl.jussieu.fr Martial.Mancip@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#===================================
+function IGCM_config_Initialize
+{
+    IGCM_debug_PushStack "IGCM_config_Initialize"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_config_Initialize :"
+    echo
+
+    # Test modipsl tree existence.
+    IGCM_sys_TestDir ${MODIPSL}
+    IGCM_sys_TestDir ${libIGCM}
+    IGCM_sys_TestDir ${R_EXE}
+    IGCM_sys_TestDir ${SUBMIT_DIR}
+
+    #==================================
+
+    typeset option auxprint CompatibilityTag
+    # Read libIGCM compatibility version in config.card
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Compatibility libIGCM
+    eval CompatibilityTag=${config_Compatibility_libIGCM} > /dev/null 2>&1	
+
+    if [ ! "${CompatibilityTag}" = "${libIGCM_CurrentTag}" ] ; then
+	IGCM_debug_Exit "config.card is not compatible with libIGCM version ${libIGCM_CurrentTag} see libIGCM FAQ http://wiki.ipsl.jussieu.fr/wiki_ipsl/IGCMG/libIGCM/DocUtilisateur/FAQ ."
+    fi
+
+    #==================================
+    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices
+
+    for option in ${config_UserChoices[*]} ; do
+        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card UserChoices ${option}
+    done
+
+    IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
+    IGCM_debug_PrintVariables 3 config_UserChoices_JobName
+    IGCM_debug_PrintVariables 3 config_UserChoices_LongName
+    IGCM_debug_PrintVariables 3 config_UserChoices_TagName
+    IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
+    IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
+    IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
+    IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
+
+    #==================================
+
+    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents
+
+    echo
+    IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents"
+    IGCM_debug_Print 3 ${config_ListOfComponents[*]}
+    echo
+
+    NbComponents=${#config_ListOfComponents[*]}
+
+    #==================================
+    # Define principal executable
+
+    IGCM_card_DefineArrayFromSection   ${SUBMIT_DIR}/config.card Executable
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Executable Name
+    
+    #==================================
+    # Define Outputs Name
+    IGCM_debug_Print 1 "Define Script_Output_Prefix and Exe_Output"
+    eval Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'}
+    IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}"
+    eval Exe_Output=out_${config_Executable_Name}
+    IGCM_debug_Print 3 "Exe_Output           = ${Exe_Output}"
+
+    #==================================
+
+    #===================================================================#
+    # Prepare variables available for ${COMP}.card and ${COMP}.driver   #
+    #             But available to any son functions                    #
+    #===================================================================#
+
+    # Convert yyyy-mm-dd date to gregorian yyyymmdd
+    DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
+    DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
+
+    # Period Length In Days between DateBegin and DateEnd
+    (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 ))
+    if [ ${ExperienceLengthInDays} -lt 0 ] ; then
+	IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that."
+	IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates."
+	IGCM_debug_Verif_Exit 
+    fi
+
+    # Day and Year of Initial State (Given in julian format)
+    InitDay=$(  expr $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 )
+    InitYear=$( expr $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 )
+
+    #==================================
+    # Restarts : Gerneral rule or local for each component ?
+    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts
+
+    echo
+    IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts"
+
+    for option in ${config_Restarts[*]} ; do
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option}
+	eval auxprint=\${config_Restarts_${option}}
+	IGCM_debug_Print 3 "${option} : ${auxprint}"
+    done
+
+    #================================================================#
+    #                  Test and Prepare directories                  #
+    #================================================================#
+
+    # ==> 4 kinds of input files :
+    #     1) R_INIT  : Initial State Files   (Etat0, carteveg)
+    #     2) R_BC    : Boundary Conditions   (Forcages, lai)
+    #     3) Parameters files (allready define through ${SUBMIT_DIR})
+    #     4) Restarts files   (allready define in IGCM_config_Initialize)
+
+    # Here we offer the possibility to redefine R_INIT, R_BC
+    # and PeriodNb through config.card
+    R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT}
+    echo
+    IGCM_debug_Print 1 "(Re)Define R_INIT, R_BC and PeriodNb"
+    IGCM_debug_Print 3 "R_INIT=${R_INIT}"
+    R_BC=${config_UserChoices_R_BC:=${R_IN}/BC}
+    IGCM_debug_Print 3  "R_BC=${R_BC}"
+    PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}}
+    IGCM_debug_Print 3  "Loop in main Job with ${PeriodNb} period(s)"
+
+    # Test Archive input/output.
+    IGCM_sys_TestDirArchive ${ARCHIVE}
+    IGCM_sys_TestDirArchive ${R_INIT}
+    IGCM_sys_TestDirArchive ${R_BC}
+
+    #====================================================
+    #R_SAVE : Job output directory
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+
+    if [ ! -f ${SUBMIT_DIR}/run.card ]; then 
+	IGCM_sys_MkdirArchive ${R_SAVE}
+    else
+	#Test state of run in run.card
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
+	if ( [ ${run_Configuration_PeriodState} != "Start" ] && [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then
+	    echo 
+	    IGCM_debug_Print 1 "!!!! IGCM_config_Initialize Error PeriodState : " ${run_Configuration_PeriodState} "!!!!!!!!!!"
+	    echo 
+	    IGCM_debug_Exit "IGCM_config_Initialize Error PeriodState : " ${run_Configuration_PeriodState}
+	    IGCM_debug_Verif_Exit
+	fi
+    fi
+    IGCM_sys_TestDirArchive ${R_SAVE}
+
+    #====================================================
+    #R_OUT_KSH : Storage place for job output
+    #R_OUT_EXE : Storage place for binary used during simulation
+    R_OUT_KSH=${R_SAVE}/Out
+    R_OUT_EXE=${R_SAVE}/Exe
+
+    IGCM_debug_PopStack "IGCM_config_Initialize"
+}
+
+#===================================
+function IGCM_config_PeriodStart
+{
+    IGCM_debug_PushStack "IGCM_config_PeriodStart"
+
+    echo
+    IGCM_debug_Print 1 "IGCM_config_PeriodStart :"
+    echo
+
+    if [ ! -r ${SUBMIT_DIR}/run.card ]; then 
+
+        #================================================#
+        #         The file run.card doesn't exist        #
+        #================================================#
+
+	eval FirstInitialize=true
+
+	#copy initial run.card
+	IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${SUBMIT_DIR}/run.card
+
+	IGCM_date_GetYearMonth $DateBegin year month
+
+	case ${config_UserChoices_PeriodLength} in
+	    1Y|1y) 
+		(( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;;
+	    1M|1m) 
+		(( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;;
+	    5D|5d) 
+		(( PeriodLengthInDays = 5 )) ;;
+	    1D|1d) 
+		(( PeriodLengthInDays = 1 )) ;;
+	    *) 
+		IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in 1Y, 1M, 5D, 1D."
+		IGCM_debug_Verif_Exit ;;
+	esac
+
+	eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1
+	PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $( expr ${PeriodLengthInDays} - 1 ) )
+	eval CumulPeriod=1 > /dev/null 2>&1
+
+        #=================================================#
+        #        Creation and write updated run.card      #
+        #=================================================#
+
+	#Correct run.card Configuration for this period
+	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin}
+	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd}
+	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod}
+	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running"
+ 
+    else
+        #================================================#
+        #         The file run.card allready exist       #
+        #================================================#
+
+	eval FirstInitialize=false
+
+	#Test state of run in run.card
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
+	if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then
+	    echo 
+	    IGCM_debug_Print 1 "!!!!!! IGCM_config_PeriodStart Error PeriodState : " ${run_Configuration_PeriodState} "!!!!!!!!!!"
+	    echo 
+	    IGCM_debug_Exit "IGCM_config_PeriodStart Error PeriodState : " ${run_Configuration_PeriodState}
+	    IGCM_debug_Verif_Exit
+	fi
+
+        #===================================#
+        #        Read updated run.card      #
+        #===================================#
+
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration OldPrefix
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod
+
+	PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} )
+	PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} )
+	eval CumulPeriod="${run_Configuration_CumulPeriod}" > /dev/null 2>&1
+
+	if [ ${Period} = 1 ]; then
+           # save last Job output
+	    typeset LastPeriod Last_Script_Output_Name
+	    (( LastPeriod=CumulPeriod-PeriodNb ))
+	    Last_Script_Output_Name="${Script_Output_Prefix}_${config_UserChoices_JobName}.${LastPeriod}"
+ 	    #eval ls -l ${SUBMIT_DIR}/${Last_Script_Output_Name}
+ 	    #eval IGCM_sys_Put_Out ${SUBMIT_DIR}/${Last_Script_Output_Name} ${R_OUT_KSH}/${Last_Script_Output_Name} > /dev/null 2>&1
+	    IGCM_debug_Print 1 "Try to save previous ksh job output"
+	    IGCM_sys_Cd ${SUBMIT_DIR}/
+	    IGCM_sys_Put_Out ${Last_Script_Output_Name} ${R_OUT_KSH}/
+	    IGCM_sys_Cd ${RUN_DIR}
+	else
+	    unset FileToBeDeleted
+	fi
+
+	IGCM_date_GetYearMonth $PeriodDateBegin year month
+
+        # Determine number of day(s) in PeriodLength :
+	case ${config_UserChoices_PeriodLength} in
+	    1Y|1y) 
+		(( PeriodLengthInDays = $( IGCM_date_DaysInYear $year ) )) ;;
+	    1M|1m) 
+		(( PeriodLengthInDays = $( IGCM_date_DaysInMonth $year $month ) )) ;;
+	    5D|5d) 
+		(( PeriodLengthInDays=5 )) ;;
+	    1D|1d) 
+		(( PeriodLengthInDays=1 )) ;;
+	    *) 
+		IGCM_debug_Exit "IGCM_config_PeriodStart " ${config_UserChoices_PeriodLength} " invalid period length : choose in 1Y, 1M, 5D, 1D."
+		IGCM_debug_Verif_Exit ;;
+	esac
+
+	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running"
+
+    fi    
+    OldPrefix=${config_UserChoices_JobName}_${PeriodDateEnd}
+  
+    #===================================================================#
+    # Prepare variables available for ${COMP}.card and ${COMP}.driver   #
+    #             But available to any son functions                    #
+    #===================================================================#
+
+    # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !)
+    (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 ))
+
+    # Debug Print :
+    IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution"
+    IGCM_debug_Print 3 "Year of simulation      : ${year}"
+    IGCM_debug_Print 3 "Month of simulation     : ${month}"
+    IGCM_debug_Print 3 "PeriodLengthInDays      : ${PeriodLengthInDays}"
+    IGCM_debug_Print 3 "PeriodDateBegin         : ${PeriodDateBegin}"
+    IGCM_debug_Print 3 "PeriodDateEnd           : ${PeriodDateEnd}"
+    IGCM_debug_Print 3 "SimulationLengthInDays  : ${SimulationLengthInDays}"
+    IGCM_debug_Print 3 "ExperienceLengthInDays  : ${ExperienceLengthInDays}"
+
+    #================================================================#
+    #         Prepare variables available for comp_finalyze          #
+    #================================================================#
+
+    # Period for save files
+    eval DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd} > /dev/null 2>&1
+
+    # Prefix for save files of this period
+    eval PREFIX=${config_UserChoices_JobName}_${DatesPeriod}  > /dev/null 2>&1
+
+    # List of files that will be deleted in RUN_DIR after run
+    FileToBeDeleted[0]="stack"
+
+    # Test if the same run as already been saved :
+    if [ ${DRYRUN} -le 0 ] ; then
+	if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then
+	    IGCM_debug_Exit "IGCM_config_PeriodStart" "RErun an old job."
+	    IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files"
+	    IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or "
+	    IGCM_debug_Print 1 " the whole ${R_SAVE} tree."
+	    IGCM_debug_Verif_Exit
+	fi
+    fi
+    IGCM_debug_PopStack "IGCM_config_PeriodStart"
+}
+
+#===================================
+function IGCM_config_PeriodEnd
+{
+    IGCM_debug_PushStack "IGCM_config_PeriodEnd"
+
+    echo
+    IGCM_debug_Print 1 "IGCM_config_PeriodEnd :"
+    echo
+
+    #==================================#
+    #         Save Job output          #
+    #==================================#
+    IGCM_sys_Put_Out ${Exe_Output} ${R_OUT_KSH}/${PREFIX}_${Exe_Output}
+    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}"
+
+    typeset LS_comp LS_bin ExeDate ExeCpuLog ExeSize NextExeSize LastCompExeSize
+    typeset comp i    
+    typeset ExeNameIn ExeNameOut 
+
+    #==================================#
+    #        Get last Exe Size         #
+    #==================================#
+
+    (( i=0 ))
+    if ( ${FirstInitialize} ) ; then
+	run_Log_LastExeSize=""
+	for comp in ${config_ListOfComponents[*]} ; do
+	    run_Log_LastExeSize[$i]=0
+	    (( i=i+1 ))
+	done
+    else
+	IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize
+    fi
+
+    #==================================#
+    #         And Build ExeDate        #
+    #==================================#
+
+    # ExeDate = ATM_Jun_12_09:34-SRF_Jun_12_09:34-OCE_Jun_12_09:34-ICE_Jun_12_09:34-CPL_Jun_12_09:33
+    ExeDate=""
+    NextExeSize="( "
+    (( i=0 ))
+
+    for comp in ${config_ListOfComponents[*]} ; do
+
+	IGCM_debug_Print 1 ${comp}
+
+	eval ExeNameIn=\${config_Executable_${comp}[0]}
+	eval ExeNameOut=\${config_Executable_${comp}[1]}
+	if [ X${ExeNameIn} = X\"\" ] ; then
+	    # If there is no exe file for this component
+	    (( ExeSize=0 ))
+	else
+	    eval LS_bin=${R_EXE}/${ExeNameIn}
+	    IGCM_sys_FileSize ${LS_bin} ExeSize
+
+	    set +A LS_comp -- $( ls -l ${LS_bin} )
+	    if [ X${ExeDate} = X ] ; then 
+	        # First component exe date
+		ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]}
+	    else
+		ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]}
+	    fi
+	    ExeDate=${ExeDate}_${LS_comp[7]}
+
+	    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut}
+	fi
+
+	if [ ${i} -eq 0 ] ; then
+	    # First component
+	    NextExeSize="( "${ExeSize}
+	else
+	    NextExeSize=${NextExeSize}", "${ExeSize}
+	fi
+	eval LastCompExeSize=${run_Log_LastExeSize[$i]}
+	(( i=i+1 ))
+
+	if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then 
+	    if ( ${FirstInitialize} ) ; then
+		IGCM_debug_Print 1 "Put first ${ExeNameIn} in ${R_OUT_EXE} !"
+	    else
+		IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !"
+	    fi
+	    eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn}
+	fi
+    done
+
+    if [ ${DRYRUN} -le 1 ] ; then
+	typeset ExeCpuLog
+	tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt
+	ExeCpuLog=$( ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt )
+	RET=$?
+	if [ $RET -eq 0 ] ; then 
+	    echo "("${CumulPeriod} " , " ${PeriodDateBegin} " , " ${PeriodDateEnd} \
+		" , " ${ExeCpuLog} " , "             ${ExeDate}") \\" >> ${SUBMIT_DIR}/run.card
+	fi
+	eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${Exe_Output}_tail.txt"
+    fi
+
+    NextExeSize=${NextExeSize}" )"
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}"
+
+    # All was right ? no ? then we stop.
+    IGCM_debug_Verif_Exit
+
+    # If all was OK, we can delete all files not necessary for next Job
+    echo "Files that will be deleted before next period-run : "
+
+    if [ ${DRYRUN} -le 2 ] ; then
+	eval ls -la ${FileToBeDeleted[@]}
+	eval rm -f ${FileToBeDeleted[@]}
+    else
+	echo ${FileToBeDeleted[@]}
+    fi
+
+    #=================================================#
+    #         Determine next computed period          #
+    #=================================================#
+
+    PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 )
+    IGCM_date_GetYearMonth $PeriodDateBegin year month
+
+    # Determine number of day(s) in PeriodLength :
+    case ${config_UserChoices_PeriodLength} in
+	1Y|1y) PeriodLengthInDays=$( expr $( IGCM_date_DaysInYear $year ) ) ;;
+	1M|1m) PeriodLengthInDays=$( expr $( IGCM_date_DaysInMonth $year $month ) ) ;;
+	5D|5d) PeriodLengthInDays=$( expr 5 ) ;;
+	1D|1d) PeriodLengthInDays=$( expr 1 ) ;;
+    esac
+    PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $( expr ${PeriodLengthInDays} - 1 ) )
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution"
+    IGCM_debug_Print 3 "PeriodDateBegin       : ${PeriodDateBegin}"
+    IGCM_debug_Print 3 "PeriodDateEnd         : ${PeriodDateEnd}"
+    IGCM_debug_Print 3 "PeriodLengthInDays    : ${PeriodLengthInDays}"
+
+    PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} )
+    PeriodDateEnd=$( IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} )
+
+    (( CumulPeriod = CumulPeriod + 1 ))
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 3 "PeriodDateBegin Human : ${PeriodDateBegin}"
+    IGCM_debug_Print 3 "PeriodDateEnd Human   : ${PeriodDateEnd}"
+    IGCM_debug_Print 3 "CumulPeriod           : ${CumulPeriod}"
+
+    #=================================================#
+    #             Write updated run.card              #
+    #=================================================#
+
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration OldPrefix ${OldPrefix}
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin}
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd}
+    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod}
+
+    IGCM_debug_PopStack "IGCM_config_PeriodEnd"
+}
+
+#===================================
+function IGCM_config_Finalize
+{
+    IGCM_debug_PushStack "IGCM_config_Finalize"
+
+    echo
+    IGCM_debug_Print 1 "IGCM_config_Finalize :"
+    echo
+
+    # Supress Non Deleted Boundary files
+    if [ ${DRYRUN} -le 2 ] ; then
+	IGCM_comp_DelFixeBoundaryFiles
+	ls -la
+    fi
+
+    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
+
+	#==========================#
+        # End of entire simulation #
+        #==========================#
+
+	cat  << END_MAIL > job_atlas.mail
+Dear ${LOGIN},
+
+  Simulation ${config_UserChoices_JobName} is finished on supercomputer `hostname`.
+  Job started : ${DateBegin}
+  Job ended   : ${DateEnd}
+  Ouput files are available in ${R_SAVE}
+END_MAIL
+
+	mailx -s "${config_UserChoices_JobName} completed" ${USER} < job_atlas.mail
+	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed"
+	IGCM_debug_Print 1 "Normal End of computation."
+	if ( $DEBUG_debug ) ; then
+	    echo
+	    IGCM_debug_Print 1 "Your files on ${R_OUT} :"
+	    IGCM_sys_Tree ${R_SAVE}
+	fi
+    else
+
+	#=================#
+        # Submit next job #
+        #=================#
+
+	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue"
+	typeset -x DEBUG_debug=false
+
+        # Name of next Ksh Script output :
+	eval Script_Output="${Script_Output_Prefix}_${config_UserChoices_JobName}.${CumulPeriod}"
+
+	IGCM_debug_Print 1 "Submit next job"
+        # SUBMITTED NEXT JOB
+	IGCM_sys_Cd ${SUBMIT_DIR}
+	IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}
+    fi
+
+    IGCM_debug_PopStack "IGCM_config_Finalize"
+}
+
+#===================================
Index: /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test.ksh	(revision 19)
@@ -0,0 +1,144 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil
+# Contact: Sebastien.Denvil@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+# This script is used to generate a reference file with command :
+# IGCM_date_Test.ksh > IGCM_date_Test.ref 2>&1
+# The reference file produced is used by the function IGCM_date_Check
+# to verify that the libIGCM_date produce the same results
+
+#=================================================
+libIGCM=`dirname $0`/..
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
+
+if [ X${config_UserChoices_CalendarType} = X ] ; then
+    config_UserChoices_CalendarType="leap"
+fi
+
+echo "#=================================#"
+echo "IGCM_date_DaysInYear test"
+echo "#=================================#"
+
+echo ""
+echo "#"
+echo "IGCM_date_DaysInYears 1998"
+echo "#"
+IGCM_date_DaysInYear 1998
+
+echo ""
+echo "#"
+echo "IGCM_date_DaysInYears 2000"
+echo "#"
+IGCM_date_DaysInYear 2000
+
+echo "#=================================#"
+echo "IGCM_date_DaysInMonth test"
+echo "#=================================#"
+
+echo ""
+echo "#"
+echo "IGCM_date_DaysInMonth 1998 02"
+echo "#"
+IGCM_date_DaysInMonth 1998 02
+
+echo ""
+echo "#"
+echo "IGCM_date_DaysInMonth 20000206"
+echo "#"
+IGCM_date_DaysInMonth 20000206
+
+echo "#==========================================#"
+echo "IGCM_date_ConvertGregorianDateToJulian test"
+echo "#==========================================#"
+
+echo ""
+echo "#"
+echo "IGCM_date_ConvertGregorianDateToJulian 19980312"
+echo "#"
+IGCM_date_ConvertGregorianDateToJulian 19980312
+
+echo ""
+echo "#"
+echo "IGCM_date_ConvertGregorianDateToJulian 19980830"
+echo "#"
+IGCM_date_ConvertGregorianDateToJulian 19980830
+
+echo "#==========================================#"
+echo "IGCM_date_ConvertJulianDateToGregorian test"
+echo "#==========================================#"
+
+echo ""
+echo "#"
+echo "IGCM_date_ConvertJulianDateToGregorian 1998326"
+echo "#"
+IGCM_date_ConvertJulianDateToGregorian 1998326
+
+echo ""
+echo "#"
+echo "IGCM_date_ConvertJulianDateToGregorian 2000298"
+echo "#"
+IGCM_date_ConvertJulianDateToGregorian 2000298
+
+echo "#==================================#"
+echo "IGCM_date_AddDaysToJulianDate test"
+echo "#==================================#"
+
+echo ""
+echo "#"
+echo "IGCM_date_AddDaysToJulianDate 1998312 14"
+echo "#"
+IGCM_date_AddDaysToJulianDate 1998312 14
+
+echo ""
+echo "#"
+echo "IGCM_date_AddDaysToJulianDate 2000312 -14"
+echo "#"
+IGCM_date_AddDaysToJulianDate 2000312 -14
+
+echo "#====================================#"
+echo "IGCM_date_AddDaysToGregorianDate test"
+echo "#====================================#"
+
+echo ""
+echo "#"
+echo "IGCM_date_AddDaysToGregorianDate 19980312 44"
+echo "#"
+IGCM_date_AddDaysToGregorianDate 19980312 44
+
+echo ""
+echo "#"
+echo "IGCM_date_AddDaysToGregorianDate 20000228 -44"
+echo "#"
+IGCM_date_AddDaysToGregorianDate 20000228 -44
+
+echo "#====================================#"
+echo "IGCM_date_DaysBetweenJulianDate test"
+echo "#====================================#"
+
+echo ""
+echo "#"
+echo "IGCM_date_DaysBetweenJulianDate 1860001 1865365"
+echo "#"
+IGCM_date_DaysBetweenJulianDate 1860001 1865365
+
+echo "#======================================#"
+echo "IGCM_date_DaysBetweenGregorianDate test"
+echo "#======================================#"
+
+echo ""
+echo "#"
+echo "IGCM_date_DaysBetweenGregorianDate 18801231 18750101"
+echo "#"
+IGCM_date_DaysBetweenGregorianDate 18801231 18750101
Index: /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test4.ref
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test4.ref	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test4.ref	(revision 19)
@@ -0,0 +1,94 @@
+#=================================#
+IGCM_date_DaysInYear test
+#=================================#
+
+#
+IGCM_date_DaysInYears 1998
+#
+365
+
+#
+IGCM_date_DaysInYears 2000
+#
+366
+#=================================#
+IGCM_date_DaysInMonth test
+#=================================#
+
+#
+IGCM_date_DaysInMonth 1998 02
+#
+28
+
+#
+IGCM_date_DaysInMonth 20000206
+#
+29
+#==========================================#
+IGCM_date_ConvertGregorianDateToJulian test
+#==========================================#
+
+#
+IGCM_date_ConvertGregorianDateToJulian 19980312
+#
+1998071
+
+#
+IGCM_date_ConvertGregorianDateToJulian 19980830
+#
+1998242
+#==========================================#
+IGCM_date_ConvertJulianDateToGregorian test
+#==========================================#
+
+#
+IGCM_date_ConvertJulianDateToGregorian 1998326
+#
+19981122
+
+#
+IGCM_date_ConvertJulianDateToGregorian 2000298
+#
+20001024
+#==================================#
+IGCM_date_AddDaysToJulianDate test
+#==================================#
+
+#
+IGCM_date_AddDaysToJulianDate 1998312 14
+#
+1998326
+
+#
+IGCM_date_AddDaysToJulianDate 2000312 -14
+#
+2000298
+#====================================#
+IGCM_date_AddDaysToGregorianDate test
+#====================================#
+
+#
+IGCM_date_AddDaysToGregorianDate 19980312 44
+#
+19980425
+
+#
+IGCM_date_AddDaysToGregorianDate 20000228 -44
+#
+20000115
+#====================================#
+IGCM_date_DaysBetweenJulianDate test
+#====================================#
+
+#
+IGCM_date_DaysBetweenJulianDate 1860001 1865365
+#
+-2191
+#======================================#
+IGCM_date_DaysBetweenGregorianDate test
+#======================================#
+
+#
+IGCM_date_DaysBetweenGregorianDate 18801231 18750101
+#
+2191
Index: /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test5.ref
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test5.ref	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_date/IGCM_date_Test5.ref	(revision 19)
@@ -0,0 +1,94 @@
+#=================================#
+IGCM_date_DaysInYear test
+#=================================#
+
+#
+IGCM_date_DaysInYears 1998
+#
+365
+
+#
+IGCM_date_DaysInYears 2000
+#
+366
+#=================================#
+IGCM_date_DaysInMonth test
+#=================================#
+
+#
+IGCM_date_DaysInMonth 1998 02
+#
+28
+
+#
+IGCM_date_DaysInMonth 20000206
+#
+29
+#==========================================#
+IGCM_date_ConvertGregorianDateToJulian test
+#==========================================#
+
+#
+IGCM_date_ConvertGregorianDateToJulian 19980312
+#
+1998071
+
+#
+IGCM_date_ConvertGregorianDateToJulian 19980830
+#
+1998242
+#==========================================#
+IGCM_date_ConvertJulianDateToGregorian test
+#==========================================#
+
+#
+IGCM_date_ConvertJulianDateToGregorian 1998326
+#
+019981122
+
+#
+IGCM_date_ConvertJulianDateToGregorian 2000298
+#
+020001024
+#==================================#
+IGCM_date_AddDaysToJulianDate test
+#==================================#
+
+#
+IGCM_date_AddDaysToJulianDate 1998312 14
+#
+1998326
+
+#
+IGCM_date_AddDaysToJulianDate 2000312 -14
+#
+2000298
+#====================================#
+IGCM_date_AddDaysToGregorianDate test
+#====================================#
+
+#
+IGCM_date_AddDaysToGregorianDate 19980312 44
+#
+019980425
+
+#
+IGCM_date_AddDaysToGregorianDate 20000228 -44
+#
+020000115
+#====================================#
+IGCM_date_DaysBetweenJulianDate test
+#====================================#
+
+#
+IGCM_date_DaysBetweenJulianDate 1860001 1865365
+#
+-2191
+#======================================#
+IGCM_date_DaysBetweenGregorianDate test
+#======================================#
+
+#
+IGCM_date_DaysBetweenGregorianDate 18801231 18750101
+#
+2191
Index: /tags/libIGCM_v1_1/libIGCM_date/libIGCM_date.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_date/libIGCM_date.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_date/libIGCM_date.ksh	(revision 19)
@@ -0,0 +1,739 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Sebastien Denvil
+# Contact: Sebastien.Denvil@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#==================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted.
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#==================================================
+
+#D-#==================================================================
+#D-libIGCM_date
+#D-This ksh library handles date calculs and convertions in different calendars. 
+
+# Number of digit in the year
+typeset -r dY=${dY:=4}
+#typeset -r MaxpY=$( echo "10^"$((dY+1)) | bc -l )
+# Number of digit in non-human date representation
+typeset -r pY=$(( dY+4 ))
+
+#==================================================================
+function IGCM_date_YearDigit
+{
+    IGCM_debug_PushStack "IGCM_date_YearDigit" $@
+
+    NUM=$(( 10#${1} ))
+    echo $( awk "BEGIN { printf \"%0${dY}d\",${NUM} }" )
+
+    IGCM_debug_PopStack "IGCM_date_YearDigit"
+}
+
+#==================================================================
+function IGCM_date_GregorianDigit
+{
+    IGCM_debug_PushStack "IGCM_date_GregorianDigit" $@
+
+    NUM=$(( 10#${1} ))
+    echo $( awk "BEGIN { printf \"%0${pY}d\",${NUM} }" )
+
+    IGCM_debug_PopStack "IGCM_date_GregorianDigit"
+}
+
+#==================================================================
+function IGCM_date_HumanDigit
+{
+    IGCM_debug_PushStack "IGCM_date_HumanDigit" $@
+
+    echo $( IGCM_date_GregorianDigit $( print ${1} | sed 's/-//g' ) ) \
+	| sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/"
+
+    IGCM_debug_PopStack "IGCM_date_HumanDigit"
+}
+
+#==================================================================
+function IGCM_date_ConvertFormatToGregorian
+{
+    IGCM_debug_PushStack "IGCM_date_ConvertFormatToGregorian" $@
+
+    # from a yyyy-mm-dd date format return 
+    # a yyymmdd date format
+    # usage IGCM_date_ConvertFormat yyyy-mm-dd
+
+    # if there is no argument on the command line, 
+    # then assume that a y-m-d formated date is being 
+    # piped in
+    typeset ymd
+    if [ $# = 0 ]
+	then
+	read ymd
+    else
+	ymd=$1
+    fi
+
+    IGCM_date_GregorianDigit $( print ${ymd} | sed 's/-//g' )
+
+    IGCM_debug_PopStack "IGCM_date_ConvertFormatToGregorian"
+}
+
+#==================================================================
+function IGCM_date_ConvertFormatToHuman
+{
+    IGCM_debug_PushStack "IGCM_date_ConvertFormatToHuman" $@
+
+    # from a yyyymmdd date format return 
+    # a yyyy-mm-dd date format
+    # usage IGCM_date_ConvertFormat yyyymmdd
+
+    # if there is no argument on the command line, 
+    # then assume that a yyyymmdd formated date is being 
+    # piped in
+    typeset dt
+    if [ $# = 0 ]
+	then
+	read dt
+    else
+	dt=$1
+    fi
+
+    # break the yyyymmdd into separate parts for year, month and day
+    echo $( IGCM_date_GregorianDigit ${dt} ) \
+	| sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1-\2-\3/"
+
+    IGCM_debug_PopStack "IGCM_date_ConvertFormatToHuman"
+}
+
+#==================================================================
+function IGCM_date_GetYearMonth
+{
+    IGCM_debug_PushStack "IGCM_date_GetYearMonth" $@
+
+    # from a yyyymmdd date format return 
+    # a yyyy year and mm month
+    # usage IGCM_date_GetYearMonth yyyymmdd year_var month_var
+
+    # if there is no argument on the command line, 
+    # then assume that a yyyymmdd formated date is being 
+    # piped in
+    typeset dt
+    if [ $# = 0 ]
+	then
+	read dt
+    else
+	dt=$1
+    fi
+
+    # break the yyyymmdd into separate parts for year, month and day
+    eval $2=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
+	| sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\1/" )
+    eval $3=$( echo $( IGCM_date_GregorianDigit ${dt} ) \
+	| sed -e "s/\([0-9]\{${dY}\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\2/" )
+
+    IGCM_debug_PopStack "IGCM_date_GetYearMonth"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_DaysInYear
+#D-* Purpose: Return the number of days in a year
+#D-* Usage: IGCM_date_DaysInYear yyyy
+#D-         if there is no argument on the command line, 
+#D-         then assume that a yyyy is being piped in
+#D-
+function IGCM_date_DaysInYear
+{
+    IGCM_debug_PushStack "IGCM_date_DaysInYear" $@
+    # return the number of days in a year
+    # usage IGCM_date_DaysInYear yyyy
+
+    # What is the calendar :
+    if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then
+	echo 360
+	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	return
+    else
+	if [ "${config_UserChoices_CalendarType}" = "noleap" ] ; then
+	    echo 365
+	    IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	    return
+	fi
+    fi
+
+    # if there is no argument on the command line, 
+    # then assume that a yyyy is being piped in
+    if [ $# = 0 ]
+	then
+	read y
+    else
+	y=$(( 10#${1} ))
+    fi
+
+    # a year is a leap year if it is even divisible by 4
+    # but not evenly divisible by 100
+    # unless it is evenly divisible by 400
+
+    # if it is evenly divisible by 400 it must be a leap year
+    a=$( expr $y \% 400 )
+    if [ $a = 0 ]
+	then
+	echo 366
+	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	return
+    fi
+
+    #if it is evenly divisible by 100 it must not be a leap year
+    a=$( expr $y \% 100 )
+    if [ $a = 0 ]
+	then
+	echo 365
+	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	return
+    fi
+	
+    # if it is evenly divisible by 4 it must be a leap year
+    a=$( expr $y \% 4 )
+    if [ $a = 0 ]
+	then
+	echo 366
+	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	return
+    fi
+
+    # otherwise it is not a leap year
+    echo 365
+
+    IGCM_debug_PopStack "IGCM_date_DaysInYear"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_DaysInMonth
+#D-* Purpose: Calculate the number of days in a month 
+#D-* Usage: IGCM_date_DaysInMonth yyyy mm
+#D-         or IGCM_date_DaysInMonth yyyymmdd
+#D-         if there are no command line arguments then 
+#D-         assume that a yyyymmdd is being piped in and read the value.
+#D-         if there is only one argument assume it is a yyyymmdd on the command line
+#D-         other wise it is a yyyy and mm on the command line
+function IGCM_date_DaysInMonth
+{
+    IGCM_debug_PushStack "IGCM_date_DaysInMonth" $@
+
+    # calculates the number of days in a month 
+    # usage IGCM_date_DaysInMonth yyyy mm
+    # or IGCM_date_DaysInMonth yyyymmdd
+
+    # What is the calendar :
+    if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then
+	echo 30
+	IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+	return
+    fi
+
+    # if there are no command line arguments then assume that a yyyymmdd is being
+    # piped in and read the value.
+    # if there is only one argument assume it is a yyyymmdd on the command line
+    # other wise it is a yyyy and mm on the command line
+    if [ $# = 0 ]
+	then
+	read ymd
+    elif [ $# = 1 ] 
+	then
+	ymd=$1
+    else
+	ymd=$( expr \( \( $1 \* 10000 \) \+ \( $2 \* 100 \) \+ 1 \) )
+    fi
+
+    # extract the year and the month
+    y=$( expr $ymd / 10000 ) ;
+    m=$( expr \( $ymd \% 10000 \) / 100 ) ;
+
+    # 30 days hath september etc.
+    case $m in
+	1|3|5|7|8|10|12) 
+	    echo 31
+	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+	    return ;;
+	4|6|9|11) 
+	    echo 30	
+	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+	    return ;;
+	*) ;;
+    esac
+
+    # except for month 2 which depends on whether the year is a leap year
+    # Use IGCM_date_DaysInYear to get the number of days in the year and return a value
+    # accordingly.
+    diy=$( IGCM_date_DaysInYear $y )
+    case $diy in
+	365) 
+	    echo 28
+	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+	    return ;;
+	366) 
+	    echo 29
+	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+	    return ;;
+    esac
+
+    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_ConvertGregorianDateToJulian
+#D-* Purpose: Convert yyyymmdd to yyyyddd
+#D-* Usage: IGCM_date_ConvertGregorianDateToJulian 19980429
+#D-         if there is no command line argument, then assume that the date
+#D-         is coming in on a pipe and use read to collect it
+#D-
+function IGCM_date_ConvertGregorianDateToJulian
+{
+    IGCM_debug_PushStack "IGCM_date_ConvertGregorianDateToJulian" $@
+
+    # IGCM_date_ConvertGregorianDateToJulian converts yyyymmdd to yyyyddd
+    # usage IGCM_date_ConvertGregorianDateToJulian 19980429
+
+    # if there is no command line argument, then assume that the date
+    # is coming in on a pipe and use read to collect it    
+    if [ $# = 0 ]
+	then
+	read dt
+    else
+	dt=$1
+    fi
+
+    # break the yyyymmdd into separate parts for year, month and day
+    y=$( expr $dt / 10000 )
+    m=$( expr \( $dt \% 10000 \) / 100 )
+    d=$( expr \( $dt \% 100 \) )
+
+    # add the days in each month up to (but not including the month itself)
+    # into the days. For example if the date is 19980203 then extract the
+    # number of days in January and add it to 03. If the date is June 14, 1998
+    # then extract the number of days in January, February, March, April and May
+    # and add them to 14.
+    x=1
+    while [ $( expr $x \< $m ) = 1 ]
+      do
+      md=$( IGCM_date_DaysInMonth $y $x )
+      d=$( expr \( $d \+ $md \) )
+      x=$( expr \( $x \+ 1 \) )
+    done
+
+    # combine the year and day back together again and you have the julian date.
+    jul=$( expr \( $y \* 1000 \) + $d )
+    echo $jul
+
+    IGCM_debug_PopStack "IGCM_date_ConvertGregorianDateToJulian"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_ConvertJulianDateToGregorian()
+#D-* Purpose: Convert yyyyddd to yyyymmdd
+#D-* Usage: IGCM_date_ConvertJulianDateToGregorian 1998213
+#D-         if there is no command line argument, assume one is being 
+#D-         piped in and read it
+#D-
+function IGCM_date_ConvertJulianDateToGregorian
+{
+    IGCM_debug_PushStack "IGCM_date_ConvertJulianDateToGregorian" $@
+
+    # IGCM_date_ConvertJulianDateToGregorian converts yyyyddd to yyyymmdd
+    # usage IGCM_date_ConvertJulianDateToGregorian 1998213
+
+    # if there is no command line argument, assume one is being 
+    # piped in and read it
+    if [ X$1 = X ]
+	then
+	read dt
+    else
+	dt=$1
+    fi
+	
+    # break apart the year and the days
+    y=$( expr $dt / 1000 )
+    d=$( expr $dt \% 1000 )
+	
+    # subtract the number of days in each month starting from 1
+    # from the days in the date. When the day goes below 1, you
+    # have the current month. Add back the number of days in the
+    # month to get the correct day of the month
+    m=1
+    while [ $( expr $d \> 0 ) = 1 ]
+      do
+      md=$( IGCM_date_DaysInMonth $y $m )
+      d=$( expr $d \- $md )
+      m=$( expr $m \+ 1 )
+    done
+
+    d=$( expr $d \+ $md )
+
+    # the loop steps one past the correct month, so back up the month
+    m=$( expr $m \- 1 )
+
+    # assemble the results into a gregorian date
+    grg=$( expr \( $y \* 10000 \) \+ \( $m \* 100 \) \+ $d )
+    echo $( IGCM_date_GregorianDigit $grg )
+
+    IGCM_debug_PopStack "IGCM_date_ConvertJulianDateToGregorian"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_AddDaysToJulianDate
+#D-* Purpose: Add days to a yyyyddd formatted date
+#D-* Usage: IGCM_date_AddDaysToJulianDate 1998312 { ,-}14
+#D-         Read from the difference from the command lines
+#D-         and the date from the command line, or standard input
+#D-
+function IGCM_date_AddDaysToJulianDate
+{
+    IGCM_debug_PushStack "IGCM_date_AddDaysToJulianDate" $@
+
+    # IGCM_date_AddDaysToJulianDate adds days to a yyyyddd formatted date
+    # usage IGCM_date_AddDaysToJulianDate 1998312 { ,-}14
+
+    # Read the difference from the command lines
+    # and the date from the command line, or standard input
+    if [ X$2 = X ]
+	then
+	dif=$1
+	read yd
+    else
+	yd=$1
+	dif=$2
+    fi
+
+    # Break it into pieces
+    d=$( expr $yd \% 1000 )
+    y=$( expr $yd / 1000 )
+
+    # Add the number of days (if days is negative this results is
+    # a subtraction)
+    d=$( expr $d \+ $dif )
+
+    # Extract the days in the year
+    diy=$( IGCM_date_DaysInYear $y )
+
+    # If the calculated day exceeds the days in the year, 
+    # add one year to the year and subtract the days in the year from the
+    # calculated days. Extract the days in the new year and repeat
+    # test until you end up with a day number that falls within the
+    # days of the year
+    while [ $( expr $d \> $diy ) = 1 ]
+      do
+      d=$( expr $d - $diy )
+      y=$( expr $y \+ 1 )
+      diy=$( IGCM_date_DaysInYear $y )
+    done
+
+    # This is the reverse process. If the calculated number of days
+    # is less than 1, move back one year. Extract
+    # the days in this year and add the days in the year
+    # loop on this test until you end up with a number that
+    # falls within the days of the year
+    while [ $( expr $d \< 1 ) = 1 ]
+      do
+      y=$( expr $y - 1 )
+      diy=$( IGCM_date_DaysInYear $y )
+      d=$( expr $d \+ $diy )
+    done
+
+    # put the year and day back together and echo the result
+    yd=$( expr \( $y \* 1000 \) + $d )
+
+    echo $yd
+
+    IGCM_debug_PopStack "IGCM_date_AddDaysToJulianDate"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_AddDaysToGregorianDate
+#D-* Purpose: Add days to a yyyymmdd formatted date
+#D-* Usage: IGCM_date_AddDaysToGregorianDate 19980312 { ,-}14
+#D-         Read from the difference from the command lines
+#D-         and the date from the command line, or standard input
+#D-
+function IGCM_date_AddDaysToGregorianDate
+{
+    IGCM_debug_PushStack "IGCM_date_AddDaysToGregorianDate" $@
+
+    # IGCM_date_AddDaysToGregorianDate adds days to a yyyymmdd formatted date
+    # usage IGCM_date_AddDaysToGregorianDate 19980312 { ,-}14
+
+    # Read the difference from the command lines
+    # and the date from the command line, or standard input
+    typeset dif yd tmp res
+    if [ X$2 = X ]
+	then
+	dif=$1
+	read yd
+    else
+	yd=$1
+	dif=$2
+    fi
+
+    tmp=$( IGCM_date_ConvertGregorianDateToJulian $yd )
+    tmp=$( IGCM_date_AddDaysToJulianDate $tmp $dif )
+    res=$( IGCM_date_ConvertJulianDateToGregorian $tmp )
+    
+    echo $res
+
+    IGCM_debug_PopStack "IGCM_date_AddDaysToGregorianDate"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_DaysBetweenJulianDate
+#D-* Purpose: Calculate the days difference between two dates and reports 
+#D-           the number days as jul1 - jul2 
+#D-* Usage: IGCM_date_DaysBetweenJulianDate jul1 jul2
+#D-         where julian date is in the form yyyyddd
+#D-
+function IGCM_date_DaysBetweenJulianDate
+{
+    IGCM_debug_PushStack "IGCM_date_DaysBetweenJulianDate" $@
+
+    # calculates the days difference between two dates and reports 
+    # the number days as jul1 - jul2 
+    # usage IGCM_date_DaysBetweenJulianDate jul1 jul2
+    # where julian date is in the form yyyyddd
+    
+    usage () {
+	echo "Usage:"
+	echo " IGCM_date_DaysBetweenJulianDate jul1 jul2"
+	echo ""
+	echo " Calculates the day difference between"
+	echo " two julian dates (jul1 -jul2)"
+	echo " where a julian date is in the form of yyyyddd."
+    }
+ 
+    if [ $# -lt 2 ]; then
+	usage
+	IGCM_debug_Exit "IGCM_date_DaysBetweenJulianDate"
+    fi
+ 
+    # This process subtracts arg2 from arg1. If arg2 is larger
+    # then reverse the arguments. The calculations are done, and
+    # then the sign is reversed
+    if [ $1 -lt $2 ]
+ 	then
+ 	jul1=$2
+ 	jul2=$1
+    elif [ $1 -gt $2 ]
+	then
+ 	jul1=$1
+ 	jul2=$2
+    else
+	echo 0
+	IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate"
+	return
+    fi
+
+    # Break the dates in to year and day portions
+    yyyy1=$( expr $jul1 / 1000 )
+    yyyy2=$( expr $jul2 / 1000 )
+    ddd1=$( expr $jul1 \% 1000 )
+    ddd2=$( expr $jul2 \% 1000 )
+
+    # Subtract days
+    res=$( expr $ddd1 - $ddd2 )
+
+    # Then add days in year until year2 matches year1
+
+    if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then
+	res=$( expr \( \( $yyyy1 \- $yyyy2 \) \* 360 \) \+ $res )
+    elif [ "${config_UserChoices_CalendarType}" = "noleap" ] ; then
+	res=$( expr \( \( $yyyy1 \- $yyyy2 \) \* 365 \) \+ $res )
+    elif ( [ "${config_UserChoices_CalendarType}" = "leap" ] || [ "${config_UserChoices_CalendarType}" = "gregorian" ] ) ; then
+	while [ $yyyy2 -lt $yyyy1 ]
+	  do
+	  diy=$( IGCM_date_DaysInYear $yyyy2 )
+	  res=$( expr $res + $diy )
+	  yyyy2=$( expr $yyyy2 + 1 )
+	done
+    fi
+
+    # if argument 2 was larger than argument 1 then 
+    # the arguments were reversed before calculating
+    # adjust by reversing the sign
+    if [ $1 -lt $2 ]
+ 	then
+	res=$( expr $res \* -1 )
+    fi
+ 
+    # and output the results
+    echo $res
+
+    IGCM_debug_PopStack "IGCM_date_DaysBetweenJulianDate"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_DaysBetweenGregorianDate ()
+#D-* Purpose: Calculate the days difference between two dates and reports 
+#D-           the number days as grg1 - grg2 
+#D-* Usage: IGCM_date_DaysBetweenGregorianDate grg1 grg2
+#D-         where gregorian date is in the form yyyymmdd
+#D-
+function IGCM_date_DaysBetweenGregorianDate
+{
+    IGCM_debug_PushStack "IGCM_date_DaysBetweenGregorianDate" $@
+
+    # calculates the days difference between two dates and reports 
+    # the number days as grg1 - grg2 
+    # usage IGCM_date_DaysBetweenGregorianDate grg1 grg2
+    # where gregorian date is in the form yyyymmdd
+
+    usage () {
+ 	echo "Usage:"
+ 	echo " IGCM_date_DaysBetweenGregorianDate grg1 grg2"
+ 	echo ""
+ 	echo " Calculate day difference between"
+ 	echo " two gregorian dates (grg1 - grg2)"
+ 	echo " where a gregorian date is in the form of yyyymmdd."
+    }
+
+    if [ $# -lt 2 ]; then
+ 	usage
+	IGCM_debug_Exit "IGCM_date_DaysBetweenGregorianDate"
+    fi
+
+    # convert each date to julian
+    grg1=$1
+    grg2=$2
+
+    jul1=$( IGCM_date_ConvertGregorianDateToJulian $grg1 )
+    jul2=$( IGCM_date_ConvertGregorianDateToJulian $grg2 )
+
+    if [ $jul1 -ne $jul2 ]; then
+    # calculate the answer using IGCM_date_DaysBetweenJulianDate
+	res=$( IGCM_date_DaysBetweenJulianDate $jul1 $jul2 )
+    # and output the results
+	echo $res
+    else
+	echo 0
+    fi
+
+    IGCM_debug_PopStack "IGCM_date_DaysBetweenGregorianDate"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_DaysSinceJC ()
+#D-* Purpose: Calculate the days difference between a date and 00010101
+#D-* Usage: IGCM_date_DaysSinceJC grg1
+#D-         where gregorian date is in the form yyyymmdd
+#D-
+function IGCM_date_DaysSinceJC
+{
+    IGCM_debug_PushStack "IGCM_date_DaysSinceJC" $@
+
+    # calculates the days difference between a date and 00010101
+    # usage IGCM_date_DaysSinceJC grg1
+    # where gregorian date is in the form yyyymmdd
+
+    usage () {
+ 	echo "Usage:"
+ 	echo " IGCM_date_DaysSinceJC grg1"
+ 	echo ""
+ 	echo " Calculate day difference between"
+ 	echo " a gregorian date and 00010101"
+ 	echo " where a gregorian date is in the form of yyyymmdd."
+    }
+
+    if [ $# -lt 1 ]; then
+ 	usage
+	IGCM_debug_Exit "IGCM_date_DaysSinceJC"
+    fi
+    
+    typeset aux num
+
+    if   [ ${1} -lt  5000000 ]; then
+	case ${config_UserChoices_CalendarType} in
+	    360d) 
+		aux=-360;;
+	    noleap)
+		aux=-365;;
+	    leap) 
+		aux=-366;;
+	esac
+	num=101
+    elif [ ${1} -lt 15000000 ]; then
+        # To save CPU type we use auxiliary value
+        # which is number of days since JC and 10000101
+	case ${config_UserChoices_CalendarType} in
+	    360d) 
+		aux=359640;;
+	    noleap)
+		aux=364635;;
+	    leap) 
+		aux=364877;;
+	esac
+	num=10000101
+    else
+        # To save CPU type we use auxiliary value
+        # which is number of days since JC and 19000101
+	case ${config_UserChoices_CalendarType} in
+	    360d) 
+		aux=683640;;
+	    noleap)
+		aux=693135;;
+	    leap) 
+		aux=693595;;
+	esac
+	num=19000101
+    fi
+    echo $( expr \( $( IGCM_date_DaysBetweenGregorianDate $1 ${num} ) \+ $aux \) )
+
+    IGCM_debug_PopStack "IGCM_date_DaysSinceJC"
+}
+
+#D-#==================================================================
+#D-function IGCM_date_Check
+#D- * Purpose: Check the present file by comparison with a reference file
+function IGCM_date_Check
+{
+    IGCM_debug_PushStack "IGCM_date_Check"
+
+#---------------------
+    if [ ! -n "${libIGCM}" ] ; then
+	echo "Check libIGCM_date ...........................................[ FAILED ]"
+        echo "--Error--> libIGCM variable is not defined"
+	IGCM_debug_Exit "IGCM_date_Check"
+    fi
+
+#---------------------
+    whence -v awk > /dev/null 2>&1
+    if [ ! $? -eq 0 ] ; then
+	echo "Check libIGCM_date ...........................................[ FAILED ]"
+        echo "--Error--> awk command is not defined"
+	IGCM_debug_Exit "IGCM_date_Check"
+    fi
+
+#---------------------
+    ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh > IGCM_date_Test.ref.failed 2>&1
+    
+    if diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref > /dev/null 2>&1 ; then 
+	echo "Check libIGCM_date ...............................................[ OK ]"
+	rm -f IGCM_date_Test.ref.failed
+    else 
+	echo "Check libIGCM_date ...........................................[ FAILED ]"
+        echo "--Error--> Execution of ${libIGCM}/libIGCM_date/IGCM_date_Test.ksh"
+        echo "           has produced the file IGCM_date_Test.ref.failed"
+        echo "           Please analyse differences with the reference file by typing:"
+        echo "           diff IGCM_date_Test.ref.failed ${libIGCM}/libIGCM_date/IGCM_date_Test${dY}.ref"
+	echo "           Report errors to the author: Sebastien.Denvil@ipsl.jussieu.fr"
+	IGCM_debug_Exit "IGCM_date_Check"
+    fi
+
+#---------------------
+    IGCM_debug_PopStack "IGCM_date_Check"
+}
+
+#==================================================================
Index: /tags/libIGCM_v1_1/libIGCM_debug/IGCM_debug_Test.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_debug/IGCM_debug_Test.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_debug/IGCM_debug_Test.ksh	(revision 19)
@@ -0,0 +1,51 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Patrick Brockmann
+# Contact: Patrick.Brockmann@cea.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+# This script is used to generate a reference file with command :
+# IGCM_debug_Test.ksh > IGCM_debug_Test.ref 2>&1  
+# The reference file produced is used by the function IGCM_debug_Check
+# to verify that the libIGCM_debug produce the same results
+
+#=================================================
+libIGCM=`dirname $0`/..
+. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+
+#=================================================
+Verbosity=3
+
+Option1="Hello Earth"
+Option2="Hello Mars"
+
+List="${R_ENTREE}/flux_iceberg . ${R_ENTREE}/Albedo.nc ."
+
+#=================================================
+# function IGCM_debug_Print
+
+IGCM_debug_Print 1 ${Option1}
+IGCM_debug_Print 1 ${Option2}
+
+IGCM_debug_Print 2 "A comment at level 2"
+IGCM_debug_Print 3 "A comment at level 3" "Another comment at level 3"
+IGCM_debug_Print 1 "A comment at level 1"
+IGCM_debug_Print 3 "Another comment at level 3"
+IGCM_debug_Print 2 "Another comment at level 2"
+
+IGCM_debug_Print 1 ${List}
+
+#=================================================
+# function IGCM_debug_PrintVariables
+
+IGCM_debug_PrintVariables 1 Option
+
Index: /tags/libIGCM_v1_1/libIGCM_debug/IGCM_debug_Test.ref
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_debug/IGCM_debug_Test.ref	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_debug/IGCM_debug_Test.ref	(revision 19)
@@ -0,0 +1,18 @@
+--Debug1--> Hello
+--Debug1--> Earth
+--Debug1--> Hello
+--Debug1--> Mars
+--------Debug2--> A comment at level 2
+--------------Debug3--> A comment at level 3
+--------------Debug3--> Another comment at level 3
+--Debug1--> A comment at level 1
+--------------Debug3--> Another comment at level 3
+--------Debug2--> Another comment at level 2
+--Debug1--> /flux_iceberg
+--Debug1--> .
+--Debug1--> /Albedo.nc
+--Debug1--> .
+--Debug1--> Option1=Hello
+--Debug1--> Earth
+--Debug1--> Option2=Hello
+--Debug1--> Mars
Index: /tags/libIGCM_v1_1/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_debug/libIGCM_debug.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_debug/libIGCM_debug.ksh	(revision 19)
@@ -0,0 +1,298 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Patrick Brockmann, Martial Mancip
+# Contact: Patrick.Brockmann@cea.fr Martial.Mancip@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#==================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#==================================================
+
+#==================================================
+# Add high level verbosity
+typeset -i Verbosity=${Verbosity:=3}
+
+#==================================================
+# DEBUG_debug
+# Add low level verbosity
+typeset -r DEBUG_debug=${DEBUG_debug:=true}
+
+if ( $DEBUG_debug ) ; then
+    if [ -f stack ] ;
+    then
+	echo "Stack of an libIGCM job :" >> stack
+    else
+	echo "Stack of an libIGCM job :" >  stack
+    fi
+fi
+
+#==================================================
+# NULL_STR
+# Default null string
+typeset -r NULL_STR="_0_" 
+
+#==================================================
+# libIGCM_CurrentTag
+# Current libIGCM tag, check compatibilty with *.card
+typeset -r libIGCM_CurrentTag="1.0" 
+
+#==================================================
+# Exit Flag (internal debug)
+# When true, end the master loop AFTER SAVES FILES
+ExitFlag=false
+
+#==================================================
+# Declare a stack of functions calls
+
+# insert last argument of the Stack
+set +A IGCM_debug_Stack ${NULL_STR}
+set +A IGCM_debug_StackArgs ${NULL_STR}
+IGCM_debug_LenStack=0
+
+#D-#==================================================================
+#D-function IGCM_debug_CallStack
+#D-* Purpose: Echo the Stack
+#D-
+function IGCM_debug_CallStack {
+    echo
+    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!"
+    echo "!! IGCM_debug_CallStack !!"
+    echo "!------------------------!"
+    echo
+    if ( $DEBUG_debug ) ; then
+       # La pile d'appels est affichée de la plus vieille à la plus récente 
+       # (c'est donc l'inverse de la norme d'affichage).
+	typeset i decal
+	(( i=0 ))
+	until [ $i -eq ${IGCM_debug_LenStack} ]; do
+	    decal=0
+	    until [ $decal -eq ${i} ]; do
+		printf -- ' '
+		let $(( decal=decal+1 ))
+	    done
+	    echo "$i - ${IGCM_debug_Stack[$(( $IGCM_debug_LenStack-$i-1 ))]}"\
+		"(${IGCM_debug_StackArgs[$(( $IGCM_debug_LenStack-$i-1 ))]})"
+	    let $((i=i+1))
+	done
+    fi
+    echo "!------------------------!"
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_PushStack
+#D-* Purpose: Push a function name in the stack
+#D-
+function IGCM_debug_PushStack {
+    if ( $DEBUG_debug ) ; then
+       typeset decal
+       echo >> stack
+       decal=0
+       while [ $decal -lt ${IGCM_debug_LenStack} ]; do
+#          printf -- ' ' >> stack
+           printf ' ' >> stack
+           let $(( decal=decal+1 ))
+       done
+       echo "> ${IGCM_debug_LenStack} : ${@}" >> stack
+
+       # We add function call name on beginning of the stack
+       set +A IGCM_debug_Stack ${1} ${IGCM_debug_Stack[*]}
+
+       # We include the "null" Args in the beginning of the StackArgs
+       set +A IGCM_debug_StackArgs ${NULL_STR} ${IGCM_debug_StackArgs[*]} 
+       # Then, we shift StackArgs tabular
+       if [ $# -gt 1 ]; then 
+	   shift; 
+	   IGCM_debug_StackArgs=$(echo ${@} | sed -e "s/\ /,/g") >&2
+       fi
+       (( IGCM_debug_LenStack = IGCM_debug_LenStack + 1 ))
+
+       # If you want to print CallStack each time :
+       # IGCM_debug_CallStack
+    fi
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_PopStack
+#D-* Purpose: Pop a function name in the stack
+#D-
+function IGCM_debug_PopStack {
+    if ( ${ExitFlag} ) ; then
+	echo '!!! ExitFlag has been activated !!!' >> stack
+    fi
+    if ( $DEBUG_debug ) ; then
+	if [ "${IGCM_debug_Stack[0]}" = "${1}" ]; then
+	    let $(( IGCM_debug_LenStack = IGCM_debug_LenStack - 1 ))
+
+	    IGCM_debug_Stack[0]="" 
+	    IGCM_debug_StackArgs[0]=""
+	    
+	    set +A IGCM_debug_Stack ${IGCM_debug_Stack[*]}
+	    set +A IGCM_debug_StackArgs ${IGCM_debug_StackArgs[*]}
+	else
+	    echo 'IGCM_debug_Exit : stack is corrupted ! LenStack =' ${IGCM_debug_LenStack}
+	    IGCM_debug_Exit $@
+	fi
+	typeset decal=0
+	while [ $decal -lt ${IGCM_debug_LenStack} ]; do
+	  # printf -- ' ' >> stack
+	  printf ' ' >> stack
+ 	  (( decal=decal+1 ))
+	done
+      echo "< ${IGCM_debug_LenStack} : ${@}" >> stack
+
+      if [ ${IGCM_debug_LenStack} = 0 ]; then
+	  # Reset array only when necessary
+	  #echo
+	  #IGCM_debug_Print 3 "Clean stack array"
+	  #echo
+	  set -A IGCM_debug_Stack ${NULL_STR}
+	  set -A IGCM_debug_StackArgs ${NULL_STR}
+      fi
+
+    fi
+
+    #IGCM_debug_CallStack
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_Exit
+#D-* Purpose: Print Call Stack and set ExitFlag to true
+#D-
+function IGCM_debug_Exit {
+    IGCM_debug_PushStack "IGCM_debug_Exit"
+    echo "IGCM_debug_Exit : " "${@}"
+    IGCM_debug_CallStack
+    eval ExitFlag=true
+    IGCM_debug_PopStack "IGCM_debug_Exit"
+}
+
+#D-#==================================================
+#D-function IGCM_debug_Verif_Exit
+#D-* Purpose: exit with number 1 if ExitFlag is true
+#D-
+function IGCM_debug_Verif_Exit {
+    if ( ${ExitFlag} ) ; then
+	IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Fatal"
+	echo "IGCM_debug_Verif_Exit : Something wrong append."
+	echo "                        EXIT THE JOB."
+	IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
+	echo
+	if ( $DEBUG_debug ) ; then
+	    echo "Your files on ${R_OUT} :"
+	    IGCM_sys_Tree ${R_SAVE}
+	    echo
+	fi
+	date
+	exit 1
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_debug_Verif_Exit_Post
+#D-* Purpose: exit with number 1 if ExitFlag is true for Post-treatment
+#D-
+function IGCM_debug_Verif_Exit_Post {
+    if ( ${ExitFlag} ) ; then
+	#if [ ${StandAlone} = true ] ; then
+	#    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing PostState "Fatal"
+	#    IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
+	#else
+	#    IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing PostState "Fatal"
+	#fi
+	echo "IGCM_debug_Verif_Exit_Post : Something wrong append."
+	echo "                        EXIT THE JOB."
+	#echo "         BUT WE DO NOT EXIT THE JOB."
+	echo
+	date
+	exit 1
+    fi
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_Print
+#D-* Purpose: Print arguments according to a level of verbosity.
+#D-
+function IGCM_debug_Print
+{
+    typeset level=$1
+    shift
+
+    if [ ${level} -le ${Verbosity} ] ; then
+	typeset i
+	case "${level}" in
+	    1) for i in "$@" ; do
+		    echo "--Debug1-->" ${i}
+	      done ;; 
+	    2) for i in "$@" ; do
+		    echo "--------Debug2-->" ${i}
+	      done ;; 
+	    3) for i in "$@" ; do
+		    echo "--------------Debug3-->" ${i}
+	      done ;; 
+	esac
+    fi
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_PrintVariables
+#D-* Purpose: Print arguments when match a pattern
+#D-           according to a level of verbosity.
+function IGCM_debug_PrintVariables
+{
+    typeset level=$1
+    shift
+
+    if set | grep $1 | sed -e "s/'//g" > /dev/null 2>&1  ; then
+	typeset list=$( set | grep $1 | sed -e "s/'//g" )
+        IGCM_debug_Print ${level} ${list}
+    fi
+}
+
+#D-#==================================================================
+#D-function IGCM_debug_Check
+#D- * Purpose: Check the present file by comparison with a reference file
+function IGCM_debug_Check
+{
+    #---------------------
+    if [ ! -n "${libIGCM}" ] ; then
+        echo "Check libIGCM_debug ..........................................[ FAILED ]"
+        echo "--Error--> libIGCM variable is not defined"
+        exit 2
+    fi
+
+    #---------------------
+    if [ ! -n "${Verbosity}" ] ; then
+        echo "Check libIGCM_debug ..........................................[ FAILED ]"
+        echo "--Error--> Verbosity variable is not defined"
+        exit 3
+    fi
+
+    #---------------------
+    ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh > IGCM_debug_Test.ref.failed 2>&1
+    sleep 2
+
+    if diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref > /dev/null 2>&1 ; then
+        echo "Check libIGCM_debug ..............................................[ OK ]"
+        rm -f IGCM_debug_Test.ref.failed
+    else
+        echo "Check libIGCM_debug ..........................................[ FAILED ]"
+        echo "--Error--> Execution of ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ksh"
+        echo "           has produced the file IGCM_debug_Test.ref.failed"
+        echo "           Please analyse differences with the reference file by typing:"
+	echo "           diff IGCM_debug_Test.ref.failed ${libIGCM}/libIGCM_debug/IGCM_debug_Test.ref"
+	echo "           Report errors to the author: Patrick.Brockmann@cea.fr"
+        exit 4
+    fi
+    #---------------------
+}
Index: /tags/libIGCM_v1_1/libIGCM_post/IGCM_Patch_20070220_histcom_time_axis.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_post/IGCM_Patch_20070220_histcom_time_axis.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_post/IGCM_Patch_20070220_histcom_time_axis.ksh	(revision 19)
@@ -0,0 +1,73 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Martial Mancip
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+#
+#**************************************************************
+
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+# We keep only first time axis as time_counter !!!!
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+function IGCM_Patch_20070220_histcom_time_axis {
+    IGCM_debug_PushStack "IGCM_Patch_histcom_time_axis" $@
+
+    typeset file AXISt AXISt_i VARName var ATTN ATTNV VAR_AXISt VAR_AXISt_i
+
+    ncdump -h ${1} > ${1}_ncdump-h
+    set +A AXISt $(cat ${1}_ncdump-h | grep 't_ave_.*(time_counter)' | sed -e 's/[[:space:]]float t_ave_\([0-9]*\).*/\1/')
+    # liste => tous les axes de temps vont s'appeler time_counter !!
+    if [ $? -eq 0 ] ; then
+
+	file=t_$1
+	IGCM_sys_Mv ${1} ${file}
+	IGCM_sys_Chmod 644 ${file}
+
+	if [ ${#AXISt[*]} -gt 1 ] ; then
+	    echo "WARNING : for file ${1} we have more than one time axis !"
+	    echo "We choose first one ! = t_ave_${AXISt[0]}."
+	fi
+        #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+        # We keep only first time axis as time_counter !!!!
+        #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+	AXISt_i=${AXISt[0]}
+	# Rename time_counter variable
+	IGCM_sys_ncrename -O --hst -v t_ave_${AXISt_i},time_counter ${file}
+	ncdump -h ${file} > ${file}_ncdump-h
+
+	# We have also to rename variables indexed by this time value
+        # liste => pb avec deux variables indéxées par deux valeurs de temps différentes => même nom au final!
+	set +A VAR_AXISt $( cat ${file}_ncdump-h | grep "[[:space:]]*[a-z]* [a-zA-Z_]*${AXISt_i}(.*) ;" | sed -e "s/[[:space:]]*[a-z]* \([a-zA-Z_]*\)_${AXISt_i}(.*) ;/\1/" )
+	for VAR_AXISt_i in ${VAR_AXISt[*]} ; do
+	    IGCM_sys_ncrename -O --hst -v ${VAR_AXISt_i}_${AXISt_i},${VAR_AXISt_i} ${file}
+	done
+
+        # A-t-on besoin de renommer les attributs des autres variables ??
+	# Rename relative associate string in other variables
+
+	set +A VARName $( cat ${file}_ncdump-h | grep "[0-9a-zA-Z_]*.*:associate.*" | grep "t_ave_${AXISt_i}" | sed -e "s/[[:space:]]*\(.*\):associate.*/\1/" )
+	for var in ${VARName[*]} ; do 
+	    # Old attribute value
+	    ATTN=$( cat ${file}_ncdump-h | grep "${var}:associate.*" | grep "t_ave_${AXISt_i}" | sed -e "s/.*:associate = \"\(.*\)\" ;/\1/" )
+	    # New attribute value
+	    ATTNV=$( echo ${ATTN} | sed -e "s/t_ave_${AXISt_i}/time_counter/" ) #| sed -e 's/[[:space:]]/\\ /g')
+	    # change it !
+	    ${ncatted} -O --hst -a associate,${var},m,c,"${ATTNV}" ${file}
+	    # This is not an IGCM function because of a
+	    # Problem with ksh and string passed in this IGCM_sys_ncatted function to ncatted !
+	done
+	IGCM_debug_Verif_Exit_Post
+	IGCM_sys_Mv ${file} ${1}
+	IGCM_sys_Rm ${file}_ncdump-h
+    fi
+    IGCM_sys_Rm ${1}_ncdump-h
+    
+    IGCM_debug_PopStack "IGCM_Patch_histcom_time_axis"
+}
Index: /tags/libIGCM_v1_1/libIGCM_post/libIGCM_post.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_post/libIGCM_post.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_post/libIGCM_post.ksh	(revision 19)
@@ -0,0 +1,257 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Sebastien Denvil
+# Contact: Sebastien.Denvil@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=======================================================================
+function IGCM_post_Initialize
+{
+    IGCM_debug_PushStack "IGCM_post_Initialize"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_post_Initialize :"
+    echo
+
+    typeset POST NbDays PeriodEndJul PostEndJul LengthDays
+    POST=false
+
+    # READ TIME SERIES OR SEASONAL FREQUENCY
+    # AND TURN ON THE FLAG WHEN MODULO IS ZERO
+    for post_freq in RebuildFrequency TimeSeriesFrequency SeasonalFrequency ; do
+        #
+        # Initialize
+        #
+        eval ${post_freq}=false
+        #
+        # Define the variable ${config_Post_${post_freq}}
+        # who contains frequency for specific post-treatment
+        #
+        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${post_freq}
+        #
+        # Extract frequency from above variable
+        #
+        config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} )
+        #
+        if ( [ X${config_Post_post_freq} = X${NULL_STR} ] || [ X${config_Post_post_freq} = XNONE ] ) ; then
+          #
+          continue
+          #
+        fi
+        #
+        # For each componant select determine which files need post-processing
+        #
+        for comp in ${config_ListOfComponents[*]} ; do
+            #
+            #echo "-----"
+            eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
+            ListFilesName=${compname}_OutputFiles_List
+            eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+            #
+            if [ X${FileName0} != X${NULL_STR} ] ; then
+              #
+              #IGCM_debug_Print 1 "Component      : ${compname}"
+              #
+              # INITIALISATION
+              #
+              eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+              typeset i=0
+              #
+              until [ $i -eq $NbFiles ]; do
+                #
+                eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
+                eval file_in=${file_in_}
+                let $(( i_ = i+2 ))
+                eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+                eval flag_post=${flag_post_}
+                #
+                if [ X${flag_post} != XNONE ] ; then
+                  #
+                  # Initialize ${flag_post}_${compname}_${post_freq}
+                  #
+                  eval ${flag_post}_${compname}_${post_freq}=false
+                  #
+                  case ${config_Post_post_freq} in
+                    *y|*Y)
+                      PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" )
+		      case ${config_UserChoices_PeriodLength} in
+			1Y|1y)
+			  if [ $( expr ${CumulPeriod} % ${PeriodYear}  ) -eq 0 ] ;  then
+			     eval ${flag_post}_${compname}_${post_freq}=true
+			     eval ${post_freq}=true
+			     POST=true
+			  fi ;;
+                        1M|1m)
+			  if [ $( expr ${CumulPeriod} % $( expr ${PeriodYear} \* 12 ) ) -eq 0 ] ; then
+			     eval ${flag_post}_${compname}_${post_freq}=true
+			     eval ${post_freq}=true
+			     POST=true
+                          fi ;;
+                        *D|*d)
+                          LengthDays=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
+			  NbDays=$( IGCM_date_DaysInYear ${year} )
+			  if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then
+                             if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${LengthDays} \) ) ) -eq 0 ] ; then
+                                eval ${flag_post}_${compname}_${post_freq}=true
+                                eval ${post_freq}=true
+                                POST=true
+			     fi
+			  else
+			      if [ ${PeriodYear} -eq 1 ] ; then
+				PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
+				PostEndJul=${year}${NbDays}
+                                #echo "PeriodYear=${PeriodYear} Year ; NbDays${NbDays} PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
+				if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then
+				   eval ${flag_post}_${compname}_${post_freq}=true
+				   eval ${post_freq}=true
+				   POST=true
+				fi
+			      else
+				echo "For ${post_freq}, for ${comp} and ${file_in} :"
+				echo "We have a daily WriteFrequency and ${post_freq}=${PeriodYear}Y."
+				echo "No post-treatment."
+			      fi
+                            fi;;
+		      esac ;;
+		    1M|1m)
+                      case ${config_UserChoices_PeriodLength} in
+			1Y|1y)
+                          IGCM_debug_Print 3 "Frequency not allowed for TimeSeriesFrequency in ${flag_post}" ;;
+			1M|1m)
+                          eval ${flag_post}_${compname}_${post_freq}=true
+			  eval ${post_freq}=true
+			  POST=true;;
+                        *D|*d)
+                          NbDays=$( IGCM_date_DaysInMonth ${year} ${month} )
+                          PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
+                          PostEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${year}${month}${NbDays} )
+                          #echo "year_month=${year}_${month} Month ; NbDays${NbDays} PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
+			  if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then
+			    eval ${flag_post}_${compname}_${post_freq}=true
+			    eval ${post_freq}=true
+                            POST=true
+			  fi
+			  ;;
+		      esac
+                        ;;
+                    NONE|none)
+		      ;;
+		    *)
+		      IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card"
+		      ;;
+                  esac
+                fi
+                let $(( i=i+3 ))
+              done
+            fi
+        done
+    done
+    IGCM_debug_Print 1 "POST-TREATEMENT flag value : ${POST}"
+    [ ${POST} = true ] && IGCM_post_Submit
+
+    IGCM_debug_PopStack "IGCM_post_Initialize"
+}
+
+function IGCM_post_Submit
+{
+    IGCM_debug_PushStack "IGCM_post_Submit"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_post_Submit :"
+    echo
+
+    typeset comp
+
+    POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    echo "POST_DIR = ${POST_DIR}"
+
+    #============== REBUILD POST-TREATMENT =============#
+    if [ ${RebuildFrequency} = true ] ; then
+        #
+        IGCM_debug_Print 2 "REBUILD POST-TREATMENT :"
+        echo
+        #
+        # BUILD A PACKED LIST FOR POST-TREATMENT JOB
+        # BECAUSE IT'S NOT POSSIBLE TO DEFINE DYNAMICAL
+        # VARIABLE NAME THROUGHT RSH !!
+        #
+        LISTE_PACK=" "
+        #
+    fi
+
+    #============ TIME SERIES POST-TREATMENT ===========#
+    if [ ${TimeSeriesFrequency} = true ] ; then
+
+        IGCM_debug_Print 2 "TIME SERIES POST-TREATMENT :"
+        echo
+        #
+        typeset listVarEnv
+        listVarEnv="MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
+        IGCM_sys_RshPost <<-EOF
+        export MODIPSL=${MODIPSL}
+	export libIGCM_SX=${libIGCM}
+        export libIGCM=${libIGCM_POST}
+        export SUBMIT_DIR=${SUBMIT_DIR}
+        export POST_DIR=${POST_DIR}
+        export DateBegin=${DateBegin}
+        export PeriodDateEnd=${PeriodDateEnd}
+        export StandAlone=false
+        export RESOL_ATM=${RESOL_ATM}
+        export RESOL_OCE=${RESOL_OCE}
+        export RESOL_ICE=${RESOL_ICE}
+        export RESOL_SRF=${RESOL_SRF}
+        export listVarEnv=${listVarEnv}
+        . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
+        . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+        IGCM_sys_MkdirWork ${POST_DIR}
+        IGCM_debug_Verif_Exit
+        IGCM_sys_QsubPost create_ts
+EOF
+    fi
+
+    #=============  SEASONAL POST-TREATMENT ============#
+    if [ ${SeasonalFrequency} = true ] ; then
+        #
+        IGCM_debug_Print 2 "SEASONNAL POST-TREATMENT :"
+        echo
+        #
+        typeset listVarEnv
+	listVarEnv="MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
+        IGCM_sys_RshPost <<-EOF
+        export MODIPSL=${MODIPSL}
+        export SUBMIT_DIR=${SUBMIT_DIR}
+	export libIGCM_SX=${libIGCM}
+        export libIGCM=${libIGCM_POST}
+        export SUBMIT_DIR=${SUBMIT_DIR}
+        export POST_DIR=${POST_DIR}
+        export DateBegin=${DateBegin}
+	export PeriodDateEnd=${PeriodDateEnd}
+        export StandAlone=false
+        export RESOL_ATM=${RESOL_ATM}
+        export RESOL_OCE=${RESOL_OCE}
+        export RESOL_ICE=${RESOL_ICE}
+        export RESOL_SRF=${RESOL_SRF}
+        export listVarEnv=${listVarEnv}
+        . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
+        . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+        IGCM_sys_MkdirWork ${POST_DIR}
+        IGCM_debug_Verif_Exit
+        IGCM_sys_QsubPost create_se
+EOF
+    fi
+
+    IGCM_debug_PopStack "IGCM_post_Submit"
+}
+
+
Index: /tags/libIGCM_v1_1/libIGCM_sys/IGCM_add_out.awk
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/IGCM_add_out.awk	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/IGCM_add_out.awk	(revision 19)
@@ -0,0 +1,312 @@
+#!/usr/bin/awk -f
+# IGCM_add_out - filter of output of the job :
+# command :
+# IGCM_add_out.awk job_output.out REALTIME USERTIME SYSTIME
+
+#**************************************************************
+# Author: Martial.Mancip
+# Contact: Martial.Mancip@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#==========================
+function myprint(str) {
+  if (debug) {
+     print str
+  }
+}
+
+
+#==========================
+BEGIN {
+#  print "traitement de " ARGV[1]
+
+  nbarg=ARGC
+  if (match(ARGV[1],"-d")) {
+    debug=1
+    file=ARGV[2]
+    delete ARGV[1] 
+    nbarg--
+  } else {
+    debug=0
+    file=ARGV[1]
+  }
+
+# When exit statement, 'END' rule is always executed, so defined a exit_value to manage this
+  exit_value=0
+  if (nbarg != 2) {
+    print "Usage: IGCM_add_out.awk [-d] file.output" 
+    print 
+    print "Args:"
+    print "      file.output = output file of at Job to be parsed" 
+    print 
+    print "Options:" 
+    print "       -d = debug mode" 
+    print 
+    exit_value=1
+    exit
+  }
+
+  Information_found=0
+
+  RealTime=0.
+  UserTime=-1.
+  SysTime=0.
+  VectorTime=0.
+  InstCount=0.
+  VInstCount=0.
+  VElementCount=0.
+  FLOPCount=0.
+  MOPS=0.
+  MFLOPS=0.
+  AVLength=0.
+  VOpRatio=0.
+  MemorySize=0.
+  MIPS=0.
+  ICache=0.
+  OCache=0.
+  Bank=0.
+
+  counter=0
+#  StartTime=[]
+#  EndTime=[]
+  Date_found=0
+
+
+#   print ENVIRON["LC_ALL"]
+#   ENVIRON["LC_ALL"]="fr_FR"
+#   print ENVIRON["LC_ALL"]
+}
+
+#==========================
+{
+  myprint($0) 
+
+# Get information with MPI Program Information output on NEC
+  if (match($0, "     \\*\\*\\*\\*\\*\\*  Program Information  \\*\\*\\*\\*\\*\\*")) 
+  {
+    Information_found=1
+    counter=counter+1
+#   print $0      
+#    print counter
+    next
+  }
+  else if (Information_found == 1 && (match($0, ".*:.*"))) 
+  {
+    where=(match($0,"[a-zA-Z]"))
+    Length=(match($0, " *:"))-where
+    whereDot=(match($0, ":"))
+    info=substr($0,where,Length)
+    whereNum=(match($0, "[0-9]"))
+    Res=substr($0,whereNum)
+#    print where "," Length "," whereDot "," whereNum " '" info "' :" Res 
+
+    if( info=="Real Time (sec)" ) {
+#      print "|" Res "|"
+#      printf("RealTime = %10.5f\n",0.037600)
+#      printf("RealTime = %10.5f\n",Res)
+      if ( Res > RealTime ) {
+	RealTime=Res
+      }
+      next
+    }
+    	  
+    if( info=="User Time (sec)" ) {
+      UserTime=UserTime+Res
+      next
+    }
+
+    if( info=="Sys  Time (sec)" ) {
+      SysTime=SysTime+Res
+      next
+    }
+
+    if( info=="Vector Time (sec)" ) {
+      VectorTime=VectorTime+Res
+      next  
+    }
+
+    if( info=="Inst. Count" ) {
+      InstCount=InstCount+Res
+      next
+    }
+
+    if( info=="V. Element Count" ) {
+      VInstCount=VInstCount+Res
+      next  
+    }
+
+    if( info=="V. Element Count" ) {
+      VElementCount=VElementCount+Res
+      next
+    }
+
+    if( info=="FLOP Count" ) {
+      FLOPCount=FLOPCount+Res
+      next  
+    }
+
+    if( info=="MOPS" ) {
+      MOPS=MOPS+Res
+      next
+    }
+
+    if( info=="MFLOPS" ) {
+      MFLOPS=MFLOPS+Res
+      next  
+    }
+
+    if( info=="A.V. Length" ) {
+      AVLength=AVLength+Res
+      next
+    }
+
+    if( info=="V. Op. Ratio (%)" ) {
+      VOpRatio=VOpRatio+Res
+      next  
+    }
+
+    if( info=="Memory Size (MB)" ) {
+      MemorySize=MemorySize+Res
+      next
+    }
+
+    if( info=="MIPS" ) {
+      MIPS=MIPS+Res
+      next  
+    }
+
+    if( info=="I-Cache (sec)" ) {
+      ICache=ICache+Res
+      next
+    }
+
+    if( info=="O-Cache (sec)" ) {
+      OCache=OCache+Res
+      next  
+    }
+
+    if( info=="Bank (sec)" ) {
+      Bank=Bank+Res
+      next
+    }
+
+    if( info=="Start Time (date)" ) {
+      StartTime[counter]=Res
+      next  
+    }
+
+    if( info=="End   Time (date)" ) {
+      EndTime[counter]=Res
+      Information_found=0
+      next
+    }
+
+  }
+# Get information with time output on other hosts
+# ksh time
+  else if (match($0, ".*s real .*s user .*s system"))
+  {
+    myprint( "ksh" )
+    counter=counter+1
+
+    RealTime=(substr($1,1,match($1, "s")-1))
+    UserTime=(substr($3,1,match($3, "s")-1))
+    SysTime=(substr($5,1,match($5, "s")-1))
+
+  }
+# csh time
+  else if (match($0, "[0-9.]+u [0-9.]+s .+"))
+  {
+    myprint( "csh" )
+    counter=counter+1
+
+    UserTime=(substr($1,1,match($1, "u")-1))
+    SysTime=(substr($2,1,match($2, "s")-1))
+    RealTime=(substr($3,1,match($3, ":")-1)*60. + substr($3,match($3, ":")+1))
+
+  }
+# linux system time
+  else if (match($0, ".*user .*system .*elapsed .*CPU .*"))
+  {
+    myprint( "linux" )
+    counter=counter+1
+
+    UserTime=(substr($1,1,match($1, "user")-1))
+    SysTime=(substr($2,1,match($2, "system")-1))
+    RealTime=(substr($3,1,match($3, ":")-1)*60.+substr($3, match($3, ":")+1, match($3, "elapsed")))
+
+  }
+# date end
+# date begin
+  else if (Date_found == 0 && (match($0, "[a-z]+ *[a-z]+ *[0-9]+ *[0-9][0-9]:[0-9][0-9]:[0-9][0-9] *CET *[0-9]+")))
+  {
+    myprint( "start date" )
+
+    Date_found=1
+    StartTime[counter]=$0
+
+  }
+  else if (Date_found == 1 && (match($0, "[a-z]+ *[a-z]+ *[0-9]+ *[0-9][0-9]:[0-9][0-9]:[0-9][0-9] *CET *[0-9]+")))
+  {
+    myprint( "end date" )
+
+    EndTime[counter]=$0
+
+    exit
+
+  }
+
+}
+
+#==========================
+END {
+
+  if (! exit_value ) {
+    if (counter > 0) { 
+      myprint("=============================================")
+      myprint("Additionnal results on Program Informations for " ARGV[1])
+      myprint("Real Time (sec)        :" RealTime)
+      myprint("User Time (sec)        :" UserTime)
+      myprint("Sys  Time (sec)        :" SysTime)
+      myprint("Vector Time (sec)      :" VectorTime)
+      myprint("Inst. Count            :" InstCount)
+      myprint("V. Inst. Count         :" VInstCount)
+      myprint("V. Element Count       :" VElementCount)
+      myprint("FLOP Count             :" FLOPCount)
+      myprint("MOPS                   :" MOPS)
+      myprint("MFLOPS                 :" MFLOPS)
+      myprint("A.V. Length            :" AVLength)
+      myprint("V. Op. Ratio (%)       :" VOpRatio)
+      myprint("Memory Size (MB)       :" MemorySize)
+      myprint("MIPS                   :" MIPS)
+      myprint("I-Cache (sec)          :" ICache)
+      myprint("O-Cache (sec)          :" OCache)
+      myprint("Bank (sec)             :" Bank)
+
+      myprint("Date of executables :")
+      for (i=1; i<=counter; i++) {  
+        myprint("Start Time (date)      :" StartTime[i])
+        myprint("End   Time (date)      :" EndTime[i])
+      }
+      printf("%s , %s , %.5f , %.5f , %.5f", StartTime[counter], EndTime[counter], RealTime, UserTime, SysTime) 
+      exit(0)
+    }
+    else
+    { 
+      exit(1)
+    }
+  }
+  else
+  { 
+    exit(2)
+  }
+  
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/IGCM_analyse_rsync_out.awk
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/IGCM_analyse_rsync_out.awk	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/IGCM_analyse_rsync_out.awk	(revision 19)
@@ -0,0 +1,123 @@
+#!/usr/bin/awk -f 
+# IGCM_analyse_rsync_out - filter rsync output in a job output :
+# command :
+# IGCM_analyse_rsync_out.awk [-d] job_output.out
+
+
+#**************************************************************
+# Author: Martial.Mancip
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#==========================
+function myprint(str) {
+  if (debug) {
+     print str
+  }
+}
+
+
+#==========================
+BEGIN {
+#  print "traitement de " ARGV[1]
+
+  nbarg=ARGC
+
+  if (match(ARGV[1],"-d")) {
+    debug=1
+    file=ARGV[2]
+    delete ARGV[1] 
+    nbarg--
+  } else {
+    debug=0
+    file=ARGV[1]
+  }
+
+  exit_value=0
+  if (nbarg != 2) {
+        print "Usage: analyse_rsync_out.awk [-d] file"
+        exit_value=-1
+        exit
+  }
+    
+  rsync_found=0
+  speedup_found=0
+  counter=0
+  thisfile[1]=""
+  errcounter=0
+  errorfile[1]=""
+}
+
+#==========================
+{
+
+  myprint($0) 
+
+  if (rsync_found == 0 && match($0, ".*/rsync .*")) {
+    speedup_found = 0
+    rsync_found=1
+    counter=counter+1
+
+    nb=split($0,felts, " ")
+    myprint("nb  :" nb)
+    for (elt in felts) {
+	myprint(elt "- elt  :" felts[elt])
+    }
+    myprint("elts_split  :" felts[4])
+
+    thisfile[counter]=felts[4]
+  }
+  else if (rsync_found == 1 && match($0, ".* speedup is .*")) {
+    myprint("speedup_found = 1")
+    speedup_found = 1
+  }
+  else if (speedup_found == 1 && match($0, "rsync error:.*")) {
+    errcounter=errcounter+1
+    errorfile[errcounter]=thisfile[counter]
+    myprint("=============================================")
+    myprint("WARNING : Rsync ERROR for " ARGV[1])
+    myprint("counter  :" counter)
+    myprint("file  :" thisfile[counter])
+    thisfile[counter]=""
+    counter=counter-1
+  } 
+  else {
+    if ( speedup_found == 1 ) {
+      rsync_found=0
+      speedup_found=0
+    }
+  }
+}
+
+#==========================
+END {
+  if ( exit_value != -1 ) {
+
+    myprint("=============================================")
+    myprint("Rsync for " ARGV[1])
+    myprint("counter  :" counter)
+    for (i=1; i<=counter; i++) {  
+      myprint("file  :" thisfile[i])
+    }
+    if (errcounter > 0) {
+      debug=1
+      myprint("Error counter  :" errcounter)
+      for (i=1; i<=errcounter; i++) {  
+        myprint("Error file  :" errorfile[i])
+      }
+      exit_value=errcounter
+      print exit_value
+      exit exit_value
+    } 
+    exit_value=0
+    exit 0
+  }
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys.ksh	(revision 19)
@@ -0,0 +1,61 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Martial Mancip
+# Contact: Martial.Mancip@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+# bypass specific internationalization (for awk)
+export LC_ALL="C"
+
+case $( hostname -s ) in
+
+    brodie*) 
+	echo "sys source brodie lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_brodie.ksh;;
+
+    zahir*)
+        echo "sys source zahir lib."
+        . ${libIGCM}/libIGCM_sys/libIGCM_sys_zahir.ksh;;
+
+    rhodes)
+        echo "sys source rhodes lib."
+        . ${libIGCM}/libIGCM_sys/libIGCM_sys_rhodes.ksh;;
+
+    mercure??) 
+	echo "sys source mercure Nec lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_mercure.ksh;;
+
+    mercure) 
+	echo "sys source mercure TX lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_mercureTX.ksh;;
+
+    claude|nougaro|ghio|grebil|robin) 
+	echo "sys source LMD lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_claude.ksh;;
+
+    calculo) 
+	echo "sys source calculo lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_calculo.ksh;;
+
+    platine*)
+	echo "sys source platine lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_platine.ksh;;
+
+    obelix*) 
+	echo "sys source obelix lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_obelix.ksh;;
+
+    *)       
+	echo "sys source default lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_default.ksh;;
+
+esac
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_brodie.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_brodie.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_brodie.ksh	(revision 19)
@@ -0,0 +1,1005 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Sébastien Denvil
+# Contact: sebastien.denvil.@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+
+#D-#=================================================
+#D-LibIGCM_sys for Brodie
+#D-#=================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D-environment variables and shell commands.
+#D-All those definitions depend on host particularities.
+#D-It manages a stack mechanism and test validity of operations.
+#D-All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#====================================================
+# set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+# Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/home/rech/ces/rces452/RSYNC_SX8/bin/rsync
+# RSYNC_opt args to "local rsync"
+typeset -r RSYNC_FRONT="rsh rhodes /usr/bin/rsync "
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-va"
+# RSYNC_opt args to "remote rsync"
+# ie storage filesystem
+typeset -r RHOST=gaya.idris.fr
+typeset -r REMOTE_RSYNC=/u/rech/ces/rces452/RSYNC/bin/rsync
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=$( rsh gaya -n env | grep PWD | awk "-F=" '{print $2}' )
+
+#====================================================
+#- Mirror libIGCM from brodie to rhodes 
+typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=/u/rech/psl/rpsl035/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- OUT_POST 
+typeset -r R_OUT_POST=$( rsh rhodes -n echo $WORKDIR | awk "-F=" "{print $2}" )/IGCM_OUT 
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"}
+
+#D-#==================================================
+#D-function IGCM_sys_RshArchive
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshArchive :" $@
+    fi
+    rsh gaya exec /bin/ksh ${@}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    rsh rhodes exec /bin/ksh ${@}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    rsh gaya -n mkdir -p $1
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_MkdirArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+#IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+#echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    TEST=$( rsh gaya -n "[ -d $1 ] && echo 1 || echo 0" )
+    if [ ${TEST} -ne 1 ] ; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    typeset RET 
+
+    mfls ${1} | grep ${1} > /dev/null 2>&1
+    RET=$?
+    if [ ${RET} -gt 0 ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \mfls -r $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Qsub
+#D-* Purpose: Qsub new job
+#D-* Examples:
+#D-
+function IGCM_sys_Qsub {
+    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Qsub :" $@
+    fi
+    /usr/bin/nqsII/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@."
+	IGCM_debug_Exit "IGCM_sys_Qsub"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Qsub"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    /usr/bin/nqsII/qsub -q scalaire -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM_POST}/$1.job -v ${listVarEnv}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur " $@
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+
+#D-#==================================================
+#D-function IGCM_sys_Miror_libIGCM
+#D-* Purpose: Mirror libIGCM PATH and lib to rhodes
+#D-* Examples:
+#D-
+function IGCM_sys_Mirror_libIGCM {
+    IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mirror_libIGCM"
+    fi
+
+    typeset RET DEST
+
+    IGCM_sys_RshPost <<-EOF
+    mkdir -p ${PATHlibIGCM}
+EOF
+    rsh rhodes -n hostname > /dev/null 2>&1
+    RET=$?
+    if [ $RET -eq 0 ] ; then
+# 	echo rcp -r ${libIGCM} rhodes:${HOME}/${PATHlibIGCM} > out_rsync 2>&1
+# 	rcp -r ${libIGCM} rhodes:${HOME}/${PATHlibIGCM} >> out_rsync 2>&1
+	echo ${RSYNC} ${RSYNC_opt} -e "rsh " --rsync-path=${REMOTE_RSYNC} ${libIGCM} rhodes:${HOME}/${PATHlibIGCM} > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} -e "rsh " --rsync-path=${REMOTE_RSYNC} ${libIGCM} rhodes:${HOME}/${PATHlibIGCM} >> out_rsync 2>&1
+	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on rhodes."
+	    cat out_rsync
+	fi
+    else
+	echo "No POST-TREATMENT avaible because rhodes is down."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+}
+
+#====================================================
+#- Call IGCM_sys_Mirror_libIGCM now !
+PATHlibIGCM=$( echo ${libIGCM} | awk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+if ( $MirrorlibIGCM ) ; then
+    IGCM_sys_Mirror_libIGCM
+fi
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${HOME}/${PATHlibIGCM}/libIGCM
+
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp $@ > out_rsync 2>&1
+    \cp $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Rest
+#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Rest {
+    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Rest :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+	# Only if we use rsync
+	#IGCM_sys_MkdirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	mfput $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+	
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Rest : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+	# Only if we use rsync
+	#IGCM_sys_MkdirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	mfput $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    dm_liste=${1}
+	fi
+	eval DEST=\${${#}}
+
+        # test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    return
+        fi
+
+	# SD : dm_liste is not suited for computing job
+	#      because we change filename during transfert
+	#      dm_liste is better suited for post-treatment
+	#dm_liste=" "
+  	#(( ifile=1 ))
+	#while [ $ifile -lt $# ] ; do
+	#    dm_liste=$( eval echo ${dm_liste} " "\${${ifile}} )
+	#    (( ifile = ifile + 1 ))
+	#done
+	#DEST=$( eval echo \${${#}} )
+
+	#USUAL WAY
+	mfget ${dm_liste[*]} ${DEST} > out_rsync 2>&1
+	#mfget $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+# 	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+##############################################################
+# REBUILD OPERATOR
+
+function IGCM_sys_rebuild {
+    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_rebuild :" $@
+    fi
+    /home/rech/psl/rpsl035/SX/bin/rebuild -f -o $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_rebuild : erreur ${@}."
+       IGCM_debug_Exit "rebuild"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_rebuild"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables "
+    fi
+
+# --------------------------------------------------------------------
+#D- MPI specifications
+# --------------------------------------------------------------------
+
+#D-- MPISUSPEND
+    export MPISUSPEND=ON
+#D-- MPIPROGINF
+    export MPIPROGINF=ALL
+
+# --------------------------------------------------------------------
+#D- Other specifications
+# --------------------------------------------------------------------
+
+#D- max number of character/line in output job
+    export F_SYSLEN=5000
+#D- number of error that can be admitted on the NEC
+    export F_ERRCNT=0
+#D- global performance
+    export F_PROGINF=DETAIL
+#D- activate ftrace (with -ftrace)
+    export F_FTRACE=YES
+#D- communication information (with -ftrace)
+    export MPICOMMINF=ALL
+#D- I/O performance (FORTRAN I/O only not netCDF)
+    export F_FILEINF=NO
+# netCDF I/O performance
+    export NC_FILEINF=NO    
+
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables "
+    fi
+# --------------------------------------------------------------------
+#D- MPI specifications
+# --------------------------------------------------------------------
+
+#D-- MPIPROGINF
+    export MPIPROGINF=NO
+
+# --------------------------------------------------------------------
+#D- Other specifications
+# --------------------------------------------------------------------
+
+#D- global performance
+    export F_PROGINF=NO  
+
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+  
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file " $@
+    fi
+    (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 ))
+    (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
+    (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
+    
+    if [ $1 = MPI2 ]; then
+	cat <<EOF > run_file
+-p 1 -np 1 -e ./oasis
+EOF
+	(( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 ))
+	config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"'
+
+    elif [ $1 = MPI1 ]; then
+	cat <<EOF > run_file
+-p $NUM_PROC_OASIS -e ./oasis
+-p $NUM_PROC_ATM -e ./lmdz.x
+-p $NUM_PROC_OCE -e ./opa.xx
+EOF
+ 
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+  
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_calculo.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_calculo.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_calculo.ksh	(revision 19)
@@ -0,0 +1,1217 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+ 
+#D-#==================================================
+#D-LibIGCM_sys for IPSL calculo
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D- environment variables and shell commands.
+#D- All those definitions depend on host particularities.
+#D- It manages a stack mechanism and test validity of operations.
+#D- All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#====================================================
+#set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+#Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/usr/bin/rsync  
+#RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-Lt -v"
+
+#====================================================
+# Source Ferret
+. /usr/local/ferret/ferret_paths_ksh
+. /home/brocksce/.atlas_env_calcul_ksh
+
+export FER_DATA="$FER_DATA /home/mc2ipsl/temp_local/grids"
+
+#=========================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- SCRATCHDIR (=> ${R_DONNEES})
+typeset -r SCRATCHDIR=/home/${LOGIN}/TEMP_LOCAL
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=/home
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=${ARCHIVE}/${LOGIN}/TEMP_LOCAL/SCRIPTS}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/${LOGIN}/TEMP_LOCAL/SCRIPTS/IGCM_OUT
+
+#====================================================
+#- OUT_POST
+typeset -r R_OUT_POST=${SCRATCHDIR}
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$}
+
+#=========================================================
+#- Add "time" before mpirun command
+MPIRUN_COMMAND="time "${MPIRUN_COMMAND}
+echo ${MPIRUN_COMMAND}
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+    ssh ${HOST} /bin/ksh  <<-EOF
+    export libIGCM=${libIGCM}
+    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+    ${@}
+EOF
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshMaster : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshMaster"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+(( RshPNum = 0 ))
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    #ssh ${HOST} exec /bin/ksh -vx $@ > out_RshPost.${RshPNum}
+    ssh ${HOST} exec /bin/ksh $@ > out_RshPost.${RshPNum}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    (( RshPNum = RshPNum + 1 ))
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirArchive : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    if [ ! -f ${1} ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    /home/mmaipsl/BIN/tree -f $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar cvf $@
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    \tar tvf $1
+
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Qsub
+#D-* Purpose: Qsub new job
+#D-* Examples:
+#D-
+function IGCM_sys_Qsub {
+    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Qsub :" $@
+    fi
+    echo "ssh -l ${LOGIN} ${HOST} ""cd ${SUBMIT_DIR} ; ${@}"" > ${Script_Output} 2>&1 &"
+    ssh -l ${LOGIN} ${HOST} "cd ${SUBMIT_DIR} ; ${@}" > ${Script_Output} 2>&1 &
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur."
+	IGCM_debug_Exit "IGCM_sys_Qsub"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Qsub"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    #echo "ssh -x -l ${LOGIN} ${HOST} ${3} > ${2} 2>&1 &"
+    #    ssh -x -l ${LOGIN} ${HOST} 
+    echo "${3} > ${2} 2>&1 &"
+    ${3} > ${2} 2>&1 &
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples:  IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp --preserve=timestamps $@ > out_rsync 2>&1
+    \cp --preserve=timestamps $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rm : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dir
+#D-* Purpose: Copy a complete directory on $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	#
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Dir
+#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Master
+#D-* Purpose: Copy a complete directory from MASTER filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Master {
+    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Master :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Master : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Master"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Rest
+#D-* Purpose: commande de transfert des restarts $(ARCHIVE).
+#D-           Quitte si le fichier ou si le répertoire d'arriver n'existe pas.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Rest {
+    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Rest :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+
+	IGCM_sys_TestDirArchive $( dirname $2 )
+
+	if [ ! -f ${1} ] ; then
+	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+	IGCM_sys_Chmod 444 ${1}
+
+	typeset RET
+
+	echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
+	RET=$?
+	IGCM_sys_Rsync_out $RET
+
+	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Rest : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ -f ${1} ] ; then
+	    if [ ! -d $( dirname $2 ) ] ; then
+		IGCM_sys_MkdirArchive $( dirname $2 )
+	    fi
+	else
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+
+	echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
+	RET=$?
+	IGCM_sys_Rsync_out $RET
+
+	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    dm_liste=${1}
+	fi
+	eval DEST=\${${#}}
+
+	# test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    return
+	fi
+
+	(( RET=0 ))
+        for target in ${dm_liste[*]} ; do
+	  ln -s ${target} ${DEST} >> out_rsync 2>&1
+          (( RET=RET+$? ))
+	done
+
+#       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1
+# 	RET=$?
+# 	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dods
+#D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dods {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dods :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dods ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+	    return
+	fi
+	#DO NOTHING
+    else
+	IGCM_err "DRYRUN mode = " $DRYRUN
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+
+##############################################################
+# REBUILD OPERATOR
+
+function IGCM_sys_rebuild {
+    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_rebuild :" $@
+    fi
+    /home/mmaipsl/TEMP_LOCAL/PARALLEL/modipsl/bin/rebuild -f -o $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_rebuild : erreur ${@}."
+       IGCM_debug_Exit "rebuild"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_rebuild"
+}
+
+##############################################################
+# NCO OPERATOR
+
+function IGCM_sys_ncap {
+    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncap :" $@
+    fi
+    /usr/local/bin/ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=/usr/local/bin/ncatted
+# Problem with ksh and string passed in this function to ncatted !
+# function IGCM_sys_ncatted {
+#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+#     if ( $DEBUG_sys ) ; then
+# 	echo "IGCM_sys_ncatted :" $@
+#     fi
+#     /usr/local/bin/ncatted $@
+#     if [ $? -gt 0 ] ; then
+#        echo "IGCM_sys_ncatted : erreur ${@}."
+#        IGCM_debug_Exit "ncatted"
+#     fi
+
+#     IGCM_debug_PopStack "IGCM_sys_ncatted"
+# }
+
+function IGCM_sys_ncbo {
+    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncbo :" $@
+    fi
+    /usr/local/bin/ncbo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncbo : erreur ${@}."
+#       IGCM_debug_Exit "ncbo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncbo"
+}
+
+function IGCM_sys_ncdiff {
+    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncdiff :" $@
+    fi
+    /usr/local/bin/ncdiff $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncdiff : erreur ${@}."
+#       IGCM_debug_Exit "ncdiff"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+}
+
+function IGCM_sys_ncea {
+    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncea :" $@
+    fi
+    /usr/local/bin/ncea $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncea : erreur ${@}."
+#       IGCM_debug_Exit "ncea"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncea"
+}
+
+function IGCM_sys_ncecat {
+    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncecat :" $@
+    fi
+    /usr/local/bin/ncecat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncecat : erreur ${@}."
+#       IGCM_debug_Exit "ncecat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncecat"
+}
+
+function IGCM_sys_ncflint {
+    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncflint :" $@
+    fi
+    /usr/local/bin/ncflint $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncflint : erreur ${@}."
+#       IGCM_debug_Exit "ncflint"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncflint"
+}
+
+function IGCM_sys_ncks {
+    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncks :" $@
+    fi
+    /usr/local/bin/ncks $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncks : erreur ${@}."
+#       IGCM_debug_Exit "ncks"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncks"
+}
+
+function IGCM_sys_ncpdq {
+    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncpdq :" $@
+    fi
+    /usr/local/bin/ncpdq $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncpdq : erreur ${@}."
+#       IGCM_debug_Exit "ncpdq"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+}
+
+function IGCM_sys_ncra {
+    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncra :" $@
+    fi
+    /usr/local/bin/ncra $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncra : erreur ${@}."
+#       IGCM_debug_Exit "ncra"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncra"
+}
+
+function IGCM_sys_ncrcat {
+    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrcat :" $@
+    fi
+    /usr/local/bin/ncrcat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrcat : erreur ${@}."
+#       IGCM_debug_Exit "ncrcat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+}
+
+function IGCM_sys_ncrename {
+    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrename :" $@
+    fi
+    /usr/local/bin/ncrename $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrename : erreur ${@}."
+#       IGCM_debug_Exit "ncrename"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrename"
+}
+
+function IGCM_sys_ncwa {
+    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncwa :" $@
+    fi
+    /usr/local/bin/ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+#       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables "
+    fi
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables "
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file "
+    fi
+    IGCM_debug_PopStack "IGCM_sys_build_run_file "
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_claude.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_claude.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_claude.ksh	(revision 19)
@@ -0,0 +1,1215 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+ 
+#D-#==================================================
+#D-LibIGCM_sys for claude and other LMD computers
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D- environment variables and shell commands.
+#D- All those definitions depend on host particularities.
+#D- It manages a stack mechanism and test validity of operations.
+#D- All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#====================================================
+#set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+#Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/usr/bin/rsync  
+#RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-Lt -v"
+
+#====================================================
+# Source Ferret
+#. /home/${LOGIN}/.atlas_env_${HOST}_ksh
+export FER_ATLAS /usr/local/atlas
+export FER_GO "$FER_GO $FER_ATLAS"
+export FER_DATA "$FER_DATA $FER_ATLAS"
+export FER_PALETTE "$FER_PALETTE $FER_ATLAS"
+export FER_EXTERNAL_FUNCTIONS "$FER_EXTERNAL_FUNCTIONS $FER_ATLAS"
+export PATH {$FER_ATLAS}:{$PATH}
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- SCRATCHDIR (=> ${R_DONNEES})
+typeset -r SCRATCHDIR=${TMPDIR}
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$}
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
+
+#====================================================
+#- ARCHIVE : ENVIRONEMENT VARIABLE
+set +A tmpARCH $( find /d* -maxdepth 1 -type d -name $LOGIN )
+typeset -r ARCHIVE=${ARCHIVE:=${tmpARCH[0]}}
+# if [ -z ${ARCHIVE} ] ; then
+#     echo "   ARCHIVE variable was not set on claude."
+#     echo "On this computer, you must set :"
+#     echo "export ARCHIVE=/d1"
+#     echo "(syntaxe depends of your shell)."
+#     echo "Then your IGCM_OUT dir will be on \"/d1/${LOGIN}/\" ."
+#     exit 1
+# fi
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=/sanipsl/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- OUT_POST
+typeset -r R_OUT_POST=${R_OUT}
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$}
+
+#=========================================================
+#- Add "time" before mpirun command
+MPIRUN_COMMAND="time "${MPIRUN_COMMAND}
+echo ${MPIRUN_COMMAND}
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+    ssh ${HOST} /bin/ksh  <<-EOF
+    export libIGCM=${libIGCM}
+    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+    ${@}
+EOF
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshMaster : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshMaster"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+(( RshPNum = 0 ))
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    #ssh ${HOST} exec /bin/ksh -vx $@ > out_RshPost.${RshPNum}
+    ssh ${HOST} exec /bin/ksh $@ > out_RshPost.${RshPNum}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    (( RshPNum = RshPNum + 1 ))
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirArchive : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    if [ ! -f ${1} ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \tree -f $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar cvf $@
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    \tar tvf $1
+
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Qsub
+#D-* Purpose: Qsub new job
+#D-* Examples:
+#D-
+function IGCM_sys_Qsub {
+    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Qsub :" $@
+    fi
+    echo "ssh -l ${LOGIN} ${HOST} ""cd ${SUBMIT_DIR} ; ${@}"" > ${Script_Output} 2>&1 &"
+    ssh -l ${LOGIN} ${HOST} "cd ${SUBMIT_DIR} ; ${@}" > ${Script_Output} 2>&1 &
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur."
+	IGCM_debug_Exit "IGCM_sys_Qsub"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Qsub"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    #echo "ssh -x -l ${LOGIN} ${HOST} ${3} > ${2} 2>&1 &"
+    #    ssh -x -l ${LOGIN} ${HOST} 
+    echo "${3} > ${2} 2>&1 &"
+    ${3} > ${2} 2>&1 &
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples:  IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp --preserve=timestamps $@ > out_rsync 2>&1
+    \cp --preserve=timestamps $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rm : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dir
+#D-* Purpose: Copy a complete directory on $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Dir
+#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Master
+#D-* Purpose: Copy a complete directory from MASTER filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Master {
+    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Master :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Master : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Master"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Rest
+#D-* Purpose: commande de transfert des restarts $(ARCHIVE).
+#D-           Quitte si le fichier ou si le répertoire d'arriver n'existe pas.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Rest {
+    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Rest :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+
+	IGCM_sys_TestDirArchive $( dirname $2 )
+
+	if [ ! -f ${1} ] ; then
+	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+	IGCM_sys_Chmod 444 ${1}
+
+	typeset RET
+
+	echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
+	RET=$?
+	IGCM_sys_Rsync_out $RET
+
+	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Rest : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ -f ${1} ] ; then
+	    if [ ! -d $( dirname $2 ) ] ; then
+		IGCM_sys_MkdirArchive $( dirname $2 )
+	    fi
+	else
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+
+	echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
+	RET=$?
+	IGCM_sys_Rsync_out $RET
+
+	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    dm_liste=${1}
+	fi
+	eval DEST=\${${#}}
+
+	# test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    return
+	fi
+
+	(( RET=0 ))
+        for target in ${dm_liste[*]} ; do
+	  ln -s ${target} ${DEST} >> out_rsync 2>&1
+          (( RET=RET+$? ))
+	done
+
+#       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1
+# 	RET=$?
+# 	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dods
+#D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dods {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dods :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dods ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+	    return
+	fi
+	#DO NOTHING
+    else
+	IGCM_err "DRYRUN mode = " $DRYRUN
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+
+##############################################################
+# NCO OPERATOR
+
+function IGCM_sys_ncap {
+    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncap :" $@
+    fi
+    /usr/bin/ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=/usr/bin/ncatted
+# Problem with ksh and string passed in this function to ncatted !
+# function IGCM_sys_ncatted {
+#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+#     if ( $DEBUG_sys ) ; then
+# 	echo "IGCM_sys_ncatted :" $@
+#     fi
+#     /usr/bin/ncatted $@
+#     if [ $? -gt 0 ] ; then
+#        echo "IGCM_sys_ncatted : erreur ${@}."
+#        IGCM_debug_Exit "ncatted"
+#     fi
+
+#     IGCM_debug_PopStack "IGCM_sys_ncatted"
+# }
+
+function IGCM_sys_ncbo {
+    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncbo :" $@
+    fi
+    /usr/bin/ncbo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncbo : erreur ${@}."
+#       IGCM_debug_Exit "ncbo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncbo"
+}
+
+function IGCM_sys_ncdiff {
+    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncdiff :" $@
+    fi
+    /usr/bin/ncdiff $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncdiff : erreur ${@}."
+#       IGCM_debug_Exit "ncdiff"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+}
+
+function IGCM_sys_ncea {
+    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncea :" $@
+    fi
+    /usr/bin/ncea $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncea : erreur ${@}."
+#       IGCM_debug_Exit "ncea"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncea"
+}
+
+function IGCM_sys_ncecat {
+    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncecat :" $@
+    fi
+    /usr/bin/ncecat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncecat : erreur ${@}."
+#       IGCM_debug_Exit "ncecat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncecat"
+}
+
+function IGCM_sys_ncflint {
+    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncflint :" $@
+    fi
+    /usr/bin/ncflint $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncflint : erreur ${@}."
+#       IGCM_debug_Exit "ncflint"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncflint"
+}
+
+function IGCM_sys_ncks {
+    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncks :" $@
+    fi
+    /usr/bin/ncks $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncks : erreur ${@}."
+#       IGCM_debug_Exit "ncks"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncks"
+}
+
+function IGCM_sys_ncpdq {
+    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncpdq :" $@
+    fi
+    /usr/bin/ncpdq $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncpdq : erreur ${@}."
+#       IGCM_debug_Exit "ncpdq"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+}
+
+function IGCM_sys_ncra {
+    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncra :" $@
+    fi
+    /usr/bin/ncra $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncra : erreur ${@}."
+#       IGCM_debug_Exit "ncra"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncra"
+}
+
+function IGCM_sys_ncrcat {
+    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrcat :" $@
+    fi
+    /usr/bin/ncrcat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrcat : erreur ${@}."
+#       IGCM_debug_Exit "ncrcat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+}
+
+function IGCM_sys_ncrename {
+    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrename :" $@
+    fi
+    /usr/bin/ncrename $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrename : erreur ${@}."
+#       IGCM_debug_Exit "ncrename"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrename"
+}
+
+function IGCM_sys_ncwa {
+    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncwa :" $@
+    fi
+    /usr/bin/ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+#       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_default.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_default.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_default.ksh	(revision 19)
@@ -0,0 +1,1217 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+ 
+#D-#==================================================
+#D-LibIGCM_sys Default host
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D- environment variables and shell commands.
+#D- All those definitions depend on host particularities.
+#D- It manages a stack mechanism and test validity of operations.
+#D- All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#=====================================================
+#set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#=====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+#Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/usr/bin/rsync  
+#RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-Lt -v"
+
+#====================================================
+# Source Ferret
+. /home/${LOGIN}/.atlas_env_${HOST}_ksh
+
+#=========================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- SCRATCHDIR (=> ${R_DONNEES})
+typeset -r SCRATCHDIR=/tmp
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=/home
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=${ARCHIVE}/${LOGIN}/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/${LOGIN}/IGCM_OUT
+
+#====================================================
+#- OUT_POST
+typeset -r R_OUT_POST=${R_OUT}
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"}
+
+#=========================================================
+#- Add "time" before mpirun command
+MPIRUN_COMMAND="time "${MPIRUN_COMMAND}
+echo ${MPIRUN_COMMAND}
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+    ssh ${HOST} /bin/ksh  <<-EOF
+    export libIGCM=${libIGCM}
+    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+    ${@}
+EOF
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshMaster : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshMaster"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+(( RshPNum = 0 ))
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    #ssh ${HOST} exec /bin/ksh -vx $@ > out_RshPost.${RshPNum}
+    ssh ${HOST} exec /bin/ksh $@ > out_RshPost.${RshPNum}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    (( RshPNum = RshPNum + 1 ))
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirArchive : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    if [ ! -f ${1} ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \tree -f $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar cvf $@
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    \tar tvf $1
+
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Qsub
+#D-* Purpose: Qsub new job
+#D-* Examples:
+#D-
+function IGCM_sys_Qsub {
+    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Qsub :" $@
+    fi
+    echo "ssh -l ${LOGIN} ${HOST} ""cd ${SUBMIT_DIR} ; ${@}"" > ${Script_Output} 2>&1 &"
+    ssh -l ${LOGIN} ${HOST} "cd ${SUBMIT_DIR} ; ${@}" > ${Script_Output} 2>&1 &
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur."
+	IGCM_debug_Exit "IGCM_sys_Qsub"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Qsub"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    #echo "ssh -x -l ${LOGIN} ${HOST} ${3} > ${2} 2>&1 &"
+    #    ssh -x -l ${LOGIN} ${HOST} 
+    echo "${3} > ${2} 2>&1 &"
+    ${3} > ${2} 2>&1 &
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples:  IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp --preserve=timestamps $@ > out_rsync 2>&1
+    \cp --preserve=timestamps $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rm : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dir
+#D-* Purpose: Copy a complete directory on $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Dir
+#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Master
+#D-* Purpose: Copy a complete directory from MASTER filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Master {
+    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Master :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Master : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Master"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Rest
+#D-* Purpose: commande de transfert des restarts $(ARCHIVE).
+#D-           Quitte si le fichier ou si le répertoire d'arriver n'existe pas.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Rest {
+    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Rest :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+
+	IGCM_sys_TestDirArchive $( dirname $2 )
+
+	if [ ! -f ${1} ] ; then
+	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+	IGCM_sys_Chmod 444 ${1}
+
+	typeset RET
+
+	echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
+	RET=$?
+	IGCM_sys_Rsync_out $RET
+
+	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Rest : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ -f ${1} ] ; then
+	    if [ ! -d $( dirname $2 ) ] ; then
+		IGCM_sys_MkdirArchive $( dirname $2 )
+	    fi
+	else
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+
+	echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
+	RET=$?
+	IGCM_sys_Rsync_out $RET
+
+	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    dm_liste=${1}
+	fi
+	eval DEST=\${${#}}
+
+	# test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    return
+	fi
+
+	(( RET=0 ))
+        for target in ${dm_liste[*]} ; do
+	  \cp ${target} ${DEST} >> out_rsync 2>&1
+          (( RET=RET+$? ))
+	done
+
+#       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1
+# 	RET=$?
+# 	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dods
+#D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dods {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dods :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dods ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+	    return
+	fi
+	#DO NOTHING
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+
+##############################################################
+# REBUILD OPERATOR
+
+function IGCM_sys_rebuild {
+    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_rebuild :" $@
+    fi
+    rebuild -f -o $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_rebuild : erreur ${@}."
+       IGCM_debug_Exit "rebuild"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_rebuild"
+}
+
+##############################################################
+# NCO OPERATOR
+
+function IGCM_sys_ncap {
+    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncap :" $@
+    fi
+    /usr/local/bin/ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=/usr/local/bin/ncatted
+# Problem with ksh and string passed in this function to ncatted !
+# function IGCM_sys_ncatted {
+#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+#     if ( $DEBUG_sys ) ; then
+# 	echo "IGCM_sys_ncatted :" $@
+#     fi
+#     /usr/local/bin/ncatted $@
+#     if [ $? -gt 0 ] ; then
+#        echo "IGCM_sys_ncatted : erreur ${@}."
+#        IGCM_debug_Exit "ncatted"
+#     fi
+
+#     IGCM_debug_PopStack "IGCM_sys_ncatted"
+# }
+
+function IGCM_sys_ncbo {
+    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncbo :" $@
+    fi
+    /usr/local/bin/ncbo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncbo : erreur ${@}."
+#       IGCM_debug_Exit "ncbo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncbo"
+}
+
+function IGCM_sys_ncdiff {
+    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncdiff :" $@
+    fi
+    /usr/local/bin/ncdiff $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncdiff : erreur ${@}."
+#       IGCM_debug_Exit "ncdiff"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+}
+
+function IGCM_sys_ncea {
+    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncea :" $@
+    fi
+    /usr/local/bin/ncea $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncea : erreur ${@}."
+#       IGCM_debug_Exit "ncea"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncea"
+}
+
+function IGCM_sys_ncecat {
+    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncecat :" $@
+    fi
+    /usr/local/bin/ncecat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncecat : erreur ${@}."
+#       IGCM_debug_Exit "ncecat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncecat"
+}
+
+function IGCM_sys_ncflint {
+    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncflint :" $@
+    fi
+    /usr/local/bin/ncflint $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncflint : erreur ${@}."
+#       IGCM_debug_Exit "ncflint"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncflint"
+}
+
+function IGCM_sys_ncks {
+    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncks :" $@
+    fi
+    /usr/local/bin/ncks $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncks : erreur ${@}."
+#       IGCM_debug_Exit "ncks"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncks"
+}
+
+function IGCM_sys_ncpdq {
+    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncpdq :" $@
+    fi
+    /usr/local/bin/ncpdq $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncpdq : erreur ${@}."
+#       IGCM_debug_Exit "ncpdq"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+}
+
+function IGCM_sys_ncra {
+    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncra :" $@
+    fi
+    /usr/local/bin/ncra $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncra : erreur ${@}."
+#       IGCM_debug_Exit "ncra"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncra"
+}
+
+function IGCM_sys_ncrcat {
+    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrcat :" $@
+    fi
+    /usr/local/bin/ncrcat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrcat : erreur ${@}."
+#       IGCM_debug_Exit "ncrcat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+}
+
+function IGCM_sys_ncrename {
+    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrename :" $@
+    fi
+    /usr/local/bin/ncrename $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrename : erreur ${@}."
+#       IGCM_debug_Exit "ncrename"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrename"
+}
+
+function IGCM_sys_ncwa {
+    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncwa :" $@
+    fi
+    /usr/local/bin/ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+#       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_mercure.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 19)
@@ -0,0 +1,975 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+
+#D-#==================================================
+#D-LibIGCM_sys for Mercure
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D-environment variables and shell commands.
+#D-All those definitions depend on host particularities.
+#D-It manages a stack mechanism and test validity of operations.
+#D-All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#====================================================
+# set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+# Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/home/cont003/p86denv/SX_RSYNC/bin/rsync
+#typeset -r RSYNC_FRONT="rsh mercure-eth0 /usr/bin/rsync "
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-Lt -v"
+# RSYNC_opt args to "remote rsync"
+# ie storage filesystem
+typeset -r RHOST=fer.ccc.cea.fr
+typeset -r REMOTE_RSYNC=/dmnfs/cont003/p86denv/RSYNC/bin/rsync
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=${DMFDIR}
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- OUT_POST
+typeset -r R_OUT_POST=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${LOCALTMPDIR}}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    /bin/ksh ${@}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirArchive : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+	fi
+    fi
+#    vérification ?? :
+#    if [ ! -d ${1} ] ; then
+#	echo "IGCM_sys_MkdirArchive : erreur."
+#	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+#    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+#IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+#echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    if [ ! -f ${1} ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \ls -lR ${@}
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Qsub
+#D-* Purpose: Qsub new job
+#D-* Examples:
+#D-
+function IGCM_sys_Qsub {
+    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Qsub :" $@
+    fi
+    /usr/bin/nqsII/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@."
+	IGCM_debug_Exit "IGCM_sys_Qsub"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Qsub"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    /usr/bin/nqsII/qsub -q scalaire -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM_POST}/$1.job -v ${listVarEnv}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur " $@
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp $@ > out_rsync 2>&1
+    \cp $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Rest
+#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Rest {
+    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Rest :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+	IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	# USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Rest : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+	#
+	IGCM_sys_MkdirArchive $( dirname $2 )
+        #
+	typeset RET
+
+	#=====================================================
+        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+        #=====================================================
+
+	#echo ${2} | grep "${R_OUT}" > /dev/null 2>&1
+	#if [ $? -eq 0 ] ; then
+	#    typeset WORKPATH FILEPATH
+	#    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
+	#    IGCM_sys_MkdirWork ${WORKPATH} 
+	#    FILEPATH=${WORKPATH}/$( basename $2 )
+        #    #
+	#    IGCM_sys_Cp ${1} ${FILEPATH}
+	#fi
+
+	IGCM_sys_Chmod 444 ${1}
+	#
+        # USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target file_work 
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    eval set +A dm_liste ${1}
+	fi
+	eval DEST=\${${#}}
+
+	#=====================================================
+        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+        #=====================================================
+
+	# Is it an R_OUT file (not R_IN) ?
+	#echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
+	#if [ $? -eq 0 ] ; then
+	#    # Yes  ? then we try to get it in SCRATCHDIR
+	#    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|" )
+	#    if [ -f ${file_work[0]} ] ; then
+	#	IGCM_sys_Cp ${file_work[*]} ${DEST}
+	#	IGCM_debug_PopStack "IGCM_sys_Get"
+	#	return
+	#    fi
+	#fi
+
+	# test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    IGCM_debug_PopStack "IGCM_sys_Get"
+	    return
+	fi
+
+	dmget ${dm_liste[*]} > out_rsync 2>&1
+  	RET=$?
+  	if [ ${RET} -gt 0 ] ; then
+  	    echo "IGCM_sys_Get : demigration error."
+  	    cat out_rsync
+  	    IGCM_debug_Exit "IGCM_sys_Get"
+  	fi
+
+        #USUAL WAY
+	if [ X${1} = X'/l' ] ; then
+	    (( RET=0 ))
+	    for target in ${dm_liste[*]} ; do
+		local_file=$( basename ${target} )
+		\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+		(( RET = RET + $? ))
+	    done
+	else
+	    \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
+	    RET=$?
+	fi
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+# 	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+##############################################################
+# REBUILD OPERATOR
+
+function IGCM_sys_rebuild {
+    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_rebuild :" $@
+    fi
+    /home/cont003/p86ipsl/SX/bin/rebuild -f -o $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_rebuild : erreur ${@}."
+       IGCM_debug_Exit "rebuild"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_rebuild"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables"
+    fi
+
+# --------------------------------------------------------------------
+#D- MPI specifications
+# --------------------------------------------------------------------
+
+#D-- MPISUSPEND
+    export MPISUSPEND=ON
+#D-- MPIPROGINF
+    export MPIPROGINF=ALL
+#other choices : ALL_DETAIL2
+
+# --------------------------------------------------------------------
+#D- Other specifications
+# --------------------------------------------------------------------
+
+#D- max number of character/line in output job
+    export F_SYSLEN=5000
+#D- number of error that can be admitted on the NEC
+    export F_ERRCNT=0
+#D- global performance
+    export F_PROGINF=DETAIL
+#D- activate ftrace (with -ftrace)
+    export F_FTRACE=YES
+#D- communication information (with -ftrace)
+    export MPICOMMINF=NO
+#D- I/O performance (FORTRAN I/O only not netCDF)
+    export F_FILEINF=NO
+# netCDF I/O performance
+    export NC_FILEINF=NO    
+
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables"
+    fi
+# --------------------------------------------------------------------
+#D- MPI specifications
+# --------------------------------------------------------------------
+
+#D-- MPIPROGINF
+    export MPIPROGINF=NO
+
+# --------------------------------------------------------------------
+#D- Other specifications
+# --------------------------------------------------------------------
+
+#D- global performance
+    export F_PROGINF=NO  
+
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+  
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file " $@
+    fi
+    (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 ))
+    (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
+    (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
+    
+    if [ $1 = MPI2 ]; then
+	cat <<EOF > run_file
+-p 1 -np 1 -e ./oasis
+EOF
+	(( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 ))
+	config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"'
+
+    elif [ $1 = MPI1 ]; then
+	cat <<EOF > run_file
+-p $NUM_PROC_OASIS -e ./oasis
+-p $NUM_PROC_ATM -e ./lmdz.x
+-p $NUM_PROC_OCE -e ./opa.xx
+EOF
+ 
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+  
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_mercureTX.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_mercureTX.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_mercureTX.ksh	(revision 19)
@@ -0,0 +1,1206 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+
+#D-#==================================================
+#D-LibIGCM_sys for Mercure TX
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D-environment variables and shell commands.
+#D-All those definitions depend on host particularities.
+#D-It manages a stack mechanism and test validity of operations.
+#D-All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#====================================================
+# set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+# Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/usr/bin/rsync
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-Lt -v"
+# RSYNC_opt args to "remote rsync"
+# ie storage filesystem
+typeset -r RHOST=fer.ccc.cea.fr
+typeset -r REMOTE_RSYNC=/dmnfs/cont003/p86denv/RSYNC/bin/rsync
+
+#====================================================
+# Source Ferret
+. /home/cont003/p86ipsl/.atlas_env_mercure_ksh
+
+#====================================================
+# Specific for ocean additionnal diagnostic
+export FER_GO="$FER_GO /home/cont003/p86denv/IGCM_POST_UTIL/JNL /home/cont003/p86denv/GRAF /home/cont003/p86denv/GRAF/GO"
+export FER_PALETTE="$FER_PALETTE /home/cont003/p86denv/GRAF/PALET"
+
+#=========================================================
+# Host specific DIRECTORIES
+#====================================================
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+# For interactive jobs on mercure 
+PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)}
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=${DMFDIR}
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- OUT_SCR (ONLY FOR double copy an scratch)
+typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- OUT_POST
+typeset -r R_OUT_POST=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}}
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Just a fake command to wrapp
+#D-           IGCM_card call in post-treatment
+#D-           Rhodes do not see brodie filesystem
+#D-           That's why we need this hack.
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    #set -vx
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+    /bin/ksh <<-EOF
+    export libIGCM=${libIGCM}
+    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+    ${@}
+EOF
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshMaster : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshMaster"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    /bin/ksh ${@}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirArchive : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+	fi
+    fi
+#    vérification ?? :
+#    if [ ! -d ${1} ] ; then
+#	echo "IGCM_sys_MkdirArchive : erreur."
+#	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+#    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+#IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+#echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    if [ ! -f ${1} ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \tree -f $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar cvf $@
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    \tar tvf $1
+
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    /usr/bin/nqsII/qsub -q scalaire -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM_POST}/$1.job -v ${listVarEnv}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur " $@
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp $@ > out_rsync 2>&1
+    \cp $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rm : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dir
+#D-* Purpose: Copy a complete directory on $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	\cp -r $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Dir
+#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	\cp -r $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Master
+#D-* Purpose: Copy a complete directory from MASTER filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Master {
+    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Master :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	\cp -r $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Master : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Master"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+	#
+	IGCM_sys_MkdirArchive $( dirname $2 )
+	#
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+        # USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target file_work 
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    eval set +A dm_liste ${1}
+	fi
+	eval DEST=\${${#}}
+
+	#=====================================================
+        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+        #=====================================================
+
+	# Is it an R_OUT file (not R_IN) ?
+	#echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
+	#if [ $? -eq 0 ] ; then
+	#    # Yes  ? then we try to get it in SCRATCHDIR
+	#    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" )
+	#    if [ -f ${file_work[0]} ] ; then
+	#	IGCM_sys_Cp ${file_work[*]} ${DEST}
+	#	IGCM_debug_PopStack "IGCM_sys_Get"
+	#	return
+	#    fi
+	#fi
+
+	# test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    IGCM_debug_PopStack "IGCM_sys_Get"
+	    return
+	fi
+
+	dmget ${dm_liste[*]} > out_rsync 2>&1
+	RET=$?
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : demigration error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    IGCM_debug_PopStack "IGCM_sys_Get"
+	    return
+	fi
+
+        #USUAL WAY
+	(( RET=0 ))
+	if [ X${1} = X'/l' ] ; then
+	    (( RET=0 ))
+	    for target in ${dm_liste[*]} ; do
+		local_file=$( basename ${target} )
+		\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+		(( RET = RET + $? ))
+	    done
+	else
+	    \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
+	    RET=$?
+	fi
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+# 	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dods
+#D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dods {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dods :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${R_SAVE}/${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+	    return
+	fi
+
+	typeset RET
+	#
+	cd ${R_SAVE}
+	dods_rm public/${LOGIN}/${config_UserChoices_TagName}/${config_UserChoices_JobName}/${1} > /dev/null 2>&1
+	#/bin/chmod -R u+w  ${R_SAVE}/${1}
+	dods_cp ${1} public/${LOGIN}/${config_UserChoices_TagName}/${config_UserChoices_JobName} > /dev/null 2>&1
+	#/bin/chmod -R +rX ${R_SAVE}/${1}
+	#/bin/chmod -R a+rX /dmnfs/cont003/dods/public/${LOGIN}/${config_UserChoices_TagName}
+	#RET=$?
+	RET=0
+        
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dods : error."
+	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+
+##############################################################
+# NCO OPERATOR
+
+function IGCM_sys_ncap {
+    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncap :" $@
+    fi
+    /usr/local/bin/ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=/usr/local/bin/ncatted
+# Problem with ksh and string passed in this function to ncatted !
+# function IGCM_sys_ncatted {
+#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+#     if ( $DEBUG_sys ) ; then
+# 	echo "IGCM_sys_ncatted :" $@
+#     fi
+#     /usr/local/bin/ncatted $@
+#     if [ $? -gt 0 ] ; then
+#        echo "IGCM_sys_ncatted : erreur ${@}."
+#        IGCM_debug_Exit "ncatted"
+#     fi
+
+#     IGCM_debug_PopStack "IGCM_sys_ncatted"
+# }
+
+function IGCM_sys_ncbo {
+    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncbo :" $@
+    fi
+    /usr/local/bin/ncbo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncbo : erreur ${@}."
+#       IGCM_debug_Exit "ncbo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncbo"
+}
+
+function IGCM_sys_ncdiff {
+    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncdiff :" $@
+    fi
+    /usr/local/bin/ncdiff $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncdiff : erreur ${@}."
+#       IGCM_debug_Exit "ncdiff"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+}
+
+function IGCM_sys_ncea {
+    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncea :" $@
+    fi
+    /usr/local/bin/ncea $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncea : erreur ${@}."
+#       IGCM_debug_Exit "ncea"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncea"
+}
+
+function IGCM_sys_ncecat {
+    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncecat :" $@
+    fi
+    /usr/local/bin/ncecat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncecat : erreur ${@}."
+#       IGCM_debug_Exit "ncecat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncecat"
+}
+
+function IGCM_sys_ncflint {
+    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncflint :" $@
+    fi
+    /usr/local/bin/ncflint $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncflint : erreur ${@}."
+#       IGCM_debug_Exit "ncflint"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncflint"
+}
+
+function IGCM_sys_ncks {
+    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncks :" $@
+    fi
+    /usr/local/bin/ncks $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncks : erreur ${@}."
+#       IGCM_debug_Exit "ncks"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncks"
+}
+
+function IGCM_sys_ncpdq {
+    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncpdq :" $@
+    fi
+    /usr/local/bin/ncpdq $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncpdq : erreur ${@}."
+#       IGCM_debug_Exit "ncpdq"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+}
+
+function IGCM_sys_ncra {
+    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncra :" $@
+    fi
+    /usr/local/bin/ncra $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncra : erreur ${@}."
+#       IGCM_debug_Exit "ncra"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncra"
+}
+
+function IGCM_sys_ncrcat {
+    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrcat :" $@
+    fi
+    /usr/local/bin/ncrcat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrcat : erreur ${@}."
+#       IGCM_debug_Exit "ncrcat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+}
+
+function IGCM_sys_ncrename {
+    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrename :" $@
+    fi
+    /usr/local/bin/ncrename $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrename : erreur ${@}."
+#       IGCM_debug_Exit "ncrename"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrename"
+}
+
+function IGCM_sys_ncwa {
+    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncwa :" $@
+    fi
+    /usr/local/bin/ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+#       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_obelix.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_obelix.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_obelix.ksh	(revision 19)
@@ -0,0 +1,1213 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip, Christian Laguerre
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date: 2008-05-29 21:29:09 +0200 (Thu, 29 May 2008) $
+# $Author: laguerre $
+# $Revision: 7 $
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+# 
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+
+#D-#==================================================
+#D-LibIGCM_sys for obelix
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D-environment variables and shell commands.
+#D-All those definitions depend on host particularities.
+#D-It manages a stack mechanism and test validity of operations.
+#D-All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#=====================================================
+# set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#=====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+# Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/usr/bin/rsync
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-Lt -v"
+
+#====================================================
+# Source Ferret
+. /home/users/brock/.atlas_env_asterix_ksh
+
+#=========================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- SCRATCHDIR (=> ${R_DONNEES})
+typeset -r SCRATCHDIR=/tmp
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=/home/scratch01/${LOGIN}
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=${ARCHIVE}/${LOGIN}/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/${LOGIN}/IGCM_OUT
+
+#====================================================
+#- OUT_POST
+typeset -r R_OUT_POST=${R_OUT}
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$}
+#typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=/home/orchidee_ns/${LOGIN}/tmp$$}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"}
+
+#=========================================================
+#- Add "time" before mpirun command
+MPIRUN_COMMAND="time "${MPIRUN_COMMAND}
+echo ${MPIRUN_COMMAND}
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+    ssh ${HOST} /bin/ksh  <<-EOF
+    export libIGCM=${libIGCM}
+    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+    ${@}
+EOF
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshMaster : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshMaster"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+(( RshPNum = 0 ))
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    #ssh ${HOST} exec /bin/ksh -vx $@ > out_RshPost.${RshPNum}
+    ssh ${HOST} exec /bin/ksh $@ > out_RshPost.${RshPNum}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    (( RshPNum = RshPNum + 1 ))
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirArchive : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+	fi
+    fi
+#    vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    if [ ! -f ${1} ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \tree -f $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar cvf $@
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    \tar tvf $1
+
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Qsub
+#D-* Purpose: Qsub new job
+#D-* Examples:
+#D-
+function IGCM_sys_Qsub {
+    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Qsub :" $@
+    fi
+    /usr/local/bin/qsub -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@."
+	IGCM_debug_Exit "IGCM_sys_Qsub"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Qsub"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    /usr/local/bin/qsub -q medium -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM_POST}/$1.job -v ${listVarEnv}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur " $@
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp --preserve=timestamps $@ > out_rsync 2>&1
+    \cp --preserve=timestamps $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rm : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dir
+#D-* Purpose: Copy a complete directory on $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Dir
+#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	\cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Master
+#D-* Purpose: Copy a complete directory from MASTER filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Master {
+    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Master :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	cp -R $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Master : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Master"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Rest
+#D-* Purpose: commande de transfert des restarts $(ARCHIVE).
+#D-           Quitte si le fichier ou si le répertoire d'arriver n'existe pas.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Rest {
+    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Rest :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+
+	IGCM_sys_TestDirArchive $( dirname $2 )
+
+	if [ ! -f ${1} ] ; then
+	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+	IGCM_sys_Chmod 444 ${1}
+
+	typeset RET
+
+	echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
+	RET=$?
+	IGCM_sys_Rsync_out $RET
+
+	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Rest : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ -f ${1} ] ; then
+	    if [ ! -d $( dirname $2 ) ] ; then
+		IGCM_sys_MkdirArchive $( dirname $2 )
+	    fi
+	else
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+
+	echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
+	RET=$?
+	IGCM_sys_Rsync_out $RET
+
+	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    dm_liste=${1}
+	fi
+	eval DEST=\${${#}}
+
+	# test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    return
+	fi
+
+	(( RET=0 ))
+        for target in ${dm_liste[*]} ; do
+	  \cp ${target} ${DEST} >> out_rsync 2>&1
+          (( RET=RET+$? ))
+	done
+
+#       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1
+#       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1
+# 	RET=$?
+# 	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dods
+#D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dods {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dods :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dods ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+	    return
+	fi
+	#DO NOTHING
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+
+##############################################################
+# REBUILD OPERATOR
+
+function IGCM_sys_rebuild {
+    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_rebuild :" $@
+    fi
+    rebuild -f -o $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_rebuild : erreur ${@}."
+       IGCM_debug_Exit "rebuild"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_rebuild"
+}
+
+##############################################################
+# NCO OPERATOR
+
+function IGCM_sys_ncap {
+    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncap :" $@
+    fi
+    /usr/local/bin/ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=/usr/local/bin/ncatted
+# Problem with ksh and string passed in this function to ncatted !
+# function IGCM_sys_ncatted {
+#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+#     if ( $DEBUG_sys ) ; then
+# 	echo "IGCM_sys_ncatted :" $@
+#     fi
+#     /usr/local/bin/ncatted $@
+#     if [ $? -gt 0 ] ; then
+#        echo "IGCM_sys_ncatted : erreur ${@}."
+#        IGCM_debug_Exit "ncatted"
+#     fi
+
+#     IGCM_debug_PopStack "IGCM_sys_ncatted"
+# }
+
+function IGCM_sys_ncbo {
+    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncbo :" $@
+    fi
+    /usr/local/bin/ncbo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncbo : erreur ${@}."
+#       IGCM_debug_Exit "ncbo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncbo"
+}
+
+function IGCM_sys_ncdiff {
+    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncdiff :" $@
+    fi
+    /usr/local/bin/ncdiff $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncdiff : erreur ${@}."
+#       IGCM_debug_Exit "ncdiff"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+}
+
+function IGCM_sys_ncea {
+    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncea :" $@
+    fi
+    /usr/local/bin/ncea $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncea : erreur ${@}."
+#       IGCM_debug_Exit "ncea"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncea"
+}
+
+function IGCM_sys_ncecat {
+    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncecat :" $@
+    fi
+    /usr/local/bin/ncecat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncecat : erreur ${@}."
+#       IGCM_debug_Exit "ncecat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncecat"
+}
+
+function IGCM_sys_ncflint {
+    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncflint :" $@
+    fi
+    /usr/local/bin/ncflint $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncflint : erreur ${@}."
+#       IGCM_debug_Exit "ncflint"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncflint"
+}
+
+function IGCM_sys_ncks {
+    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncks :" $@
+    fi
+    /usr/local/bin/ncks $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncks : erreur ${@}."
+#       IGCM_debug_Exit "ncks"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncks"
+}
+
+function IGCM_sys_ncpdq {
+    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncpdq :" $@
+    fi
+    /usr/local/bin/ncpdq $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncpdq : erreur ${@}."
+#       IGCM_debug_Exit "ncpdq"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+}
+
+function IGCM_sys_ncra {
+    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncra :" $@
+    fi
+    /usr/local/bin/ncra $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncra : erreur ${@}."
+#       IGCM_debug_Exit "ncra"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncra"
+}
+
+function IGCM_sys_ncrcat {
+    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrcat :" $@
+    fi
+    /usr/local/bin/ncrcat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrcat : erreur ${@}."
+#       IGCM_debug_Exit "ncrcat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+}
+
+function IGCM_sys_ncrename {
+    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrename :" $@
+    fi
+    /usr/local/bin/ncrename $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrename : erreur ${@}."
+#       IGCM_debug_Exit "ncrename"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrename"
+}
+
+function IGCM_sys_ncwa {
+    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncwa :" $@
+    fi
+    /usr/local/bin/ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+#       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_platine.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_platine.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_platine.ksh	(revision 19)
@@ -0,0 +1,1312 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip
+# Contact: Martial.Mancip_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+
+#D-#==================================================
+#D-LibIGCM_sys for Platine
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D-environment variables and shell commands.
+#D-All those definitions depend on host particularities.
+#D-It manages a stack mechanism and test validity of operations.
+#D-All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#====================================================
+# set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+# Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/home/cont003/p86denv/SX_RSYNC/bin/rsync
+#typeset -r RSYNC_FRONT="rsh platine-eth0 /usr/bin/rsync "
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-Lt -v"
+# RSYNC_opt args to "remote rsync"
+# ie storage filesystem
+typeset -r RHOST=fer.ccc.cea.fr
+typeset -r REMOTE_RSYNC=/dmnfs/cont003/p86denv/RSYNC/bin/rsync
+
+#====================================================
+# Source Ferret
+. /home/cont003/p86ipsl/.atlas_env_platine_ksh
+
+#====================================================
+# Specific for ocean additionnal diagnostic
+export FER_GO="$FER_GO /home/cont003/p86denv/IGCM_POST_UTIL/JNL /home/cont003/p86denv/GRAF /home/cont003/p86denv/GRAF/GO"
+export FER_PALETTE="$FER_PALETTE /home/cont003/p86denv/GRAF/PALET"
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=${DMFDIR}
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- OUT_SCR (ONLY FOR double copy an scratch)
+typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- OUT_POST
+typeset -r R_OUT_POST=${SCRATCHDIR}/IGCM_OUT
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}}
+if [ $LSB_QUEUE == post ] ; then
+    typeset -r RUN_DIR_PATH=${SCRATCHDIR}/tmp$$
+fi
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="srun"}
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Just a fake command to wrapp
+#D-           IGCM_card call in post-treatment
+#D-           Rhodes do not see brodie filesystem
+#D-           That's why we need this hake.
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    #set -vx
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+    /bin/ksh <<-EOF
+    export libIGCM=${libIGCM}
+    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
+    ${@}
+EOF
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshMaster : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshMaster"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    /bin/ksh ${@}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirArchive : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+	fi
+    fi
+#    vérification ?? :
+#    if [ ! -d ${1} ] ; then
+#	echo "IGCM_sys_MkdirArchive : erreur."
+#	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+#    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+#IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+#echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    if [ ! -f ${1} ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \tree -f $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar cvf $@
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    \tar tvf $1
+
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Qsub
+#D-* Purpose: Qsub new job
+#D-* Examples:
+#D-
+function IGCM_sys_Qsub {
+    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Qsub :" $@
+    fi
+    bsub -o ${Script_Output} -J ${config_UserChoices_JobName}.${CumulPeriod} < $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur " $@
+	IGCM_debug_Exit "IGCM_sys_Qsub"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Qsub"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    bsub -o ${POST_DIR}/$1.${PeriodDateEnd}.out < ${libIGCM_POST}/$1.job
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur " $@
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp $@ > out_rsync 2>&1
+    \cp $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+    
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rm : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Rest
+#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Rest {
+    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Rest :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+	IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	# USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Rest : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+#D-#==================================================
+#D-function IGCM_sys_Put_Dir
+#D-* Purpose: Copy a complete directory on $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	\cp -r $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Dir
+#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	\cp -r $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Master
+#D-* Purpose: Copy a complete directory from MASTER filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Master {
+    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Master :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	\cp -r $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Master : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Master"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+	#
+	IGCM_sys_MkdirArchive $( dirname $2 )
+        #
+	typeset RET
+        #
+	IGCM_sys_Chmod 444 ${1}
+	#
+        # USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target file_work 
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    eval set +A dm_liste ${1}
+	fi
+	eval DEST=\${${#}}
+
+	#=====================================================
+        #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR
+        #=====================================================
+
+	# Is it an R_OUT file (not R_IN) ?
+	#echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1
+	#if [ $? -eq 0 ] ; then
+	#    # Yes  ? then we try to get it in SCRATCHDIR
+	#    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" )
+	#    if [ -f ${file_work[0]} ] ; then
+	#	IGCM_sys_Cp ${file_work[*]} ${DEST}
+	#	IGCM_debug_PopStack "IGCM_sys_Get"
+	#	return
+	#    fi
+	#fi
+
+	# test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    IGCM_debug_PopStack "IGCM_sys_Get"
+	    return
+	fi
+
+	dmget ${dm_liste[*]} > out_rsync 2>&1
+  	RET=$?
+  	if [ ${RET} -gt 0 ] ; then
+  	    echo "IGCM_sys_Get : demigration error."
+  	    cat out_rsync
+  	    IGCM_debug_Exit "IGCM_sys_Get"
+	    IGCM_debug_PopStack "IGCM_sys_Get"
+	    return
+  	fi
+
+        #USUAL WAY
+	(( RET=0 ))
+	if [ X${1} = X'/l' ] ; then
+	    (( RET=0 ))
+	    for target in ${dm_liste[*]} ; do
+		local_file=$( basename ${target} )
+		\cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
+		(( RET = RET + $? ))
+	    done
+	else
+	    \cp ${dm_liste} ${DEST} >> out_rsync 2>&1
+	    RET=$?
+	fi
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+# 	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dods
+#D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dods {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dods :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${R_SAVE}/${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+	    return
+	fi
+
+	typeset RET
+	#
+	cd ${R_SAVE}
+	dods_rm public/${LOGIN}/${config_UserChoices_TagName}/${config_UserChoices_JobName}/${1} > /dev/null 2>&1
+	#/bin/chmod -R u+w  ${R_SAVE}/${1}
+	dods_cp ${1} public/${LOGIN}/${config_UserChoices_TagName}/${config_UserChoices_JobName} > /dev/null 2>&1
+	#/bin/chmod -R +rX ${R_SAVE}/${1}
+	#/bin/chmod -R a+rX /dmnfs/cont003/dods/public/${LOGIN}/${config_UserChoices_TagName}
+	#RET=$?
+	RET=0
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dods : error."
+	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+##############################################################
+# NCO OPERATOR
+
+function IGCM_sys_ncap {
+    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncap :" $@
+    fi
+    /applications/nco/bin/ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=/applications/nco/bin/ncatted
+# Problem with ksh and string passed in this function to ncatted !
+# function IGCM_sys_ncatted {
+#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+#     if ( $DEBUG_sys ) ; then
+# 	echo "IGCM_sys_ncatted :" $@
+#     fi
+#     /usr/local/bin/ncatted $@
+#     if [ $? -gt 0 ] ; then
+#        echo "IGCM_sys_ncatted : erreur ${@}."
+#        IGCM_debug_Exit "ncatted"
+#     fi
+
+#     IGCM_debug_PopStack "IGCM_sys_ncatted"
+# }
+
+function IGCM_sys_ncbo {
+    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncbo :" $@
+    fi
+    /applications/nco/bin/ncbo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncbo : erreur ${@}."
+#       IGCM_debug_Exit "ncbo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncbo"
+}
+
+function IGCM_sys_ncdiff {
+    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncdiff :" $@
+    fi
+    /applications/nco/bin/ncdiff $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncdiff : erreur ${@}."
+#       IGCM_debug_Exit "ncdiff"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+}
+
+function IGCM_sys_ncea {
+    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncea :" $@
+    fi
+    /applications/nco/bin/ncea $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncea : erreur ${@}."
+#       IGCM_debug_Exit "ncea"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncea"
+}
+
+function IGCM_sys_ncecat {
+    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncecat :" $@
+    fi
+    /applications/nco/bin/ncecat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncecat : erreur ${@}."
+#       IGCM_debug_Exit "ncecat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncecat"
+}
+
+function IGCM_sys_ncflint {
+    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncflint :" $@
+    fi
+    /usr/local/bin/ncflint $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncflint : erreur ${@}."
+#       IGCM_debug_Exit "ncflint"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncflint"
+}
+
+function IGCM_sys_ncks {
+    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncks :" $@
+    fi
+    /applications/nco/bin/ncks $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncks : erreur ${@}."
+#       IGCM_debug_Exit "ncks"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncks"
+}
+
+function IGCM_sys_ncpdq {
+    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncpdq :" $@
+    fi
+    /applications/nco/bin/ncpdq $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncpdq : erreur ${@}."
+#       IGCM_debug_Exit "ncpdq"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+}
+
+function IGCM_sys_ncra {
+    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncra :" $@
+    fi
+    /applications/nco/bin/ncra $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncra : erreur ${@}."
+#       IGCM_debug_Exit "ncra"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncra"
+}
+
+function IGCM_sys_ncrcat {
+    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrcat :" $@
+    fi
+    /applications/nco/bin/ncrcat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrcat : erreur ${@}."
+#       IGCM_debug_Exit "ncrcat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+}
+
+function IGCM_sys_ncrename {
+    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrename :" $@
+    fi
+    /applications/nco/bin/ncrename $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrename : erreur ${@}."
+#       IGCM_debug_Exit "ncrename"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrename"
+}
+
+function IGCM_sys_ncwa {
+    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncwa :" $@
+    fi
+    /applications/nco/bin/ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+#       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+##############################################################
+# REBUILD OPERATOR
+
+function IGCM_sys_rebuild {
+    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_rebuild :" $@
+    fi
+    /home/cont003/p86ipsl/bin/platine/rebuild -f -o $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_rebuild : erreur ${@}."
+       IGCM_debug_Exit "rebuild"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_rebuild"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables"
+    fi
+    ulimit -s 2097152
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file " $@
+    fi
+    if [ $1 = MPI1 ]; then
+	(( nb_tot_m1 = $BATCH_NUM_PROC_TOT  - 1 ))
+	cat <<EOF > run_file
+#!/bin/bash
+if [ \$SLURM_PROCID -eq 0 ]
+  then ./oasis ;
+elif ( [ \$SLURM_PROCID -ge 1 ] && [ \$SLURM_PROCID -lt ${nb_tot_m1} ] )
+  then ./lmdz.x ;
+else ./opa.xx ;
+fi
+EOF
+	config_UserChoices_JobRunOptions='"-n ${BATCH_NUM_PROC_TOT}"'
+	IGCM_sys_Chmod u+x run_file
+    fi
+    (( NUM_PROC_ATM = $BATCH_NUM_PROC_TOT - 2 ))
+
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+  
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_rhodes.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_rhodes.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_rhodes.ksh	(revision 19)
@@ -0,0 +1,1176 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Sebastien Denvil
+# Contact: sebastien.denvil.@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+
+#D-#==================================================
+#D-LibIGCM_sys for Rhodes
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D-environment variables and shell commands.
+#D-All those definitions depend on host particularities.
+#D-It manages a stack mechanism and test validity of operations.
+#D-All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#====================================================
+# set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+# Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/usr/bin/rsync
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-Lt -v"
+# RSYNC_opt args to "remote rsync"
+# ie storage filesystem
+typeset -r RHOST=gaya.idris.fr
+typeset -r REMOTE_RSYNC=/u/rech/ces/rces452/RSYNC/bin/rsync
+
+#====================================================
+# Source Ferret
+. /home/rech/psl/rpsl035/.atlas_env_rhodes_ksh
+
+#====================================================
+# Specific for ocean additionnal diagnostic
+export FER_GO="$FER_GO /home/rech/ces/rces599/Cpl/TKE /home/rech/ces/rces599/Cpl/TKE/GO /home/rech/ces/rces452/IGCM_POST_UTIL/JNL"
+export FER_PALETTE="$FER_PALETTE /home/rech/ces/rces599/Cpl/TKE/PALET"
+export DISPLAY=:1
+
+#=========================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${QSUB_WORKDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=$HOMEGAYA
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=/u/rech/psl/rpsl035/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- OUT_POST
+typeset -r R_OUT_POST=${WORKDIR}/IGCM_OUT
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}}
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    #set -vx
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+    rsh brodie exec /bin/ksh <<-EOF
+    export libIGCM=${libIGCM_SX}
+    . ${libIGCM_SX}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM_SX}/libIGCM_card/libIGCM_card.ksh
+    ${@}
+EOF
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshMaster : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshMaster"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshMaster"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    /bin/ksh ${@}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirArchive : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+#IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+#echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    typeset RET 
+
+    mfls ${1} | grep ${1} > /dev/null 2>&1
+    RET=$?
+    if [ ${RET} -gt 0 ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \mfls -r $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar cvf $@
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    \tar tvf $1
+
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    /usr/local/bin/qsub -x -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM}/$1.job
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp $@ > out_rsync 2>&1
+    \cp $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Rm
+#D-* Purpose: generic rm
+#D-* Examples:
+#D-
+function IGCM_sys_Rm {
+    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rm :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rm : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Rm"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rm"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+ 	echo "IGCM_sys_Mv : error in mv."
+ 	cat out_rsync
+ 	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dir
+#D-* Purpose: Copy a complete directory on $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	rcp -r $1 gaya:$2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Dir
+#D-* Purpose: Copy a complete directory from $(ARCHIVE)
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Dir {
+    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Dir :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+	    return
+	fi
+
+	typeset RET
+
+	#USUAL WAY
+	rcp -rp gaya:$1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Dir : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Dir"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get_Master
+#D-* Purpose: Copy a complete directory from MASTER filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_Get_Master {
+    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get_Master :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	TEST=$( rsh brodie -n "[ -d $1 ] && echo 1 || echo 0" )
+	if [ ${TEST} -ne 1 ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ON BRODIE."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+	sleep 60
+
+	#USUAL WAY
+	rcp -r brodie:$1 $2 > out_rsync 2>&1
+  	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get_Master : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get_Master"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+	# Only if we use rsync
+	#IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	mfput $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    dm_liste=${1}
+	fi
+	eval DEST=\${${#}}
+
+	# test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    IGCM_debug_PopStack "IGCM_sys_Get"
+	    return
+	fi
+
+	# SD : dm_liste is not suited for computing job
+	#      because we change filename during transfert
+	#      dm_liste is better suited for post-treatment
+	# SD : dm_liste necessary only with RSYNC
+
+	#dm_liste=" "
+  	#(( ifile=1 ))
+	#while [ $ifile -lt $# ] ; do
+	#    dm_liste=$( eval echo ${dm_liste[*]} " "\${${ifile}} )
+	#    (( ifile = ifile + 1 ))
+	#done
+	#DEST=$( eval echo \${${#}} )
+
+	#USUAL WAY
+	mfget ${dm_liste[*]} ${DEST} > out_rsync 2>&1
+ 	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+# 	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Dods
+#D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Dods {
+    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Dods :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -d ${R_SAVE}/${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+	    return
+	fi
+
+	typeset RET
+	#
+	rsh gaya exec /bin/ksh <<EOF
+        cd ${R_SAVE}
+        /usr/local/bin/dods_rm DODS/pub/${LOGIN}/${config_UserChoices_TagName}/${config_UserChoices_JobName}/${1} > /dev/null 2>&1
+        /sbin/chmod -R u+w ${R_SAVE}/${1}
+        /usr/local/bin/dods_cp ${1} DODS/pub/${LOGIN}/${config_UserChoices_TagName}/${config_UserChoices_JobName} > /dev/null 2>&1
+        /sbin/chmod -R +rX ${R_SAVE}/${1}
+	/sbin/chmod -R u+w ${R_SAVE}/${1}
+EOF
+        RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dods : error."
+	    cat out_dods
+	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+
+##############################################################
+# NCO OPERATOR
+
+function IGCM_sys_ncap {
+    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncap :" $@
+    fi
+    /usr/local/bin/ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=/usr/local/bin/ncatted
+# Problem with ksh and string passed in this function to ncatted !
+# function IGCM_sys_ncatted {
+#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
+#     if ( $DEBUG_sys ) ; then
+# 	echo "IGCM_sys_ncatted :" $@
+#     fi
+#     /usr/local/bin/ncatted $@
+#     if [ $? -gt 0 ] ; then
+#        echo "IGCM_sys_ncatted : erreur ${@}."
+#        IGCM_debug_Exit "ncatted"
+#     fi
+
+#     IGCM_debug_PopStack "IGCM_sys_ncatted"
+# }
+
+function IGCM_sys_ncbo {
+    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncbo :" $@
+    fi
+    /usr/local/bin/ncbo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncbo : erreur ${@}."
+       IGCM_debug_Exit "ncbo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncbo"
+}
+
+function IGCM_sys_ncdiff {
+    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncdiff :" $@
+    fi
+    /usr/local/bin/ncdiff $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncdiff : erreur ${@}."
+       IGCM_debug_Exit "ncdiff"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncdiff"
+}
+
+function IGCM_sys_ncea {
+    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncea :" $@
+    fi
+    /usr/local/bin/ncea $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncea : erreur ${@}."
+       IGCM_debug_Exit "ncea"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncea"
+}
+
+function IGCM_sys_ncecat {
+    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncecat :" $@
+    fi
+    /usr/local/bin/ncecat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncecat : erreur ${@}."
+       IGCM_debug_Exit "ncecat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncecat"
+}
+
+function IGCM_sys_ncflint {
+    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncflint :" $@
+    fi
+    /usr/local/bin/ncflint $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncflint : erreur ${@}."
+       IGCM_debug_Exit "ncflint"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncflint"
+}
+
+function IGCM_sys_ncks {
+    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncks :" $@
+    fi
+    /usr/local/bin/ncks $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncks : erreur ${@}."
+       IGCM_debug_Exit "ncks"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncks"
+}
+
+function IGCM_sys_ncpdq {
+    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncpdq :" $@
+    fi
+    /usr/local/bin/ncpdq $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncpdq : erreur ${@}."
+       IGCM_debug_Exit "ncpdq"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncpdq"
+}
+
+function IGCM_sys_ncra {
+    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncra :" $@
+    fi
+    /usr/local/bin/ncra $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncra : erreur ${@}."
+       IGCM_debug_Exit "ncra"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncra"
+}
+
+function IGCM_sys_ncrcat {
+    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrcat :" $@
+    fi
+    /usr/local/bin/ncrcat $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrcat : erreur ${@}."
+       IGCM_debug_Exit "ncrcat"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrcat"
+}
+
+function IGCM_sys_ncrename {
+    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncrename :" $@
+    fi
+    /usr/local/bin/ncrename $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncrename : erreur ${@}."
+       IGCM_debug_Exit "ncrename"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncrename"
+}
+
+function IGCM_sys_ncwa {
+    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_ncwa :" $@
+    fi
+    /usr/local/bin/ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file "
+    fi
+    IGCM_debug_PopStack "IGCM_sys_build_run_file "
+}
Index: /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_zahir.ksh
===================================================================
--- /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_zahir.ksh	(revision 19)
+++ /tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_zahir.ksh	(revision 19)
@@ -0,0 +1,1003 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Sébastien Denvil
+# Contact: sebastien.denvil.@ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+# History:
+# Modification:
+#
+#**************************************************************
+
+#=========================================================
+# The documentation of this file can be automatically generated
+# if you use the prefix #D- for comments to be extracted. 
+# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
+#=========================================================
+
+#D-#==================================================
+#D-LibIGCM_sys for Zahir
+#D-#==================================================
+#D-
+#D- This ksh library if a layer under some usefull 
+#D-environment variables and shell commands.
+#D-All those definitions depend on host particularities.
+#D-It manages a stack mechanism and test validity of operations.
+#D-All function described bellow must be prefixed by IGCM_sys.
+
+#====================================================
+# libIGCM_sys PARAMETERS
+#====================================================
+
+#====================================================
+# set DEBUG_sys to true to output calls of function
+typeset -r DEBUG_sys=${DEBUG_sys:=true}
+
+#====================================================
+# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
+typeset -r DRYRUN=${DRYRUN:=0}
+
+# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
+# -------------------------------------------------------------------------------------
+# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
+# |          |  Cp/Exe param files |            |  Chmod  |                           |
+# |          |      Qsub           |            |         |                           |
+# -------------------------------------------------------------------------------------
+# |    0     |       yes           |    yes     |  yes    |      yes                  |
+# -------------------------------------------------------------------------------------
+# |    1     |       yes           |    yes     |  yes    |      no                   |
+# -------------------------------------------------------------------------------------
+# |    2     |       yes           |    yes     |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+# |    3     |       yes           |    no      |  no     |      no                   |
+# -------------------------------------------------------------------------------------
+
+#=====================================================
+# Global Variables :
+#=====================================================
+# Language : "fr" or "en"
+typeset -r MYLANG="fr"
+
+#=====================================================
+# Host and user names 
+# $hostname ou hostname 
+typeset -r HOST=$( hostname )
+# $username ou whoami
+typeset -r LOGIN=$( whoami )
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+#typeset -r RSYNC=
+# RSYNC_opt args to "local rsync"
+#typeset -r RSYNC_FRONT="rsh rhodes /usr/bin/rsync "
+# RSYNC_opt args to rsync
+#typeset -r RSYNC_opt="-Lt -v"
+# RSYNC_opt args to "remote rsync"
+# ie storage filesystem
+#typeset -r RHOST=gaya.idris.fr
+#typeset -r REMOTE_RSYNC=
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${LOADL_STEP_INITDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=$( rsh gaya -n env | grep PWD | awk "-F=" '{print $2}' )
+
+#====================================================
+#- Mirror libIGCM from brodie to rhodes 
+typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=/u/rech/psl/rpsl035/IGCM}
+
+#====================================================
+#- OUT
+typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- OUT_POST 
+typeset -r R_OUT_POST=$( rsh rhodes -n echo $WORKDIR | awk "-F=" "{print $2}" )/IGCM_OUT 
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"}
+
+#D-#==================================================
+#D-function IGCM_sys_RshArchive
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshArchive :" $@
+    fi
+    rsh gaya exec /bin/ksh ${@}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_RshPost
+#D-* Purpose: Master rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+    rsh rhodes exec /bin/ksh ${@}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_RshPost : erreur."
+	IGCM_debug_Exit "IGCM_sys_RshPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RshPost"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mkdir
+#D-* Purpose: Master locale mkdir command
+#D-* Examples:
+#D-
+function IGCM_sys_Mkdir {
+    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mkdir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Mkdir : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Mkdir"
+	fi
+    fi
+    # vérification :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_Mkdir : erreur."
+	IGCM_debug_Exit "IGCM_sys_Mkdir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mkdir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirArchive
+#D-* Purpose: Mkdir on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirArchive {
+    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirArchive :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    rsh gaya -n mkdir -p $1
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_MkdirArchive : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_MkdirWork
+#D-* Purpose: Mkdir on Work
+#D-* Examples:
+#D-
+function IGCM_sys_MkdirWork {
+    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_MkdirWork :" $@
+    fi
+    #- creation de repertoire sur le serveur fichier
+    if [ ! -d ${1} ]; then 
+	\mkdir -p $1
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_MkdirWork : erreur."
+	    IGCM_debug_Exit "IGCM_sys_MkdirWork"
+	fi
+    fi
+    # vérification ?? :
+    if [ ! -d ${1} ] ; then
+	echo "IGCM_sys_MkdirWork : erreur."
+	IGCM_debug_Exit "IGCM_sys_MkdirWork"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+#IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+#echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok."
+
+#D-#==================================================
+#D-function IGCM_sys_Cd
+#D-* Purpose: master cd command
+#D-* Examples:
+#D-
+function IGCM_sys_Cd {
+    IGCM_debug_PushStack "IGCM_sys_Cd" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cd :" $@
+    fi
+    \cd $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Cd : erreur."
+	IGCM_debug_Exit "IGCM_sys_Cd"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cd"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Chmod
+#D-* Purpose: Chmod
+#D-* Examples:
+#D-
+function IGCM_sys_Chmod {
+    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Chmod :" $@
+    fi
+    if [ $DRYRUN -le 1 ]; then
+	\chmod $@
+	if [ $? -gt 0 ] ; then
+	    echo "IGCM_sys_Chmod : erreur."
+	    IGCM_debug_Exit "IGCM_sys_Chmod"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Chmod"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_FileSize
+#D-* Purpose: Filesize
+#D-* Examples:
+#D-
+function IGCM_sys_FileSize {
+    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
+
+    typeset sizeF
+    set +A sizeF -- $( ls -la ${1} )
+    if [ $? -gt 0 ] ; then
+	IGCM_debug_Exit "IGCM_sys_FileSize"
+    fi
+    eval ${2}=${sizeF[4]}
+
+    IGCM_debug_PopStack "IGCM_sys_FileSize"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDir
+#D-* Purpose: Test Directory that must exists
+#D-* Examples:
+#D-
+function IGCM_sys_TestDir {
+    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDir :" $@
+    fi
+    if [ ! -d ${1} ]; then
+	echo "IGCM_sys_TestDir : Directory $1 does not exist."
+	IGCM_debug_Exit "IGCM_sys_TestDir"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestDirArchive
+#D-* Purpose: Test Directory that must exists on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestDirArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestDirArchive :" $@
+    fi
+    TEST=$( rsh gaya -n "[ -d $1 ] && echo 1 || echo 0" )
+    if [ ${TEST} -ne 1 ] ; then
+	echo "IGCM_sys_TestDirArchive : Directory $1 does not exist on ${ARCHIVE}."
+	IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_TestFileArchive
+#D-* Purpose: Test file that must NOT EXISTS on Archive
+#D-* Examples:
+#D-
+function IGCM_sys_TestFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_TestFileArchive :" $@
+    fi
+    typeset RET 
+
+    mfls ${1} | grep ${1} > /dev/null 2>&1
+    RET=$?
+    if [ ${RET} -gt 0 ]; then
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 1
+    else
+	IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+	return 0
+    fi
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tree
+#D-* Purpose: Tree directories with files on ${ARCHIVE}
+#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
+#D-
+function IGCM_sys_Tree {
+    IGCM_debug_PushStack "IGCM_sys_Tree" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tree :" $@
+    fi
+
+    \mfls -r $@
+
+    IGCM_debug_PopStack "IGCM_sys_Tree"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Tar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_Tar {
+    IGCM_debug_PushStack "IGCM_sys_Tar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Tar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Tar : erreur."
+	IGCM_debug_Exit "IGCM_sys_Tar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Tar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_UnTar
+#D-* Purpose: master un-tar command
+#D-* Examples:
+#D-
+function IGCM_sys_UnTar {
+    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_UnTar :" $@
+    fi
+    \tar xvf $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_UnTar : erreur."
+	IGCM_debug_Exit "IGCM_sys_UnTar"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_UnTar"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Qsub
+#D-* Purpose: Qsub new job
+#D-* Examples:
+#D-
+function IGCM_sys_Qsub {
+    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Qsub :" $@
+    fi
+    /usr/local/bin/llsubmit < $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} $@."
+	IGCM_debug_Exit "IGCM_sys_Qsub"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Qsub"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_QsubPost
+#D-* Purpose: Qsub new job on scalaire
+#D-* Examples:
+#D-
+function IGCM_sys_QsubPost {
+    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_QsubPost :" $@
+    fi
+    /usr/bin/nqsII/qsub -q scalaire -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM_POST}/$1.job -v ${listVarEnv}
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_QsubPost : erreur " $@
+	IGCM_debug_Exit "IGCM_sys_QsubPost"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_QsubPost"
+}
+
+#D-*************************
+#D- File transfer functions 
+#D-*************************
+#D-
+
+#D-#==================================================
+#D-function IGCM_sys_Rsync_out
+#D-* Purpose: treat return val of rsync
+#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
+#D-  Error values and explanations can depend on your system version.
+function IGCM_sys_Rsync_out {
+    RET=$1
+    if [ ! $RET ] ; then
+	echo "rsync error !"
+    fi
+
+    if [ $MYLANG = "fr" ]; then
+	case $RET in
+	    0)  return ;;
+	    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
+		echo "Erreur de syntaxe ou d'utilisation."
+		return;;
+	    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
+		echo "Incompatibilité de protocole."
+		return;;
+	    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
+		echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
+		echo "répertoires"
+		return;;
+	    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
+		echo "Action demandée non supportée : une tentative de manipulation de"
+		echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
+		echo "été faite ; ou une option qui est supportée par le  client  mais"
+		echo "pas par le serveur a été spécifiée."
+		return;;
+	    10) echo "Erreur de rsync ; RERR_SOCKETIO"
+		echo "Erreur dans le socket d'entrée sortie"
+		return;;
+	    11) echo "Erreur de rsync ; RERR_FILEIO"
+		echo "Erreur d'entrée sortie fichier"
+		return;;
+	    12) echo "Erreur de rsync ; RERR_STREAMIO"
+		echo "Erreur dans flux de donnée du protocole rsync"
+		return;;
+	    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
+		echo "Erreur avec les diagnostics du programme"
+		return;;
+	    14) echo "Erreur de rsync ; RERR_IPC"
+		echo "Erreur dans le code IPC"
+		return;;
+	    20) echo "Erreur de rsync ; RERR_SIGNAL"
+		echo "SIGUSR1 ou SIGINT reçu"
+		return;;
+	    21) echo "Erreur de rsync ; RERR_WAITCHILD"
+		echo "Une erreur retournée par waitpid()"
+		return;;
+	    22) echo "Erreur de rsync ; RERR_MALLOC"
+		echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
+		return;;
+	    23) echo ""
+                echo "Erreur fichier inexistant"
+		return;;
+	    30) echo "Erreur de rsync ; RERR_TIMEOUT"
+		echo "Temps d'attente écoulé dans l'envoi/réception de données"
+		return;;
+	    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
+		return;;
+	esac
+    elif [ $MYLANG = "en" ] ; then
+	case $RET in
+	    0)  return;;		
+	    1)  echo "rsync error : Syntax or usage error "
+		return;;
+	    2)  echo "rsync error : Protocol incompatibility "
+		return;;
+	    3)  echo "rsync error : Errors selecting input/output files, dirs"
+		return;;
+	    4)  echo "rsync error : Requested action not supported: an attempt"
+		echo "was made to manipulate 64-bit files on a platform that cannot support"
+		echo "them; or an option was specified that is supported by the client and"
+		echo "not by the server."
+		return;;
+	    5)  echo "rsync error : Error starting client-server protocol"
+		return;;
+	    10) echo "rsync error : Error in socket I/O "
+		return;;
+	    11) echo "rsync error : Error in file I/O "
+		return;;
+	    12) echo "rsync error : Error in rsync protocol data stream "
+		return;;
+	    13) echo "rsync error : Errors with program diagnostics "
+		return;;
+	    14) echo "rsync error : Error in IPC code "
+		return;;
+	    20) echo "rsync error : Received SIGUSR1 or SIGINT "
+		return;;
+	    21) echo "rsync error : Some error returned by waitpid() "
+		return;;
+	    22) echo "rsync error : Error allocating core memory buffers "
+		return;;
+	    23) echo "rsync error : Partial transfer due to error"
+		return;;
+	    24) echo "rsync error : Partial transfer due to vanished source files"
+		return;;
+	    30) echo "rsync error : Timeout in data send/receive "
+		return;;
+	    *)  echo "rsync error : return code of rsync unknown :" $RET
+		return;;
+	esac
+    else
+	echo "unknown language $MYLANG."
+	return
+    fi
+}
+    
+
+#D-#==================================================
+#D-function IGCM_sys_Miror_libIGCM
+#D-* Purpose: Mirror libIGCM PATH and lib to rhodes
+#D-* Examples:
+#D-
+function IGCM_sys_Mirror_libIGCM {
+    IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mirror_libIGCM"
+    fi
+
+    typeset RET DEST
+    PATHlibIGCM=$( echo ${libIGCM} | awk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+
+    IGCM_sys_RshPost <<-EOF
+    mkdir -p ${PATHlibIGCM}
+EOF
+    rsh rhodes -n hostname > /dev/null 2>&1
+    RET=$?
+    if [ $RET -eq 0 ] ; then
+	echo rcp -r ${libIGCM} rhodes:${HOME}/${PATHlibIGCM} > out_rsync 2>&1
+	rcp -r ${libIGCM} rhodes:${HOME}/${PATHlibIGCM} >> out_rsync 2>&1
+	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on rhodes."
+	    cat out_rsync
+	fi
+    else
+	echo "No POST-TREATMENT avaible because rhodes is down."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+}
+
+#====================================================
+#- Call IGCM_sys_Mirror_libIGCM now !
+if ( $MirrorlibIGCM ) ; then
+    IGCM_sys_Mirror_libIGCM
+fi
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${HOME}/${PATHlibIGCM}/libIGCM
+
+#D-#==================================================
+#D-function IGCM_sys_Cp
+#D-* Purpose: generic cp
+#D-* Examples:
+#D-
+function IGCM_sys_Cp {
+    IGCM_debug_PushStack "IGCM_sys_Cp" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Cp :" $@
+    fi
+
+    typeset RET
+
+    echo cp $@ > out_rsync 2>&1
+    \cp $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Cp : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Cp"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Cp"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Mv
+#D-* Purpose: generic move
+#D-* Examples:
+#D-
+function IGCM_sys_Mv {
+    IGCM_debug_PushStack "IGCM_sys_Mv" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Mv :" $@
+    fi
+
+    typeset RET
+
+    echo mv $@ > out_rsync 2>&1
+    \mv $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mv : error in mv."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_Mv"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_Mv"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Rest
+#D-* Purpose: Put computied restarts on $(ARCHIVE).
+#D-           File and target directory must exist.
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Rest {
+    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Rest :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+	# Only if we use rsync
+	#IGCM_sys_MkdirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	mfput $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+	
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Rest : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Rest"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Put_Out
+#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
+#D-* Examples:
+#D-
+function IGCM_sys_Put_Out {
+    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Put_Out :" $@
+    fi
+    if [ $DRYRUN = 0 ]; then
+	if [ ! -f ${1} ] ; then
+	    echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
+	    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+	    return 1
+	fi
+
+	typeset RET
+	#
+	IGCM_sys_Chmod 444 ${1}
+	#
+	# Only if we use rsync
+	#IGCM_sys_MkdirArchive $( dirname $2 )
+	#
+	#USUAL WAY
+	mfput $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
+
+#  	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Out : error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Put_Out"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Out"
+    return 0
+}
+
+#D-#==================================================
+#D-function IGCM_sys_Get
+#D-* Purpose: Get a file from ${ARCHIVE}
+#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
+#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
+function IGCM_sys_Get {
+    IGCM_debug_PushStack "IGCM_sys_Get" $@
+
+    typeset DEST RET dm_liste ifile target
+
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Get :" $@
+    fi
+    if [ $DRYRUN -le 2 ]; then
+	if [ X${1} = X'/l' ] ; then
+            # test if the first file is present in the old computation :
+	    eval set +A dm_liste \${${2}}
+	else
+	    dm_liste=${1}
+	fi
+	eval DEST=\${${#}}
+
+        # test if the (first) file is present in the old computation :
+	IGCM_sys_TestFileArchive ${dm_liste[0]}
+	RET=$?
+        if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	    return
+        fi
+
+	# SD : dm_liste is not suited for computing job
+	#      because we change filename during transfert
+	#      dm_liste is better suited for post-treatment
+	#dm_liste=" "
+  	#(( ifile=1 ))
+	#while [ $ifile -lt $# ] ; do
+	#    dm_liste=$( eval echo ${dm_liste} " "\${${ifile}} )
+	#    (( ifile = ifile + 1 ))
+	#done
+	#DEST=$( eval echo \${${#}} )
+
+	#USUAL WAY
+	mfget ${dm_liste[*]} ${DEST} > out_rsync 2>&1
+	#mfget $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC_FRONT} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC_FRONT} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+# 	RET=$?
+#  	IGCM_sys_Rsync_out $RET
+
+#  	${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
+#  	(( RET=RET+$? ))
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Get : copy error."
+	    cat out_rsync
+	    IGCM_debug_Exit "IGCM_sys_Get"
+	fi
+    else
+	echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+############################################################## A REVOIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_Rapatrie
+#D-* Purpose: Rapatrie
+#D-* Examples:
+#D-
+function IGCM_sys_Rapatrie {
+    IGCM_debug_PushStack "IGCM_sys_Rapatrie" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_Rapatrie :" $@
+    fi
+
+    typeset RET=0
+
+    IGCM_sys_Get ${R_STOCKAGE}/$2 $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_Cd $1 ; 
+    let $(( RET=RET+$? ))
+    IGCM_sys_UnTar $2 ; 
+    let $(( RET=RET+$? ))
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Rapatrie : erreur."
+	IGCM_debug_Exit "IGCM_sys_Rapatrie"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Rapatrie"
+}
+
+############################################################## A FINIR !!
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichWork
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichWork {
+    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichWork :" $@
+    fi
+    # donne la date filesys d'un fichier sur la machine work
+    IGCM_debug_PopStack "IGCM_sys_FichWork"
+}
+
+#D-#==================================================
+#D-function IGCM_sys_GetDate_FichArchive
+#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
+#D-* Examples:
+#D-
+function IGCM_sys_GetDate_FichArchive {
+    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_GetDate_FichArchive :" $@
+    fi
+    IGCM_debug_PopStack "IGCM_sys_FichArchive"
+}
+
+##############################################################
+# REBUILD OPERATOR
+
+function IGCM_sys_rebuild {
+    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_rebuild :" $@
+    fi
+    /homegpfs/rech/psl/rpsl003/pub/bin/rebuild -f -o $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_rebuild : erreur ${@}."
+       IGCM_debug_Exit "rebuild"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_rebuild"
+}
+
+############################################################
+# Activate Running Environnment Variables
+
+function IGCM_sys_activ_variables {
+    IGCM_debug_PushStack "IGCM_sys_activ_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_activ_variables "
+    fi
+
+# --------------------------------------------------------------------
+#D- MPI specifications
+# --------------------------------------------------------------------
+
+#D-- MPISUSPEND
+    export MPISUSPEND=ON
+#D-- MPIPROGINF
+    export MPIPROGINF=ALL
+
+# --------------------------------------------------------------------
+#D- Other specifications
+# --------------------------------------------------------------------
+
+#D- max number of character/line in output job
+    export F_SYSLEN=5000
+#D- number of error that can be admitted on the NEC
+    export F_ERRCNT=0
+#D- global performance
+    export F_PROGINF=DETAIL
+#D- activate ftrace (with -ftrace)
+    export F_FTRACE=YES
+#D- communication information (with -ftrace)
+    export MPICOMMINF=ALL
+#D- I/O performance (FORTRAN I/O only not netCDF)
+    export F_FILEINF=NO
+# netCDF I/O performance
+    export NC_FILEINF=NO    
+
+    IGCM_debug_PopStack "IGCM_sys_activ_variables"
+
+}
+
+############################################################
+# Desactivate Running Environnment Variables
+
+function IGCM_sys_desactiv_variables {
+    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_desactiv_variables "
+    fi
+# --------------------------------------------------------------------
+#D- MPI specifications
+# --------------------------------------------------------------------
+
+#D-- MPIPROGINF
+    export MPIPROGINF=NO
+
+# --------------------------------------------------------------------
+#D- Other specifications
+# --------------------------------------------------------------------
+
+#D- global performance
+    export F_PROGINF=NO  
+
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+  
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file " $@
+    fi
+    (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 1 ))
+    (( NUM_PROC_OASIS = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
+    (( NUM_PROC_OCE = BATCH_NUM_PROC_TOT - NUM_PROC_ATM ))
+    
+    if [ $1 = MPI2 ]; then
+	cat <<EOF > run_file
+-p 1 -np 1 -e ./oasis
+EOF
+	(( NUM_PROCESS = BATCH_NUM_PROC_TOT + 1 ))
+	config_UserChoices_JobRunOptions='"-max_np ${NUM_PROCESS} -f"'
+
+    elif [ $1 = MPI1 ]; then
+	cat <<EOF > run_file
+-p $NUM_PROC_OASIS -e ./oasis
+-p $NUM_PROC_ATM -e ./lmdz.x
+-p $NUM_PROC_OCE -e ./opa.xx
+EOF
+ 
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+  
+}
Index: /tags/libIGCM_v1_1/run.card.init
===================================================================
--- /tags/libIGCM_v1_1/run.card.init	(revision 19)
+++ /tags/libIGCM_v1_1/run.card.init	(revision 19)
@@ -0,0 +1,38 @@
+# $Date: $
+# $Name: $
+# $Revision: $
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+# contient la date du run en cours ou du run en attente 
+# last date of loop == .suivi
+[Configuration]
+#last PREFIX
+OldPrefix=
+#Compute date of loop == .suivi
+PeriodDateBegin=
+PeriodDateEnd=
+CumulPeriod=
+# State of Job "Start", "Running", "OnQueue", "Completed"
+PeriodState="Start"
+
+# contient la trace des executions
+[PostProcessing]
+# postraitements state == .date
+PostState = Start
+
+MonitoringRunning=n
+MonitoringCompleted=
+
+TimeSeriesRunning=n
+TimeSeriesCompleted=
+
+SeasonalRunning=n
+SeasonalCompleted=
+
+# machine time == .log
+[Log]
+# Executables Size
+LastExeSize=()
+# CumulPeriod | PeriodDateBegin | PeriodDateEnd | RunDateBegin      | RunDateEnd        | RealCpuTime | UserCpuTime | SysCpuTime | ExeDate 
+ExeLog = \
