Index: /tags/libIGCM_v1_8/AA_TimeSeries_Checker
===================================================================
--- /tags/libIGCM_v1_8/AA_TimeSeries_Checker	(revision 333)
+++ /tags/libIGCM_v1_8/AA_TimeSeries_Checker	(revision 333)
@@ -0,0 +1,319 @@
+#!/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:
+#
+#**************************************************************
+
+# Check that everything went well during time series production
+# Display a short report
+# Launch what's missing
+
+#
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+
+#
+POST_DIR=${POST_DIR:=OutScript}
+
+# Type de run
+EXPERIMENT=${EXPERIMENT:=historical}
+
+# Type de run
+JobName=${JobName:=HISTORC2}
+
+#
+CURRENT_DIR=$( pwd )
+
+#
+CARD_DIR=${CURRENT_DIR}/${EXPERIMENT}/${JobName}
+
+if [ ! -d ${CARD_DIR} ]; then
+    echo "No ${CARD_DIR}, we stop here"
+    exit
+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
+. ${libIGCM}/libIGCM_date/libIGCM_date.ksh   #; IGCM_date_Check
+
+########################################################################
+
+# 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_SpaceName
+#IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
+IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
+IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
+echo
+
+#set -vx
+
+#====================================================
+#R_SAVE : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+
+IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
+
+for comp in ${config_ListOfComponents[*]} ; do
+    # Debug Print
+    IGCM_debug_Print 1 ${comp}
+    # Define component 
+    IGCM_card_DefineArrayFromOption ${CARD_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=${CARD_DIR}/COMP/${compname}.card
+
+    # Read and Build Output File stuff
+    #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${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
+	i=2
+	#
+	until [ $i -ge $NbFiles ]; do
+	    #
+	    eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	    #
+	    if [ X${flag_post} != XNONE ] ; then
+		#
+                # First of all
+                #
+		IGCM_card_DefineArrayFromSection ${card} ${flag_post}
+		#
+		IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars
+		IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches
+		if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not found ${flag_post}" ] ; then
+		    # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob.
+		    ListDimension[0]=2D
+		    ListDimension[1]=3D
+		    TimeSeries=false
+		    TimeSeries2D=false
+		    TimeSeries3D=false
+		    iLoop=${#ListDimension[*]}
+		    j=0
+		    until [ $j -ge ${iLoop} ]; do
+			Dimension=${ListDimension[${j}]}
+			IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars${Dimension}
+			IGCM_card_DefineVariableFromOption ${card} ${flag_post} ChunckJob${Dimension}
+		        #
+	                # Time series WITHOUT chunk
+	                #
+			if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
+			    if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then
+				IGCM_debug_Print 2 "${Dimension} time series activated for ${flag_post}"
+				eval TimeSeries${Dimension}=true
+				chunck=false
+			    fi
+			fi
+                        #
+	                # Time series WITH chunk
+		        #
+			if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
+			    chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} )
+			    if [ ! ${chunck_size} = NONE ] &&  [ ! ${chunck_size} = OFF ] ; then
+				IGCM_debug_Print 2 "${Dimension} time series activated with ${chunck_size} chunck for ${flag_post}"
+				eval TimeSeriesChunck${Dimension}=true
+				chunck=true
+			    fi
+			fi
+			(( j=j+1 ))
+
+			#
+			#  ICI ON TEST QUE LES FICHIERS TS SONT LA!
+			#
+			#
+			FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
+			IGCM_card_DefineArrayFromOption ${card}    Post_${FILE} TimeSeriesVars${Dimension}
+			IGCM_card_DefineVariableFromOption ${card} Post_${FILE} ChunckJob${Dimension}
+			#
+			FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' )
+			case ${FlagDir} in
+			    *Y)  TS_Dir=TS_YE  ;;
+			    *M)  TS_Dir=TS_MO  ;;
+			    *D)  TS_Dir=TS_DA  ;;
+			 3H|HF)  TS_Dir=TS_HF  ;;
+			   INS) TS_Dir=TS_INS ;;
+			esac
+
+	                #
+		        # If TimeSeriesVars list is empty we skip
+		        #
+			if [ $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
+			    #(( i=i+3 ))
+			    continue
+			fi
+		        #
+	                # We need LIST of variables not allready produced (useful for standalone mode)
+	                #
+			DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
+			DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
+
+			IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
+			IGCM_date_GetYearMonth ${DateEnd}   YearEnd   MonthEnd
+
+			# Si on n'a pas de chunck, dans ce cas chunck_size=la durÃ©e de la simulation en annÃ©es
+			YearsChunckLength=$( echo ${chunck_size} | sed -e "s/[yY]//" )
+			[ ${chunck} = false ] && YearsChunckLength=$( expr \( ${YearEnd} \- ${YearBegin} \+ 1 \) )
+
+			NbYearsChunckLoop=$( expr \( ${YearEnd} \- ${YearBegin} \+ 1 \) / ${YearsChunckLength} )
+			Reste=$( expr \( ${YearEnd} \- ${YearBegin} \+ 1 \) % ${YearsChunckLength} )
+
+			if [ ${Reste} != 0 ] ; then
+			    NbYearsChunckLoop=$( expr ${NbYearsChunckLoop} + 1 )
+			fi
+
+			if [ ${NbYearsChunckLoop} -eq 1 ] ; then
+			    PeriodDateEnd=${DateEnd}
+			else
+			    DaysInYear=$( IGCM_date_DaysInYear ${YearBegin} )
+			    PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( YearsChunckLength * DaysInYear - 1 )) )
+			fi
+	                #
+			DIRECTORY=${R_SAVE}/${comp}/Analyse/${TS_Dir}
+			YearsChunckLoop=1
+			ChunckDebut=${DateBegin}
+			ChunckFin=${PeriodDateEnd}
+			while [ ${YearsChunckLoop} -le ${NbYearsChunckLoop} ] ; do
+			    countTotal=0
+			    countGood=0
+			    countBad=0
+			    for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do
+				TestedFile=${config_UserChoices_JobName}_${ChunckDebut}_${ChunckFin}_${FlagDir}_${var}.nc
+	                        #
+				if [ ! -f ${DIRECTORY}/${TestedFile} ] ; then
+				    (( countBad = countBad + 1 ))
+				    [ ${countBad} = 1 ] && IGCM_debug_Print 3 "Missing time series from ${FILE} :"
+				    IGCM_debug_Print 3 ${DIRECTORY}/${TestedFile}
+				else
+				    (( countGood = countGood + 1 ))
+				fi
+				(( countTotal = countTotal + 1 ))
+			    done
+
+			    SuccessRate=$(( countGood * 100 / countTotal ))
+			    if [ ! ${SuccessRate} = 100 ] ; then
+				IGCM_debug_Print 2 -e "\033[1;31m${SuccessRate}% files OK.\033[m for period ${ChunckDebut}-${ChunckFin}"
+			    else
+				IGCM_debug_Print 2 -e "\033[1;32m${SuccessRate}% files OK.\033[m for period ${ChunckDebut}-${ChunckFin}"
+			    fi
+
+			    echo
+			    if ( [ ${chunck} = true ] && [ ! ${SuccessRate} = 100 ] ) ; then
+				IGCM_debug_Print 2 -e "\033[1;31mSubmit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin}"
+				listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,TsTask,CompToRead,FlagToRead"
+				export libIGCM=${libIGCM}
+				export SUBMIT_DIR=${CARD_DIR}
+				export POST_DIR=${POST_DIR}
+				export DateBegin=${ChunckDebut}
+				export PeriodDateEnd=${ChunckFin}
+				export TsTask=Chunck${Dimension}
+				export CompToRead=${comp}
+				export FlagToRead=${i}
+				export listVarEnv=${listVarEnv}
+                                IGCM_sys_MkdirWork ${POST_DIR}
+                                IGCM_debug_Verif_Exit
+                                IGCM_sys_QsubPost create_ts
+				echo
+			    fi
+
+			    if ( [ ${chunck} = false ] && [ ! ${SuccessRate} = 100 ] ) ; then
+				eval Launch${Dimension}=true
+			    fi
+
+			    # Date update
+			    ChunckDebut=$( IGCM_date_AddDaysToGregorianDate ${ChunckFin} 1 )
+
+			    (( YearsChunckLoop = YearsChunckLoop + 1 ))
+
+			    if [ ${YearsChunckLoop} -eq ${NbYearsChunckLoop} ] ; then 
+				ChunckFin=${DateEnd}
+			    else
+				#PeriodDateEnd=$( expr ${YearBegin} + ${YearsChunckLength} - 1 )
+				ChunckFin=$( IGCM_date_AddDaysToGregorianDate ${ChunckDebut} $(( YearsChunckLength * DaysInYear - 1 )) )
+			    fi
+			done
+		    done
+		else
+		    ListDimension[0]=""
+		    TimeSeries=true
+		    TimeSeries2D=false
+		    TimeSeries3D=false
+		    TimeSeriesChunck2D=false
+		    TimeSeriesChunck3D=false
+		fi
+	    fi
+	    (( i=i+3 ))
+	done
+    fi
+done # comp loop
+
+echo
+
+if [ X${Launch2D} = Xtrue ] ; then
+    IGCM_debug_Print 2 -e "\033[1;31mSubmit 2D\033[m without chunck period ${DateBegin}-${DateEnd}"
+    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,TsTask"
+    export libIGCM=${libIGCM}
+    export SUBMIT_DIR=${CARD_DIR}
+    export POST_DIR=${POST_DIR}
+    export DateBegin=${DateBegin}
+    export PeriodDateEnd=${DateEnd}
+    export TsTask=2D
+    export listVarEnv=${listVarEnv}
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit
+    IGCM_sys_QsubPost create_ts
+    echo
+fi
+
+if [ X${Launch3D} = Xtrue ] ; then
+    IGCM_debug_Print 2 -e "\033[1;31mSubmit 3D\033[m without chunck period ${DateBegin}-${DateEnd}"
+    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,TsTask"
+    export libIGCM=${libIGCM}
+    export SUBMIT_DIR=${CARD_DIR}
+    export POST_DIR=${POST_DIR}
+    export DateBegin=${DateBegin}
+    export PeriodDateEnd=${DateEnd}
+    export TsTask=3D
+    export listVarEnv=${listVarEnv}
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit
+    IGCM_sys_QsubPost create_ts
+    echo
+fi
Index: /tags/libIGCM_v1_8/AA_additionnal
===================================================================
--- /tags/libIGCM_v1_8/AA_additionnal	(revision 333)
+++ /tags/libIGCM_v1_8/AA_additionnal	(revision 333)
@@ -0,0 +1,160 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r ATL_ADD        # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 2              # Reservation du processus
+#-Q- cesium #MSUB -c 4              # Reservation du core
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-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 #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = ATL_ADD
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $POST_DIR ; $SUBMIT_DIR ; $libIGCM ; $R_INIT ; $R_BC ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $R_SAVE ; $config_UserChoices_JobName ; $config_UserChoices_TagName ; $YEARS ; $MASTER
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 10:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = ATL_ADD
+#-Q- aix6 # Fichier de sortie standard du travail   
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $POST_DIR ; $SUBMIT_DIR ; $libIGCM ; $R_INIT ; $R_BC ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $R_SAVE ; $config_UserChoices_JobName ; $config_UserChoices_TagName ; $YEARS ; $MASTER
+#-Q- aix6 # @ queue
+#-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- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #########################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure #########################
+#-Q- sx9mercure #MSUB -r ATL_ADD        # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 2              # Reservation du processus
+#-Q- sx9mercure #MSUB -c 4              # Reservation du core
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r ATL_ADD        # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 2              # Reservation du processus
+#-Q- titane #MSUB -c 4              # Reservation du core
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-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 -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+#########################################################################
+
+. ${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
+
+#######################################################################
+
+#set -vx
+
+#===========================================
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_OCE=${R_SAVE}/OCE
+
+RUN_DIR=${RUN_DIR_PATH}/ATLAS_ADD_${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_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_T.nc ${RUN_DIR}/SE_grid_T.nc
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_U.nc ${RUN_DIR}/SE_grid_U.nc
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_V.nc ${RUN_DIR}/SE_grid_V.nc
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_W.nc ${RUN_DIR}/SE_grid_W.nc
+
+atlas -o ${RUN_DIR}/${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
+IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS}
+[ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
Index: /tags/libIGCM_v1_8/AA_atlas_LMDZ
===================================================================
--- /tags/libIGCM_v1_8/AA_atlas_LMDZ	(revision 333)
+++ /tags/libIGCM_v1_8/AA_atlas_LMDZ	(revision 333)
@@ -0,0 +1,204 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r ATL_LMDZ       # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-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 #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = ATL_LMDZ
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $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 ; $MASTER ; $libIGCM_SX
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 10:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = ATL_LMDZ
+#-Q- aix6 # Fichier de sortie standard du travail       
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $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 ; $MASTER ; $libIGCM_SX
+#-Q- aix6 # @ queue
+#-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- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #########################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure #########################
+#-Q- sx9mercure #MSUB -r ATL_LMDZ       # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r ATL_LMDZ       # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-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 -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+######################################################################
+
+. ${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
+
+######################################################################
+
+#set -vx
+
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+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_SpaceName
+IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+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 : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+#
+
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_ATM=${R_SAVE}/ATM
+
+RUN_DIR=${RUN_DIR_PATH}/ATLAS_LMDZ_${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_ATM}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc ${RUN_DIR}
+
+# Only LMDZ4 output have Alt variables
+DetectLev=$( ncdump -h ${config_UserChoices_JobName}_SE_${YEARS}_1M_histmth.nc | grep "Alt(Alt)" | wc -l )
+#
+[ ${DetectLev} = 1 ] && LMDZ=LMDZ4 || LMDZ=LMDZ3.3
+#
+atlas -o ${RUN_DIR}/${R_ATLAS}/ATM -l ${FER_ATLAS}/atlas_p_${LMDZ}_diag1_*.cfg ${RUN_DIR}/${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
+IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS}
+[ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+# Clean RUN_DIR_PATH (necessary for cesium)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /tags/libIGCM_v1_8/AA_atlas_ORCA_LIM
===================================================================
--- /tags/libIGCM_v1_8/AA_atlas_ORCA_LIM	(revision 333)
+++ /tags/libIGCM_v1_8/AA_atlas_ORCA_LIM	(revision 333)
@@ -0,0 +1,244 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r ATL_OPA        # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-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 #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = ATL_OPA
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $POST_DIR ; $SUBMIT_DIR ; $libIGCM ; $R_INIT ; $R_BC ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $R_SAVE ; $config_UserChoices_JobName ; $config_UserChoices_TagName ; $YEARS ; $MASTER ; $libIGCM_SX
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 10:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = ATL_OPA
+#-Q- aix6 # Fichier de sortie standard du travail       
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $POST_DIR ; $SUBMIT_DIR ; $libIGCM ; $R_INIT ; $R_BC ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $R_SAVE ; $config_UserChoices_JobName ; $config_UserChoices_TagName ; $YEARS ; $MASTER ; $libIGCM_SX
+#-Q- aix6 # @ queue
+#-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- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #########################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure #########################
+#-Q- sx9mercure #MSUB -r ATL_OPA        # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r ATL_OPA        # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-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 -eu
+#set -vx 
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+########################################################################
+
+. ${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
+
+########################################################################
+
+#set -vx 
+
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+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_SpaceName
+IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+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 : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+#
+
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_OCE=${R_SAVE}/OCE
+R_OUT_ICE=${R_SAVE}/ICE
+
+RUN_DIR=${RUN_DIR_PATH}/ATLAS_ORCALIM_${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_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_T.nc  ${RUN_DIR}
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_U.nc  ${RUN_DIR}
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_V.nc  ${RUN_DIR}
+IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_W.nc  ${RUN_DIR}
+IGCM_sys_Get ${R_OUT_ICE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_icemod.nc  ${RUN_DIR}
+
+atlas -o ${RUN_DIR}/${R_ATLAS}/OCE_T -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag1_[ab].cfg     ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_T.nc
+atlas -o ${RUN_DIR}/${R_ATLAS}/OCE_U -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag0_U.cfg        ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_U.nc
+atlas -o ${RUN_DIR}/${R_ATLAS}/OCE_V -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag0_V.cfg        ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_V.nc
+#atlas -o ${RUN_DIR}/${R_ATLAS}/OCE_W -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag0_W.cfg        ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_W.nc
+atlas -o ${RUN_DIR}/${R_ATLAS}/OCE   -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}_diag0_[def].cfg     ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_grid_T.nc
+atlas -o ${RUN_DIR}/${R_ATLAS}/ICE   -l ${FER_ATLAS}/atlas_p_${RESOL_OCE}LIM_diag0_[abc].cfg ${RUN_DIR}/${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
+
+# WHILE WAITING FOR A MORE GENERIC SOLUTION
+if ( [ ${config_UserChoices_TagName} = "IPSLCM5" ] || [ ${config_UserChoices_TagName} = "IPSLCM5A" ] || [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ] || [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ] ) ; then
+    IGCM_sys_Get ${R_OUT_OCE}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_diaptr.nc  ${RUN_DIR} ;
+    atlas -o ${RUN_DIR}/${R_ATLAS}/ZNL   -d -l ${FER_ATLAS}/atlas_l_${RESOL_OCE}_znl.cfg         ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_diaptr.nc ;
+    for file in $( ls ${R_ATLAS}/ZNL/*/*jnl ) ; do
+	echo -e "\n\n################################" ;
+	echo -e "$file\n" ; cat $file ;
+    done > ${R_ATLAS}/ZNL/allferretscript.txt
+fi
+
+# 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      
+# WHILE WAITING FOR A MORE GENERIC SOLUTION
+if ( [ ${config_UserChoices_TagName} = "IPSLCM5" ] || [ ${config_UserChoices_TagName} = "IPSLCM5A" ] || [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ] || [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ] ) ; then
+    IGCM_sys_Rm ${config_UserChoices_JobName}_SE_${YEARS}_1M_diaptr.nc ; 
+fi
+
+# DODS copy
+IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS}
+[ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+# Clean RUN_DIR_PATH (necessary for cesium)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /tags/libIGCM_v1_8/AA_atlas_ORCHIDEE
===================================================================
--- /tags/libIGCM_v1_8/AA_atlas_ORCHIDEE	(revision 333)
+++ /tags/libIGCM_v1_8/AA_atlas_ORCHIDEE	(revision 333)
@@ -0,0 +1,209 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r ATL_ORCH       # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-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 #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = ATL_ORCH
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $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 ; $MASTER ; $libIGCM_SX
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 10:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = ATL_ORCH
+#-Q- aix6 # Fichier de sortie standard du travail       
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $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 ; $MASTER ; $libIGCM_SX
+#-Q- aix6 # @ queue
+#-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- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #########################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure #########################
+#-Q- sx9mercure #MSUB -r ATL_ORCH       # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r ATL_ORCH       # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N ATL_ORCH
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o ATL_ORCH.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-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 -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+########################################################################
+
+. ${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
+
+########################################################################
+
+#set -vx 
+
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+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_SpaceName
+IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+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 : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+#
+
+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
+IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS}
+[ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+# Clean RUN_DIR_PATH (necessary for cesium)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /tags/libIGCM_v1_8/AA_atlas_PISCES
===================================================================
--- /tags/libIGCM_v1_8/AA_atlas_PISCES	(revision 333)
+++ /tags/libIGCM_v1_8/AA_atlas_PISCES	(revision 333)
@@ -0,0 +1,209 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r ATL_PIS        # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ##################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ##################
+#-Q- platine #BSUB -J ATL_PIS           # 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 #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = ATL_PIS
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $POST_DIR ; $SUBMIT_DIR ; $libIGCM ; $R_INIT ; $R_BC ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $R_SAVE ; $config_UserChoices_JobName ; $config_UserChoices_TagName ; $YEARS ; $MASTER ; $libIGCM_SX
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 10:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = ATL_PIS
+#-Q- aix6 # Fichier de sortie standard du travail       
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $POST_DIR ; $SUBMIT_DIR ; $libIGCM ; $R_INIT ; $R_BC ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $R_SAVE ; $config_UserChoices_JobName ; $config_UserChoices_TagName ; $YEARS ; $MASTER ; $libIGCM_SX
+#-Q- aix6 # @ queue
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N  ATL_PIS             # 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- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #########################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure #########################
+#-Q- sx9mercure #MSUB -r ATL_PIS        # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r ATL_PIS        # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+# $Date: 2010-01-22 12:24:21 +0100 (Fri, 22 Jan 2010) $
+# $Author: aclsce $
+# $Revision: 215 $
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+#set -eu
+#set -vx 
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+########################################################################
+
+. ${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
+
+########################################################################
+
+#set -vx 
+
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+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_SpaceName
+IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+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 : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+#
+
+R_ATLAS=ATLAS/SE_${YEARS}
+R_OUT_MBG=${R_SAVE}/MBG
+
+RUN_DIR=${RUN_DIR_PATH}/ATLAS_PISCES_${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_MBG}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_ptrc_T.nc  ${RUN_DIR}
+IGCM_sys_Get ${R_OUT_MBG}/Analyse/SE/${config_UserChoices_JobName}_SE_${YEARS}_1M_diad_T.nc  ${RUN_DIR}
+
+atlas -o ${RUN_DIR}/${R_ATLAS}/MBG_T -l ${FER_ATLAS}/atlas_p_PISCES_diag1_*.cfg  \
+                                        ${FER_ATLAS}/atlas_p_PISCES_diag0_a.cfg  ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_ptrc_T.nc
+atlas -o ${RUN_DIR}/${R_ATLAS}/MBG_F -l ${FER_ATLAS}/atlas_p_PISCES_diag2_a.cfg  \
+                                        ${FER_ATLAS}/atlas_p_PISCES_diag0_b.cfg  ${RUN_DIR}/${config_UserChoices_JobName}_SE_${YEARS}_1M_diad_T.nc
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Put ferret journal files together
+for file in $( ls ${R_ATLAS}/MBG_T/*/*jnl ) ; do
+    echo -e "\n\n################################" ;
+    echo -e "$file\n" ; cat $file ;
+done  > ${R_ATLAS}/MBG_T/allferretscript.txt
+
+for file in $( ls ${R_ATLAS}/MBG_F/*/*jnl ) ; do
+    echo -e "\n\n################################" ;
+    echo -e "$file\n" ; cat $file ;
+done  > ${R_ATLAS}/MBG_F/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_ptrc_T.nc
+IGCM_sys_Rm ${config_UserChoices_JobName}_SE_${YEARS}_1M_diad_T.nc
+
+# DODS copy
+IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS}
+[ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
+
+# Clean RUN_DIR_PATH (necessary for cesium)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /tags/libIGCM_v1_8/AA_clean_month
===================================================================
--- /tags/libIGCM_v1_8/AA_clean_month	(revision 333)
+++ /tags/libIGCM_v1_8/AA_clean_month	(revision 333)
@@ -0,0 +1,138 @@
+#!/usr/bin/ksh
+
+# $Date: $
+# $Author: $
+# $Revision: $
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+#set -eu
+#set -vx
+
+libIGCM=::modipsl::/libIGCM
+
+#D--------------------------------------------------------------------==
+#D-                   -1. User modification place
+#D--------------------------------------------------------------------==
+
+#D- Increased verbosity (1, 2, 3)
+Verbosity=3
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default=true
+DEBUG_debug=false
+
+#D--------------------------------------------------------------------==
+
+echo "clean month script :"
+echo "Script used to clean a month on SAVE directory !"
+echo "This script will erase some files !!! Be careful and read all informations !"
+echo "----"
+echo "It must be called in Experience directory (so-called SUBMIT_DIR)."
+echo "----"
+
+#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
+#-------
+SUBMIT_DIR=${pwd}
+. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
+. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
+
+
+#==================================
+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
+if [ 3 -le ${Verbosity} ] ; then
+	echo "--------------Debug3-->" "config_UserChoices_LongName="
+	echo "--------------Debug3-->" \"${config_UserChoices_LongName}\"
+fi
+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
+
+#====================================================
+#R_SAVE : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+IGCM_sys_TestDirArchive ${R_SAVE}
+[ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+
+if [ ! -f ${SUBMIT_DIR}/run.card ]; then 
+    echo "You seem NOT to have a run.card in this directory !!"
+    echo "This script will fail because it doesn't know what to do without run.card avaible."
+    exit 1
+else
+    #===================================#
+    #        Read updated run.card      #
+    #===================================#
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
+    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
+
+    PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} )
+    echo "Search files with ${PeriodDateEnd} in ${R_SAVE}"
+    set +A ListFiles -- $( IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" " )
+    CountListFiles=${#ListFiles[@]}
+
+    IGCM_debug_Print 1 "Number of files to be erased : ${CountListFiles}."
+    if [ ${CountListFiles} -gt 0 ] ; then 
+	for file in ${ListFiles[@]} ; do
+	    IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m"
+	done
+
+	echo "\033[1;32mDo you REALLY want to erase all those files ?"
+	echo -n " Your answer (y/n) : \033[m"
+	read reponse
+	case ${reponse} in
+	    
+	    oui|OUI|o|y|yes|YES)
+		echo "OK. It will be erased."
+		IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;"
+		echo "done."
+		;;
+	    non|NON|n|no|NO)
+		echo "Nothing to do !"
+		;;
+	esac
+    fi
+    
+    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
+    if ( [ ${run_Configuration_PeriodState} != "Running" ] && [ ${run_Configuration_PeriodState} != "OnQueue" ] && [ ${run_Configuration_PeriodState} != "Continue" ] ) ; then
+	echo -e "\033[1;32mNOW do you want to continue the simulation (Set PeriodState=OnQueue into run.card) ?"
+	echo -n -e " Your answer (y/n) : \033[m"
+	read reponse
+	case ${reponse} in
+	    
+	    oui|OUI|o|y|yes|YES)
+		echo "OK. Now you can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}."
+		IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue"
+		;;
+	    non|NON|n|no|NO)
+		echo "Nothing to do !"
+		;;
+	esac
+    else
+	echo "You can submit the Job : ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}."
+    fi
+fi
+exit 0
Index: /tags/libIGCM_v1_8/AA_create_se
===================================================================
--- /tags/libIGCM_v1_8/AA_create_se	(revision 333)
+++ /tags/libIGCM_v1_8/AA_create_se	(revision 333)
@@ -0,0 +1,635 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r SE             # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-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 #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 20:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = SE
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 20:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = SE
+#-Q- aix6 # Fichier de sortie standard du travail       
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
+#-Q- aix6 # @ queue
+#-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- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #########################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure #########################
+#-Q- sx9mercure #MSUB -r SE             # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r SE             # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N SE
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o SE.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-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 -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+# WARNING for StandAlone used : To run this script on some machine,
+# you must check MirrorlibIGCM variable in sys library.
+# If this variable is true, you must use libIGCM_POST path instead
+# of your running libIGCM directory.
+
+#D- Flag to determine if rebuild process has been performed asynchronously
+#D- Possible value true or false. 
+#D- If true raw files has allready been patched by rebuild job
+#D- If false create_ts will patch the raw files
+#D- Default : Value from AA_job if any. Usefull in StandAlone case.
+RebuildFrequency=${RebuildFrequency:=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- TEMPORARY Flag to determine atmospheric resolution
+#D- Default : value from atmospheric driver if any
+RESOL_ATM=${RESOL_ATM:=ALL}
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SRF=ALL
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SBG=ALL
+
+#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- TEMPORARY Flag to determine marine biogeochemistry resolution
+#D- Default : value from ice driver if any
+RESOL_MBG=${RESOL_MBG:=ORCA2}
+
+########################################################################
+
+. ${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
+
+########################################################################
+
+#set -vx
+
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+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_SpaceName
+IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+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 : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+#
+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=$(( $( 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
+	#
+	# INITIALISATION
+	#
+	eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+	typeset i=2
+	#
+	until [ $i -gt $NbFiles ]; do
+	    #
+	    eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	    #
+	    if [ X${flag_post} != XNONE ] ; then
+		#
+		# Check if seasonal is required for this file
+		#
+		IGCM_card_DefineArrayFromSection ${card} ${flag_post}
+		#
+		# Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
+		#
+		# variable option allready typeset above
+		for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
+		    if [ ${option} = Seasonal ] ; then
+			FoundSeasonal=true
+			IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
+		    fi
+		done
+		#
+		if [ ! X${FoundSeasonal} = Xtrue ] ; then
+		    eval ${compname}_${flag_post}_Seasonal=ON
+		fi
+		#
+		if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
+		    (( i=i+3 ))
+		    continue
+		fi
+		#
+	        # CREATE LIST
+	        #
+		FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
+		#
+		DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
+	        #
+		TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
+	        #
+		IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile}
+		if [ ! $? = 0 ] ; then
+		    eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE}
+		    if [ ! ${RebuildFrequency} = true ] ; then
+			IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
+			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
+		fi
+	    fi
+	    (( i=i+3 ))
+	done # until [ $i -eq $NbFiles ]
+    fi
+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  ;;
+	    3H)    FreqDir=HF  ;;
+	    INS)   FreqDir=INS ;;
+        esac
+	#
+	RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc
+	# Do not redoo an existing SE
+	IGCM_sys_TestFileArchive ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE}
+	if [ $? = 0 ] ; 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
+	  unset liste_file_se
+	  unset 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
+	      liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
+	      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 [ ! ${RebuildFrequency} = true ] ; then
+	      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
+	  fi
+	      	      
+	  # Search of common list of variables to be treated
+	  nbfile=0
+	  for file_common_var in ${liste_file_se_tmp[*]} ; do
+	      ncks -m ${file_common_var} | grep '# dim. =' | cut -d ':' -f 1 >> tmpfile_ncra
+	      (( nbfile = nbfile + 1 ))
+	  done
+	  list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
+	  IGCM_sys_Rm tmpfile_ncra
+
+	  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 -v ${list_var_final_ncra} -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
+	      unset liste_file_se
+	      unset 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
+		  liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
+		  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 [ ! ${RebuildFrequency} = true ] ; then
+		  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
+	      fi
+	      
+	      # Search of common list of variables to be treated
+              nbfile=0
+	      for file_common_var in ${liste_file_se_tmp[*]} ; do
+                  ncks -m ${file_common_var} | grep '# dim. =' | cut -d ':' -f 1 >> tmpfile_ncra
+                  (( nbfile = nbfile + 1 ))
+	      done
+              list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
+	      IGCM_sys_Rm tmpfile_ncra
+	      IGCM_sys_ncra -O -v ${list_var_final_ncra} ${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
+	      unset liste_file_se
+	      unset 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
+		      liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
+		      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 [ ! ${RebuildFrequency} = true ] ; then
+		  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
+	      fi
+
+              # Search of common list of variables to be treated
+              nbfile=0
+	      for file_common_var in ${liste_file_se_tmp[*]} ; do
+                  ncks -m ${file_common_var} | grep '# dim. =' | cut -d ':' -f 1 >> tmpfile_ncra
+                  (( nbfile = nbfile + 1 ))
+	      done
+              list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
+	      IGCM_sys_Rm tmpfile_ncra
+
+	      IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
+	      IGCM_sys_Rm ${liste_file_se_tmp[*]}
+	      eval ExitFlag=false
+	      IGCM_debug_Verif_Exit_Post
+	  done
+	  ;;
+        esac
+	#
+
+        # Search of common list of variables to be treated
+        nbfile=0
+        for file_common_var in ${OUT_SE[*]} ; do
+           ncks -m ${file_common_var} | grep '# dim. =' | cut -d ':' -f 1 >> tmpfile_ncrcat
+           (( nbfile = nbfile + 1 ))
+        done
+        list_var_final_ncrcat=`cat tmpfile_ncrcat | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
+        IGCM_sys_Rm tmpfile_ncrcat
+
+	IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE}
+	#
+	IGCM_sys_Rm ${OUT_SE[*]}
+	#
+        if [ ${comp} = "CPL" ] ; then
+	      ${ncatted} -a modulo,time,c,c," " ${RESULT_SE}
+        else
+	      ${ncatted} -a modulo,time_counter,c,c," " ${RESULT_SE}
+        fi
+	#
+	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
+    IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/SE
+    [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/SE
+done
+
+YEARS=${an_deb}_${an_fin}
+
+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_MBG ; export RESOL_SRF ; export RESOL_SBG
+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_MBG,RESOL_SRF,RESOL_SBG,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} = "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} = "IPSLCM5" ]  || \
+     [ ${config_UserChoices_TagName} = "IPSLCM5A" ] ; then
+    IGCM_sys_QsubPost atlas_ORCHIDEE     ;
+    IGCM_sys_QsubPost atlas_LMDZ         ;
+    IGCM_sys_QsubPost atlas_ORCA_LIM     ;
+    IGCM_sys_QsubPost atlas_PISCES       ;
+    #
+elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ]  || \
+     [ ${config_UserChoices_TagName} = "LMDZOR" ]   || \
+     [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then
+    #
+    IGCM_sys_QsubPost atlas_LMDZ         ;
+    IGCM_sys_QsubPost atlas_ORCHIDEE     ;
+    #
+elif [ ${config_UserChoices_TagName} = "LMDZ" ] ; then
+    #
+    IGCM_sys_QsubPost atlas_LMDZ         ;
+    #
+elif [ ${config_UserChoices_TagName} = "OL" ]      || \
+     [ ${config_UserChoices_TagName} = "OL2" ] ; then
+    #
+    IGCM_sys_QsubPost atlas_ORCHIDEE     ;
+    #
+elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ]       ||
+     [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ] ; then
+    #
+    IGCM_sys_QsubPost atlas_ORCA_LIM     ;
+#    IGCM_sys_QsubPost additionnal        ;
+elif [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ]  ; then
+    #
+    IGCM_sys_QsubPost atlas_ORCA_LIM     ;
+    IGCM_sys_QsubPost atlas_PISCES       ;
+#    IGCM_sys_QsubPost additionnal        ;
+elif [ ${config_UserChoices_TagName} = "ORCA2_OFF_PISCES" ]  ; then
+    #
+    IGCM_sys_QsubPost atlas_PISCES       ;
+    #
+fi
+
+# Clean RUN_DIR_PATH (necessary for cesium)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /tags/libIGCM_v1_8/AA_create_ts
===================================================================
--- /tags/libIGCM_v1_8/AA_create_ts	(revision 333)
+++ /tags/libIGCM_v1_8/AA_create_ts	(revision 333)
@@ -0,0 +1,927 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r TS             # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-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 #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 20:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = TS
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 20:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = TS
+#-Q- aix6 # Fichier de sortie standard du travail
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
+#-Q- aix6 # @ queue
+#-Q- sx8brodie # @ queue
+#-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=24:00:00   # Limite temps a 2 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #########################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure #########################
+#-Q- sx9mercure #MSUB -r TS             # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r TS             # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N TS
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o TS.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-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 -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+# WARNING for StandAlone used : To run this script on some machine,
+# you must check MirrorlibIGCM variable in sys library.
+# If this variable is true, you must use libIGCM_POST path instead
+# of your running libIGCM directory.
+
+#D- Flag to determine allready produced time series. Empty if you start from the beginning
+#D- Default : Value from AA_job if any. Usefull in StandAlone case if you want to continue a time series
+CompletedFlag=${CompletedFlag:=}
+
+#D- Flag to determine task type this script will perform.
+#D- Possible Value : 2D, 3D, Chunck2D, Chunck3D
+#D- Default : Value from AA_job if any. Usefull in StandAlone case.
+TsTask=${TsTask:=2D}
+if [ X${TsTask} = Xempty ] ; then
+    TsTask=""
+fi
+
+#D- Flag to determine if rebuild process has been performed asynchronously
+#D- Possible value true or false. 
+#D- If true raw files has allready been patched by rebuild job
+#D- If false create_ts will patch the raw files
+#D- Default : Value from AA_job if any. Usefull in StandAlone case.
+RebuildFrequency=${RebuildFrequency:=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- TEMPORARY Flag to determine atmospheric resolution
+#D- Default : value from atmospheric driver if any
+RESOL_ATM=ALL
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SRF=ALL
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SBG=ALL
+
+#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- TEMPORARY Flag to determine marine biogeochemistry resolution
+#D- Default : value from ice driver if any
+RESOL_MBG=${RESOL_MBG:=ORCA2}
+
+########################################################################
+
+. ${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
+
+########################################################################
+
+#set -vx
+
+# Useful cleaning function
+MENAGE () 
+{
+    [ -f $3 ] && ( IGCM_sys_RshArchive rm -f $1/$2 ;)
+}
+
+########################################################################
+
+IGCM_sys_MkdirWork ${RUN_DIR_PATH}
+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_SpaceName
+IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
+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 : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+#
+# Determine component to take care of depending on kind of task create_ts will perform
+#
+( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = XChunck3D ] ) && set -A config_ListOfComponents ${CompToRead} || IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
+#
+# Determine period for time series. Default : value from AA_job or from launch_TS if any
+#
+[ X${CompletedFlag} = X ] || CompletedFlag=$( IGCM_date_ConvertFormatToGregorian ${CompletedFlag} )
+
+DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
+#
+PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
+#
+# Determine Dimension of the produced time series : 2D or 3D
+if (   [ X${TsTask} = XChunck2D ] || [ X${TsTask} = X2D ] ) ; then
+    Dimension=2D
+elif ( [ X${TsTask} = XChunck3D ] || [ X${TsTask} = X3D ] ) ; then
+    Dimension=3D
+else
+    Dimension=""
+fi
+
+
+########################################################################
+#
+#      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
+	#
+	typeset i
+	if ( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = XChunck3D ] ) ; then
+	    ((NbFiles=${FlagToRead}))
+	    ((i=${NbFiles}))
+	else
+	    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
+	    i=2
+	fi
+	#
+	until [ $i -gt $NbFiles ]; do
+	    #
+	    eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
+	    #
+	    if [ X${flag_post} != XNONE ] ; then
+		#
+	        # For each comp and each file who needs post-processing
+	        # determine which variables need time series.
+	        #
+		FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
+		IGCM_card_DefineArrayFromOption ${card}    Post_${FILE} TimeSeriesVars${Dimension}
+		IGCM_card_DefineVariableFromOption ${card} Post_${FILE} ChunckJob${Dimension}
+	        #
+		# If TimeSeriesVars list is empty we skip
+		#
+		if [ $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
+	            #
+		    IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}"
+		    IGCM_debug_Print 3 "TimeSeriesVars${Dimension} for ${FILE} is empty"
+		    (( i=i+3 ))
+		    continue
+	            #
+		fi
+		#
+		# If files/variables has been switch off by ChunckJob${Dimension}=0 we skip
+		#
+		if [ X$( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = XOFF ] ; then
+		    IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}"
+		    IGCM_debug_Print 3 "ChunckJob${Dimension}=OFF for ${FILE} so it has been switched off"
+		    (( i=i+3 ))
+		    continue
+		fi
+		#
+	        # If we are not a Chunck type task, we skip files/variables handled by chunck task
+	        #
+		if ( [ ! X${TsTask} = XChunck${Dimension} ] && [ ! X${TsTask} = X ] && [ ! XChunck${Dimension} = XChunck ] ) ; then
+		    if [ ! $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = NONE ] ; then
+			IGCM_debug_Print 3 "Nothing to do for ${FILE} TimeSeriesVars${Dimension} according to ${card}"
+			IGCM_debug_Print 3 "Let another chunck task do the job $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} )"
+			(( i=i+3 ))
+			continue
+		    fi
+		fi
+		#
+		# Now on we know we have things to do
+		#
+
+		#
+	        #  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} !!"
+		    (( i=i+3 ))
+		    continue
+	            #
+		fi
+	        #
+	        # We need LIST of variables not allready produced (useful for standalone mode)
+	        #
+		FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' )
+		case ${FlagDir} in
+		    *Y)  TS_Dir=TS_YE  ;;
+		    *M)  TS_Dir=TS_MO  ;;
+		    *D)  TS_Dir=TS_DA  ;;
+		    HF)  TS_Dir=TS_HF  ;;
+		    3H)  TS_Dir=TS_HF  ;;
+		    INS) TS_Dir=TS_INS ;;
+		esac
+		#
+		count=0
+		for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do
+	            #
+		    DIRECTORY=${R_SAVE}/${comp}/Analyse/${TS_Dir}
+		    TestedFile=${config_UserChoices_JobName}_${DateBegin}_${PeriodDateEnd}_${FlagDir}_${var}.nc
+	            #
+		    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile}
+		    if [ ! $? = 0 ] ; 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[*]}
+		    #
+		    if [ ! X${RebuildFrequency} = Xtrue ] ; then
+			IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
+			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
+		fi
+	    fi
+	    (( i=i+3 ))
+	done
+    fi
+    #
+    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 Length
+    case ${config_UserChoices_PeriodLength} in
+	*Y|*y) 
+	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
+	    IGCM_date_GetYearMonth ${1} year month
+	    year=$( IGCM_date_SupressZeros ${year} )
+	    (( Length=0 ))
+	    (( i=0 ))
+	    until [ $i -ge $PeriodLengthInYears ] ; do
+		(( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) )) 
+	        (( i=i+1 ))
+	    done
+	    ;;
+	*M|*m) 
+	    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
+	    IGCM_date_GetYearMonth ${1} year month
+	    year=$( IGCM_date_SupressZeros ${year} )
+	    (( year0 = year ))
+	    if [ $(( month + 1 )) -lt 13 ] ; then
+		month0=$(( month + 1 ))
+	    else
+		month0=$(( month + 1 - 12 ))
+		(( year = year0 + 1 ))
+	    fi
+	    (( Length=0 ))
+	    (( i=0 ))
+	    until [ $i -ge $PeriodLengthInMonths ] ; do
+		if [ $(( month0 + i )) -lt 13 ] ; then
+		    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) ))
+		else
+		    (( year = year0 + 1 ))
+		    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) ))
+		fi
+	        (( i=i+1 ))
+	    done
+	    ;;
+	*D|*d)
+	    Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;
+	*)
+	    IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D."
+	    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 Length
+    case ${config_UserChoices_PeriodLength} in
+	*Y|*y) 
+	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' )
+	    IGCM_date_GetYearMonth ${1} year month
+	    year=$( IGCM_date_SupressZeros ${year} )
+	    if [ X${2} = Xend ] ; then
+		(( year = year - PeriodLengthInYears + 1))
+	    fi
+	    (( Length=0 ))
+	    (( i=0 ))
+	    until [ $i -ge $PeriodLengthInYears ] ; do
+		(( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
+	        (( i=i+1 ))
+	    done
+	    ;;
+	*M|*m) 
+	    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' )
+	    IGCM_date_GetYearMonth ${1} year month
+	    year=$( IGCM_date_SupressZeros ${year} )
+	    if [ X${2} = Xend ] ; then
+		(( month = month - PeriodLengthInMonths + 1 ))
+	    fi	    
+	    (( year0 = year ))
+	    if [ $month -le 0 ] ; then
+		(( month = month + 12 ))
+		year=$( printf "%04i\n" $(( year - 1 )) )
+	    fi
+	    month=$( printf "%02i\n" ${month} )
+	    (( Length=0 ))
+	    (( i=0 ))
+	    until [ $i -ge $PeriodLengthInMonths ] ; do
+		if [ $(( month + i )) -lt 13 ] ; then
+		    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))
+		else
+		    (( year = year0 + 1 ))
+		    (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))
+		fi
+	        (( i=i+1 ))
+	    done
+	    ;;
+	*D|*d)
+	    Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;;
+	*)
+	    IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D."
+	    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 ] || [ X${CompletedFlag} = X$( IGCM_date_AddDaysToGregorianDate ${DateBegin} -1 ) ] ) ; then
+    # First Time Series Submission
+    FIRST_PASS=TRUE
+    Length=$( create_ts_begin_date ${DateBegin} begin)
+    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
+	unset 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
+	    	*Y)  TS_Dir=TS_YE  ;;
+	    	*M)  TS_Dir=TS_MO  ;;
+	    	*D)  TS_Dir=TS_DA  ;;
+		HF)  TS_Dir=TS_HF  ;;
+		3H)  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
+		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}
+	    ExitFlag=false
+	    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 ${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 ${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 ${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 ${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 ${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=$(( ${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 ${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
+		*Y)    TS_Dir=TS_YE  ; FreqDir=YE  ;;
+		*M)    TS_Dir=TS_MO  ; FreqDir=MO  ;;
+		*D)    TS_Dir=TS_DA  ; FreqDir=DA  ;;
+		HF)    TS_Dir=TS_HF  ; FreqDir=HF  ;;
+		3H)    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
+	    unset liste_file
+	    unset 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 ${DATE_LOOP} end)
+	        DATE_TAB=$(  IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP}
+
+		Length2=$( create_ts_next_date ${DATE_LOOP} end)
+		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
+		liste_file[${#liste_file[*]}]=${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc
+		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}
+	    ExitFlag=false
+	    IGCM_debug_Verif_Exit_Post
+
+	    # Apply IGCM_Patch if needed
+	    if [ ! X${RebuildFrequency} = Xtrue ] ; then
+		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
+	    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 ${DATE_COURANTE} end)
+	    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}
+		    #
+		    if [ ${FlagDir} = "1M" ] ; then
+                        # Compute yearly average considering calendar
+			file_before_YE=${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_1Y_${var}.nc
+			file_out_YE=${config_UserChoices_JobName}_${DATE_BUILD_END}_1Y_${var}.nc
+			#
+                        # Set date of the mid year to 01/07 at 00:00
+                        # better than default where the date information in the outputfile is the date of the last contributing time step in the input file
+			IGCM_sys_cdo -settime,00:00 -setday,1 -setmon,7 -settunits,days -divdpy -yearsum -muldpm ${file_out} ${file_out_YE}
+			#
+			eval IGCM_sys_Put_Out ${file_out_YE} \${R_OUT_${comp}}/Analyse/TS_MO_YE/${file_out_YE}
+			[ "${FLAG_B}" = "TRUE" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/TS_MO_YE/ ${file_before_YE} ${file_out_YE}
+		    fi
+                    #
+		    IGCM_sys_Rm ${file_out}
+		    #
+	        fi
+		#
+		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
+    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 TS_YE TS_MO TS_MO_YE TS_DA TS_HF TS_INS ; do
+	IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/${TS_Dir}
+	[ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/${TS_Dir}
+    done
+done
+
+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_MBG ; export RESOL_SRF ; export RESOL_SBG
+
+listVarEnv="POST_DIR,SUBMIT_DIR,libIGCM,R_INIT,R_BC,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG"
+export listVarEnv
+
+#D-
+# --------------------------------------------------------------------
+#D- Test if all was right
+# --------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+# --------------------------------------------------------------------
+#D- Submit MONITORING
+# --------------------------------------------------------------------
+( [ X${TsTask} = X2D ] || [ X${TsTask} = X ] ) && IGCM_sys_QsubPost monitoring
+
+#D-
+# --------------------------------------------------------------------
+#D- Update the run.card
+# --------------------------------------------------------------------
+if [ ${StandAlone} != true ] ; then
+    # Put in run.card end period of time series
+    [ X"${DATE_FIN}" = X ] || 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
+
+# Clean RUN_DIR_PATH (necessary for cesium)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
+
+date
Index: /tags/libIGCM_v1_8/AA_job
===================================================================
--- /tags/libIGCM_v1_8/AA_job	(revision 333)
+++ /tags/libIGCM_v1_8/AA_job	(revision 333)
@@ -0,0 +1,510 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ###################################################
+#-Q- cesium ## CESIUM   CEA                                  ##
+#-Q- cesium ## Usefull for postprocessing. AA_job not tested ##
+#-Q- cesium ###################################################
+#-Q- cesium #MSUB -r ::Jobname::    # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-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::.000001    # 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- titane #!/usr/bin/ksh
+#-Q- titane ##################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ##################
+#-Q- titane #MSUB -r ::Jobname::       # nom de la requete
+#-Q- titane #MSUB -o Script_Output_::Jobname::.000001    # nom du fichier de sortie
+#-Q- titane #MSUB -n ::JobNumProcTot::             # reservation des processeurs pour le job
+#-Q- titane #MSUB -T 86400           # Limite temps (en secondes)
+#-Q- titane #MSUB -p gen2211
+#-Q- titane BATCH_NUM_PROC_TOT=$BRIDGE_MSUB_NPROC
+#-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::.000001  # 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=15.0gb     # Limite memoire
+#-Q- sx8brodie #PBS -l cputim_job=1:00:00  # Limite temps
+#-Q- aix6 #!/usr/bin/ksh
+#-Q- aix6 # ######################
+#-Q- aix6 # ##   VARGAS IDRIS   ##
+#-Q- aix6 # ######################
+#-Q- aix6 # Nom de la requete
+#-Q- aix6 # @ job_name = ::Jobname::
+#-Q- aix6 # Type de travail
+#-Q- aix6 # @ job_type = parallel
+#-Q- aix6 # Fichier de sortie standard
+#-Q- aix6 # @ output = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie erreur (le meme)
+#-Q- aix6 # @ error =  $(job_name).$(jobid)
+#-Q- aix6 # Nombre de processus demandes
+#-Q- aix6 # @ total_tasks = ::JobNumProcTot::
+#-Q- aix6 # @ environment = "BATCH_NUM_PROC_TOT=::JobNumProcTot::"
+#-Q- aix6 # Temps CPU max. par processus MPI hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 1:00:00
+#-Q- aix6 # Memoire max. utilisee par processus
+#-Q- aix6 # @ data_limit = 3.2gb
+#-Q- aix6 # Memoire stack demandee
+#-Q- aix6 # @ stack_limit = 0.3gb,0.3gb
+#-Q- aix6 # Pas d OpenMP
+#-Q- aix6 # @ resources = ConsumableCpus(1)
+#-Q- aix6 # Fin de l entete
+#-Q- aix6 # @ queue
+#-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 -A gen6178
+#-Q- sx8mercure #PBS -o Script_Output_::Jobname::.000001   # 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=15.0gb       # limite memoire
+#-Q- sx8mercure #PBS -l elapstim_req=01:00:00 # limite en temps elapsed
+#-Q- sx9mercure #!/bin/ksh
+#-Q- sx9mercure ######################
+#-Q- sx9mercure ## SX9MERCURE   CEA ##
+#-Q- sx9mercure ######################
+#-Q- sx9mercure #PBS -N ::Jobname::           # nom de la requete
+#-Q- sx9mercure #PBS -m a                     # message a la fin du job
+#-Q- sx9mercure #PBS -j o                     # regroupement des sorties du job : standard error et output
+#-Q- sx9mercure #PBS -o Script_Output_::Jobname::.000001   # nom du fichier de sortie
+#-Q- sx9mercure #PBS -S /usr/bin/ksh          # shell de soumission
+#-Q- sx9mercure #PBS -v BATCH_NUM_PROC_TOT=::JobNumProcTot::
+#-Q- sx9mercure #PBS -l cpunum_job=${BATCH_NUM_PROC_TOT}          # reservation des processeurs pour le job
+#-Q- sx9mercure #PBS -l memsz_job=16.0gb       # limite memoire
+#-Q- sx9mercure #PBS -l elapstim_req=24:00:00 # limite en temps elapsed
+#-Q- sx9mercure #PBS -A gen6178               # groupe obligatoire sur SX9
+#-Q- sx9mercure #PBS -q para-sx9              # para-sx9 or prio-sx9 (for CMIP5 top priorities) or test-sx9 (if elapsed<1h)
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N ::Jobname::
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o Script_Output_::Jobname::.000001
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-Q- lxiv8 #PBS -v BATCH_NUM_PROC_TOT=::JobNumProcTot::
+#-Q- lxiv8 #PBS -l nodes=1:ppn=::JobNumProcTot::
+#-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-                      - Experience type : DEB(ug), DEV(elopment), RUN 
+#D--------------------------------------------------------------------==
+
+#D- Increased verbosity (1, 2, 3)
+Verbosity=3
+#D- Number of execution in one job
+PeriodNb=1
+#-Q- sx9mercure PeriodNb=60
+
+#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- Experience type : DEB(ug), DEV(elopment), RUN (default)
+JobType=RUN
+
+#D- Define running directory
+#D- Default=${TMPDIR} ie temporary batch directory
+#RUN_DIR_PATH=/workdir/or/scratchdir/of/this/machine
+
+#D- Define submit directory
+#D- Default= where you launch qsub (variable from scheduler)
+#SUBMIT_DIR=$( pwd )
+
+#D- Define BIG_DIR directory
+#D- Default=(strongly machine dependant/see libIGCM_sys for details)
+#BIG_DIR=/somewhere/with/lot/of/space/scratchdir/may/be
+
+#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=/IGCMG/common/account/of/this/machine
+#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
+[ -f ${SUBMIT_DIR}/../.resol ] && RESOL=$(head -1 ${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, write frequencies, ...
+#D- Verify compatibility of rebuild choices and post-process choices
+#D- Will stop here if something is wrong
+# --------------------------------------------------------------------==
+#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
+
+PeriodContinue=false
+if [ ${Period} -le ${PeriodNb} ]; then
+    PeriodContinue=true
+fi
+while ( ${PeriodContinue} ) ; 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- Optionnal function in driver 
+    #D- to set special variables used in forward lists (Param, Init or Bc).
+    # ------------------------------------------------------------------
+    IGCM_comp_PeriodStart
+    
+    #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 SmoothFiles Conditions (SST, WIND[X,Y,Z], LAI ...)
+    #D- READ AND USE BY GCM AT EACH EXECUTION but varying in time
+    # ------------------------------------------------------------------
+    IGCM_comp_GetInputSmoothFiles 
+
+    #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"
+	echo                                                                                   > ${Exe_Output}
+	echo "#######################################"                                        >> ${Exe_Output}
+        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name}" >> ${Exe_Output}
+	echo                                                                                  >> ${Exe_Output}
+	typeset RET
+	RUN_DATE_BEGIN=$( date '+%Y-%m-%dT%H:%M:%S' )
+	${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} >> ${Exe_Output} 2>&1
+	RET=$?
+	RUN_DATE_END=$( date '+%Y-%m-%dT%H:%M:%S' )
+	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                                            >> ${Exe_Output}
+	echo "#######################################"  >> ${Exe_Output}
+	echo "libIGCM RunDateBegin=${RUN_DATE_BEGIN}"   >> ${Exe_Output}
+	echo "libIGCM RunDateEnd=${RUN_DATE_END}"       >> ${Exe_Output}
+	echo                                            >> ${Exe_Output}
+    else
+	echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} simulated for DRYRUN = " $DRYRUN
+	if ( $DEBUG_debug ) ; then
+	    echo "FOR EXECUTION DRYRUN mode = " $DRYRUN >> stack
+	fi
+    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 remote rebuild or/and post-treatment process if necessary
+    # ------------------------------------------------------------------
+    IGCM_post_Configure
+
+    #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
+
+    PeriodContinue=false
+    if [ ${Period} -le ${PeriodNb} ]; then
+	PeriodContinue=true
+    fi
+done 
+
+#D-
+#D--------------------------------------------------------------------==
+#D-     5. Submit next job or send mail if simulation over.
+#D--------------------------------------------------------------------==
+IGCM_config_Finalize
+
+date
Index: /tags/libIGCM_v1_8/AA_monitoring
===================================================================
--- /tags/libIGCM_v1_8/AA_monitoring	(revision 333)
+++ /tags/libIGCM_v1_8/AA_monitoring	(revision 333)
@@ -0,0 +1,233 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r MONITORING     # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-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 #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 20:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = MONITORING
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $POST_DIR ; $SUBMIT_DIR ; $libIGCM ;  $libIGCM_SX ; $R_INIT ; $R_BC ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $R_SAVE ; $config_UserChoices_JobName ; $config_UserChoices_TagName ; $YEARS ; $MASTER
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 20:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = MONITORING
+#-Q- aix6 # Fichier de sortie standard du travail       
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $POST_DIR ; $SUBMIT_DIR ; $libIGCM ; $libIGCM_SX ; $R_INIT ; $R_BC ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $R_SAVE ; $config_UserChoices_JobName ; $config_UserChoices_TagName ; $YEARS ; $MASTER
+#-Q- aix6 # @ queue
+#-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- sx9mercure #!/bin/ksh
+#-Q- sx9mercure #########################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure #########################
+#-Q- sx9mercure #MSUB -r MONITORING     # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r MONITORING     # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N MONITORING
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o MONITORING.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-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 -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+# WARNING for StandAlone used : To run this script on some machine,
+# you must check MirrorlibIGCM variable in sys library.
+# If this variable is true, you must use libIGCM_POST path instead
+# of your running libIGCM directory.
+
+######################################################################
+
+. ${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
+
+######################################################################
+
+#set -vx 
+
+#===========================================
+RUN_DIR=${RUN_DIR_PATH}
+IGCM_sys_MkdirWork ${RUN_DIR}
+IGCM_sys_Cd ${RUN_DIR}
+
+if [ ${StandAlone} = true ] ; then
+    CARD_DIR=${SUBMIT_DIR}
+else
+    CARD_DIR=${RUN_DIR}/$( basename ${SUBMIT_DIR} )
+    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR}
+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 : Job output directory
+if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+#
+IGCM_sys_TestDirArchive ${R_SAVE}/MONITORING
+if [ $? = 0 ] ; then
+    IGCM_debug_Print 1 "Get MONITORING directory from archive"
+    IGCM_sys_Get_Dir ${R_SAVE}/MONITORING ${RUN_DIR}
+else
+    IGCM_debug_Print 1 "MONITORING first pass. Nothing has been done before"
+fi
+# --------------------------------------------
+# Insert your commands between III...III lines 
+# and precise produced directories to save
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+for comp in ${config_ListOfComponents[*]} ; do
+    IGCM_debug_Print 1 "################## Component: ${comp} ######################"
+    liste_file_monitoring=""
+    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
+    eval compname=\${config_ListOfComponents_${comp}[0]}                > /dev/null 2>&1
+
+    PATH_monitoring_file=""
+    eval monitoring_file=monitoring01_${compname}_\${RESOL_${comp}}.cfg > /dev/null 2>&1
+    if [[ -d ${CARD_DIR}/POST && -f ${CARD_DIR}/POST/monitoring01_${compname}.cfg ]] ; then
+	PATH_monitoring_file=${CARD_DIR}/POST/monitoring01_${compname}.cfg
+    elif [ -f ${FER_ATLAS}/${monitoring_file} ] ; then
+	PATH_monitoring_file=${FER_ATLAS}/${monitoring_file}
+    else
+	IGCM_debug_Print 1 "No monitoring file found for this component. Was expecting ${monitoring_file}"
+	IGCM_debug_Print 1 "Step to next component"
+	continue
+    fi
+    #
+    if [ X${PATH_monitoring_file} != X"" ] ; then
+        IGCM_debug_Print 1 "Monitoring file used : ${PATH_monitoring_file}"
+	IGCM_debug_Print 1 "Determine which files we need."
+	. monitoring01 -l2 --listcommand 'IGCM_sys_RshArchive ls' ${PATH_monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_MO
+	liste_file_monitoring=$( . monitoring01 -q -l2 --listcommand 'IGCM_sys_RshArchive ls' ${PATH_monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_MO )
+    fi
+    #
+    if [ ! "X${liste_file_monitoring}" = X ] ; then
+	IGCM_sys_Get /l liste_file_monitoring ${RUN_DIR}
+	IGCM_debug_Print 1 "monitoring01 -c ${CARD_DIR} -p ${comp} --time -t \"${config_UserChoices_JobName} monitoring\" -o ${RUN_DIR}/MONITORING ${PATH_monitoring_file} ."
+	IGCM_debug_Print 1 "monitoring01 starts ................................................."
+	monitoring01 -c ${CARD_DIR} -p ${comp} --time -t "${config_UserChoices_JobName} monitoring" -o ${RUN_DIR}/MONITORING ${PATH_monitoring_file} .
+    else
+	IGCM_debug_Print 1 "No time series detected by this command :"
+	IGCM_debug_Print 1 "monitoring01 -l2 --listcommand 'IGCM_sys_RshArchive ls' ${PATH_monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_MO"
+	. monitoring01 -l2 --listcommand 'IGCM_sys_RshArchive ls' ${PATH_monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_MO
+    fi
+    #
+done
+
+# IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
+
+# Save files
+IGCM_sys_Put_Dir MONITORING ${R_SAVE}
+
+# Dods copy
+IGCM_sys_Put_Dods MONITORING
+
+# Clean RUN_DIR_PATH (necessary for cesium)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /tags/libIGCM_v1_8/AA_rebuild_fromArchive
===================================================================
--- /tags/libIGCM_v1_8/AA_rebuild_fromArchive	(revision 333)
+++ /tags/libIGCM_v1_8/AA_rebuild_fromArchive	(revision 333)
@@ -0,0 +1,253 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r REBUILDARCH    # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ###################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ###################
+#-Q- platine #BSUB -J REBUILDARCH            # 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 4:00                   # Limite temps
+#-Q- platine #BSUB -q post                   # Passage en queue post
+#-Q- sx8brodie #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 20:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = REBUILDARCH
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive ; $config_UserChoices_JobName ; $R_SAVE
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 20:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = REBUILDARCH
+#-Q- aix6 # Fichier de sortie standard du travail
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive ; $config_UserChoices_JobName ; $R_SAVE
+#-Q- aix6 # @ queue
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N REBUILDARCH          # 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=24:00:00  # Limite temps a 1 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- sx9mercure #!/bin/ksh
+#-Q- sx9mercure ######################
+#-Q- sx9mercure ## CESIUM FOR SX9  CEA ##
+#-Q- sx9mercure ######################
+#-Q- sx9mercure #MSUB -r REBUILDARCH    # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r REBUILDARCH    # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N REBUILDARCH
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o REBUILDARCH.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-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 -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+# WARNING for StandAlone used : To run this script on some machine,
+# you must check MirrorlibIGCM variable in sys library.
+# If this variable is true, you must use libIGCM_POST path instead
+# of your running libIGCM directory.
+
+#-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
+MASTER=${MASTER:=mercure|titane|brodie|vargas}
+
+#D- Do we rebuild parallel output from archive or from ${BIGDIR}
+#D- Default : value from AA_job if any
+RebuildFromArchive=${RebuildFromArchive:=true}
+
+#D- Directory where files we need to rebuild are store 
+#D- Default : value from AA_job if any
+#D- if RebuildFromArchive=true REBUILD_DIR=${DMFDIR}/IGCM_OUT/.../JobName/TMP
+#D- example : /dmnfs09/cont003/p86denv/IGCM_OUT/IPSLCM5/CM5PIRC7/TMP
+#D- if RebuildFromArchive=false REBUILD_DIR=${BIGDIR}/REBUILD/TagName/JobName/
+#D- example : /scratch/cont003/p86denv/REBUILD/IPSLCM5/SCAL-NEW
+REBUILD_DIR=${REBUILD_DIR:=/path/to/your/TMP/REBUILD/FILES}
+
+#D- How many directory to rebuild we have to consider
+#D- Default : value from AA_job if any
+NbRebuildDir=${NbRebuildDir:=1000}
+
+#D- Suffix date we will use to determine which directory to rebuild
+#D- We will rebuild NbRebuildDir before and including PeriodDateBegin
+#D- Default : value from AA_job if any
+LastPeriodForRebuild=${PeriodDateBegin:=18901201}
+
+#D- Name of the job to work in a standalone mode (needed for mask patch)
+#D- Default : value from config.card if any
+config_UserChoices_JobName=${config_UserChoices_JobName:=name_of_the_job}
+
+#D- Directory where output data are stored (needed in standalone mode for mask patch)
+#D- Default : value from AA_job if any
+R_SAVE=${R_SAVE:=/path/to/your/ARCHIVE/FILES}
+
+#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- libIGCM_SX contains libIGCM on Master computer. Required on some center. Always OK.
+libIGCM_SX=${libIGCM_SX:=::modipsl::/libIGCM}
+
+#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- TEMPORARY Flag to determine atmospheric resolution
+#D- Default : value from atmospheric driver if any
+RESOL_ATM=${RESOL_ATM:=ALL}
+
+#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- TEMPORARY Flag to determine biogeochemistry resolution
+#D- Default : value from ice driver if any
+RESOL_MBG=${RESOL_MBG:=ORCA2}
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SRF=ALL
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SBG=ALL
+
+########################################################################
+
+. ${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_post/libIGCM_post.ksh
+
+########################################################################
+
+#set -vx
+
+RUN_DIR=${RUN_DIR_PATH}
+IGCM_sys_MkdirWork ${RUN_DIR}
+IGCM_sys_Cd ${RUN_DIR}
+#
+if [ ${RebuildFromArchive} = true ] ; then
+    ListAllRebuildDir=$( IGCM_sys_RshArchive ls -d ${REBUILD_DIR}/REBUILD_* | grep -B $(( ${NbRebuildDir} -1 )) ${LastPeriodForRebuild} )
+else
+    ListAllRebuildDir=$( IGCM_sys_RshMaster ls -d ${REBUILD_DIR}/REBUILD_* | grep -B $(( ${NbRebuildDir} -1 )) ${LastPeriodForRebuild} )
+fi
+#
+
+for directory in ${ListAllRebuildDir} ; do
+    #
+    if [ ${RebuildFromArchive} = true ] ; then
+	IGCM_sys_Get_Dir ${directory} ${RUN_DIR}
+    else
+	IGCM_sys_Get_Master ${directory} ${RUN_DIR}
+    fi
+    #
+    IGCM_sys_Cd ${RUN_DIR}/$( basename ${directory} )
+
+    # --------------------------------------------------------------------
+    # Source function include in the REBUILD ksh and rebuild
+    # --------------------------------------------------------------------
+    . ${RUN_DIR}/$( basename ${directory} )/rebuild.ksh
+    IGCM_FlushRebuild
+    #
+    IGCM_sys_Cd ${RUN_DIR}
+    # Clean Up
+    # local clean up
+    IGCM_sys_Rm -rf $( basename ${directory} )
+    # remote clean up
+    if [ ${RebuildFromArchive} = true ] ; then
+	IGCM_sys_RshArchive rm -rf ${directory}
+    else
+	IGCM_sys_Rm -rf ${directory}
+    fi
+done
+
+# Clean RUN_DIR_PATH (necessary for cesium only)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /tags/libIGCM_v1_8/AA_rebuild_fromWorkdir
===================================================================
--- /tags/libIGCM_v1_8/AA_rebuild_fromWorkdir	(revision 333)
+++ /tags/libIGCM_v1_8/AA_rebuild_fromWorkdir	(revision 333)
@@ -0,0 +1,254 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r REBUILDWRK     # Nom du job                
+#-Q- cesium #MSUB -N 1              # Reservation du noeud
+#-Q- cesium #MSUB -n 1              # Reservation du processus
+#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- cesium #MSUB -E "-j o"
+#-Q- cesium #MSUB -E "-S /bin/ksh"
+#-Q- platine #!/usr/bin/ksh
+#-Q- platine ###################
+#-Q- platine ## PLATINE   CEA ##
+#-Q- platine ###################
+#-Q- platine #BSUB -J REBUILDWRK             # 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 4:00                   # Limite temps
+#-Q- platine #BSUB -q post                   # Passage en queue post
+#-Q- sx8brodie #!/bin/ksh
+#-Q- sx8brodie #######################
+#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
+#-Q- sx8brodie #######################
+#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- sx8brodie # @ wall_clock_limit = 20:00:00
+#-Q- sx8brodie # Nom du travail LoadLeveler
+#-Q- sx8brodie # @ job_name   = REBUILDWRK
+#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
+#-Q- sx8brodie # Fichier de sortie d'erreur du travail
+#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
+#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- sx8brodie # @ notification = error
+#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive ; $config_UserChoices_JobName ; $R_SAVE
+#-Q- sx8brodie # @ queue
+#-Q- aix6 #!/bin/ksh
+#-Q- aix6 #######################
+#-Q- aix6 ##   VARGAS   IDRIS  ##
+#-Q- aix6 #######################
+#-Q- aix6 # @ class = archive
+#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- aix6 # @ wall_clock_limit = 20:00:00
+#-Q- aix6 # Nom du travail LoadLeveler
+#-Q- aix6 # @ job_name   = REBUILDWRK
+#-Q- aix6 # Fichier de sortie standard du travail
+#-Q- aix6 # @ output     = $(job_name).$(jobid)
+#-Q- aix6 # Fichier de sortie d'erreur du travail
+#-Q- aix6 # @ error      =  $(job_name).$(jobid)
+#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- aix6 # @ notification = error
+#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER ; $RebuildFromArchive ; $config_UserChoices_JobName ; $R_SAVE
+#-Q- aix6 # @ queue
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N REBUILDWRK           # 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=24:00:00  # Limite temps a 1 heures
+#-Q- sx8mercure #PBS -q scalaire
+#-Q- sx9mercure #!/bin/ksh
+#-Q- sx9mercure ######################
+#-Q- sx9mercure ## CESIUM   CEA ##
+#-Q- sx9mercure ######################
+#-Q- sx9mercure #MSUB -r REBUILDWRK     # Nom du job                
+#-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
+#-Q- sx9mercure #MSUB -n 1              # Reservation du processus
+#-Q- sx9mercure #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- sx9mercure #MSUB -E "-j o"
+#-Q- sx9mercure #MSUB -E "-S /bin/ksh"
+#-Q- titane #!/bin/ksh
+#-Q- titane ######################
+#-Q- titane ## TITANE   CEA ##
+#-Q- titane ######################
+#-Q- titane #MSUB -r REBUILDWRK     # Nom du job                
+#-Q- titane #MSUB -N 1              # Reservation du noeud
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -E "-j o"
+#-Q- titane #MSUB -E "-S /bin/ksh"
+#-Q- titane ##MSUB -e nco.out        # Sortie standard
+#-Q- titane ##MSUB -o nco.out        # Sortie standard
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N REBUILDWRK
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o REBUILDWRK.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-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 -eu
+#set -vx
+
+date
+
+#-Q- sx8brodie export OMP_NUM_THREADS=1
+#-Q- aix6 export OMP_NUM_THREADS=1
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Low level debug : to bypass lib test checks and stack construction
+#D- Default : value from AA_job if any
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+# WARNING for StandAlone used : To run this script on some machine,
+# you must check MirrorlibIGCM variable in sys library.
+# If this variable is true, you must use libIGCM_POST path instead
+# of your running libIGCM directory.
+
+#-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
+MASTER=${MASTER:=mercure|titane|brodie|vargas}
+
+#D- Do we rebuild parallel output from archive or from ${BIGDIR}
+#D- Default : value from AA_job if any
+RebuildFromArchive=${RebuildFromArchive:=false}
+
+#D- Directory where files we need to rebuild are store 
+#D- Default : value from AA_job if any
+#D- if RebuildFromArchive=true REBUILD_DIR=${DMFDIR}/IGCM_OUT/.../JobName/TMP
+#D- example : /dmnfs09/cont003/p86denv/IGCM_OUT/IPSLCM5/CM5PIRC7/TMP
+#D- if RebuildFromArchive=false REBUILD_DIR=${BIGDIR}/REBUILD/TagName/JobName/
+#D- example : /scratch/cont003/p86denv/REBUILD/IPSLCM5/SCAL-NEW
+REBUILD_DIR=${REBUILD_DIR:=/path/to/your/TMP/REBUILD/FILES}
+
+#D- How many directory to rebuild we have to consider
+#D- Default : value from AA_job if any
+NbRebuildDir=${NbRebuildDir:=1000}
+
+#D- Suffix date we will use to determine which directory to rebuild
+#D- We will rebuild NbRebuildDir before and including PeriodDateBegin
+#D- Default : value from AA_job if any
+LastPeriodForRebuild=${PeriodDateBegin:=18901201}
+
+#D- Name of the job to work in a standalone mode (needed for mask patch)
+#D- Default : value from config.card if any
+config_UserChoices_JobName=${config_UserChoices_JobName:=name_of_the_job}
+
+#D- Directory where output data are stored (needed in standalone mode for mask patch)
+#D- Default : value from AA_job if any
+R_SAVE=${R_SAVE:=/path/to/your/ARCHIVE/FILES}
+
+#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- libIGCM_SX contains libIGCM on Master computer. Required on some center. Always OK.
+libIGCM_SX=${libIGCM_SX:=::modipsl::/libIGCM}
+
+#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- TEMPORARY Flag to determine atmospheric resolution
+#D- Default : value from atmospheric driver if any
+RESOL_ATM=${RESOL_ATM:=ALL}
+
+#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- TEMPORARY Flag to determine biogeochemistry resolution
+#D- Default : value from ice driver if any
+RESOL_MBG=${RESOL_MBG:=ORCA2}
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SRF=ALL
+
+#D- Flag to determine surface resolution
+#D- Default : value from surface driver if any
+RESOL_SBG=ALL
+
+########################################################################
+
+. ${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_post/libIGCM_post.ksh
+
+########################################################################
+
+#set -vx
+
+RUN_DIR=${RUN_DIR_PATH}
+IGCM_sys_MkdirWork ${RUN_DIR}
+IGCM_sys_Cd ${RUN_DIR}
+#
+if [ ${RebuildFromArchive} = true ] ; then
+    ListAllRebuildDir=$( IGCM_sys_RshArchive ls -d ${REBUILD_DIR}/REBUILD_* | grep -B $(( ${NbRebuildDir} -1 )) ${LastPeriodForRebuild} )
+else
+    ListAllRebuildDir=$( IGCM_sys_RshMaster ls -d ${REBUILD_DIR}/REBUILD_* | grep -B $(( ${NbRebuildDir} -1 )) ${LastPeriodForRebuild} )
+fi
+#
+
+for directory in ${ListAllRebuildDir} ; do
+    #
+    if [ ${RebuildFromArchive} = true ] ; then
+	IGCM_sys_Get_Dir ${directory} ${RUN_DIR}
+    else
+	IGCM_sys_Get_Master ${directory} ${RUN_DIR}
+    fi
+    #
+    IGCM_sys_Cd ${RUN_DIR}/$( basename ${directory} )
+
+    # --------------------------------------------------------------------
+    # Source function include in the REBUILD ksh and rebuild
+    # --------------------------------------------------------------------
+    . ${RUN_DIR}/$( basename ${directory} )/rebuild.ksh
+    IGCM_FlushRebuild
+    #
+    IGCM_sys_Cd ${RUN_DIR}
+    # Clean Up
+    # local clean up
+    IGCM_sys_Rm -rf $( basename ${directory} )
+    # remote clean up
+    if [ ${RebuildFromArchive} = true ] ; then
+	IGCM_sys_RshArchive rm -rf ${directory}
+    else
+	IGCM_sys_RshMaster rm -rf ${directory}
+    fi
+done
+
+# Clean RUN_DIR_PATH (necessary for cesium only)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /tags/libIGCM_v1_8/libIGCM.card
===================================================================
--- /tags/libIGCM_v1_8/libIGCM.card	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM.card	(revision 333)
@@ -0,0 +1,20 @@
+# $Date: $
+# $Name: $
+# $Revision: $
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+#D- You MUST change cards (and first config.card) parameters too be compatible
+#D- with your modifications here.
+[UserChanges]
+PeriodNb=2
+#config_UserChoices_DateEnd=1900-02-03
+#config_UserChoices_PeriodLength= 1D
+#config_Post_TimeSeriesFrequency= 1D
+#config_Post_SeasonalFrequency= 1Y
+#config_SRF_WriteFrequency= 1800s
+
+#D- Increased verbosity (1, 2, 3)
+#Verbosity=1
+#D- Path must exist before change it !
+#RUN_DIR=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
Index: /tags/libIGCM_v1_8/libIGCM_CeCILL.LIC
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_CeCILL.LIC	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_CeCILL.LIC	(revision 333)
@@ -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_8/libIGCM_card/IGCM_card_PrintOption.awk
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_PrintOption.awk	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_PrintOption.awk	(revision 333)
@@ -0,0 +1,139 @@
+#**************************************************************
+# 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 (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", section, option
+} else if (option_found == 0) {
+	print "Error: Option not found", section, option
+} else {
+	print option_value
+}
+
+}
+
+}
+ 
+#==========================
Index: /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_PrintSection.awk
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_PrintSection.awk	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_PrintSection.awk	(revision 333)
@@ -0,0 +1,122 @@
+#**************************************************************
+# 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 (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_8/libIGCM_card/IGCM_card_Test.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_Test.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_Test.ksh	(revision 333)
@@ -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 NewTestFile.card.bak
+
Index: /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_Test.ref
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_Test.ref	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_Test.ref	(revision 333)
@@ -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_8/libIGCM_card/IGCM_card_WriteOption.awk
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_WriteOption.awk	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_card/IGCM_card_WriteOption.awk	(revision 333)
@@ -0,0 +1,123 @@
+#**************************************************************
+# 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 (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", section, option
+	} else if (option_found == 0) {
+	    print "Error: Option not found", section, option
+	}	
+	
+    } else {
+
+	print "Error in with IGCM_WriteOption : ", section, option
+
+    }
+
+}
+ 
+#==========================
Index: /tags/libIGCM_v1_8/libIGCM_card/TestFile.card
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_card/TestFile.card	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_card/TestFile.card	(revision 333)
@@ -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_8/libIGCM_card/libIGCM_card.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_card/libIGCM_card.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_card/libIGCM_card.ksh	(revision 333)
@@ -0,0 +1,302 @@
+#!/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
+	gawk -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
+	gawk -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=$( gawk -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}
+	eval unset ${name}
+	eval ${name}[0]=${NULL_STR}
+	set +A ${name} -- $( gawk -f ${libIGCM}/libIGCM_card/IGCM_card_PrintOption.awk -- "$@" | gawk -- '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}
+	eval unset ${name}
+	eval ${name}[0]=${NULL_STR}
+	set +A ${name} -- $( gawk -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 in 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_$$
+	( IGCM_card_PrintOption "$1" "$2" "$3" | grep "not found" ) > ${tmpfile}
+	if [ $( cat ${tmpfile} | wc -l ) -gt 0 ] ; then
+	    echo "-------------------------------------------"
+	    echo "!!! Problem with IGCM_card_WriteOption !!!"
+	    echo "Try to write : " $@
+	    echo "You have to correcte some script." 
+	    echo "We won't do anything else !"
+	    exit 1
+	fi
+	rm ${tmpfile}
+
+	# The tmpfile uses now the real path of the card to be modified, 
+	# not just a local tmpfile with PID.
+	tmpfile=$1_mutex_$$
+
+	# Watch for possible conflics : Check for other tmpfiles.
+	unset tmpfiles
+	set +A tmpfiles -- $( ls $1_mutex_[0-9]* 2>/dev/null )
+	typeset isleep
+	((isleep=0))
+	while [ ${#tmpfiles[@]} -gt 0 ] ; do 
+ 	    echo "Conflict between two processes working on " $1 "!!!" ${tmpfiles[@]}
+	    sleep 1
+	    ((isleep=isleep+1))
+	    if [ isleep -gt 20 ] ; then
+		echo "Too many loops waiting for other process working on " $1 ". We continue."
+		echo "You should see if one process of your run or post-treatment may have terminated suddenly."
+		echo "Afer, you should erase this(those) file(s) : " ${tmpfiles[@]}
+# Send a mail to USER ??
+		break ;
+	    fi
+	    unset tmpfiles
+	    set +A tmpfiles -- $( ls $1_mutex_[0-9]* 2>/dev/null )
+	done
+
+	# Do the job
+	( gawk -f ${libIGCM}/libIGCM_card/IGCM_card_WriteOption.awk -- "$@" 2> /dev/null ) > ${tmpfile}
+
+	cp $1 $1.bak
+	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_WriteArrayOption
+#D-* Purpose: Write an array option a given file.card and section
+#D-* Usage: IGCM_card_WriteArrayOption file.card section option newarray
+#D-* Examples: set -A MyArray -- 1 2 3
+#D-            IGCM_card_WriteArrayOption file.card Recipes List MyArray
+#D-
+function IGCM_card_WriteArrayOption
+{
+    IGCM_debug_PushStack "IGCM_card_WriteArrayOption" $@
+
+    if [ -r "$1" ] && [ -w "$1" ] ; then
+	typeset tmpfile=tmpfile_$$
+	if [ X"${4}" != X"" ]; then
+	    tab=$4
+	    IGCM_card_WriteOption $1 $2 $3 '('$( eval echo \${${tab}[@]} | sed -e 's/ /,/g' )')'
+	else
+	    IGCM_card_WriteOption $1 $2 $3 '()'
+	fi
+    else
+        echo "--Error--> IGCM_card_WriteArrayOption $@"
+        echo "           $1 is not readable or not writable"
+	IGCM_debug_Exit "IGCM_card_WriteArrayOption"
+    fi
+    IGCM_debug_PopStack "IGCM_card_WriteArrayOption"
+}
+
+#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 gawk > /dev/null 2>&1
+    if [ ! $? -eq 0 ] ; then
+	echo "Check libIGCM_card ...........................................[ FAILED ]"
+        echo "--Error--> gawk 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_8/libIGCM_comp/libIGCM_comp.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_comp/libIGCM_comp.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_comp/libIGCM_comp.ksh	(revision 333)
@@ -0,0 +1,1046 @@
+#!/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 i j
+    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 "DefineArrayFromSection : ${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: ${option} \${card_UserChoices_${option}}"
+	    done
+	fi
+
+	# Read and Build Output File stuff
+	IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${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
+	    i=2
+	    #
+	    until [ $i -ge $NbFiles ]; do
+	        #
+		eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
+		#
+		if [ X${flag_post} != XNONE ] ; then
+		    #
+                    # First of all
+                    #
+		    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
+		    #
+		    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
+		    #
+		    # variable option allready typeset above
+		    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
+			if [ ${option} = Seasonal ] ; then
+			    FoundSeasonal=true
+			    IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
+			fi
+		    done
+		    #
+		    if [ ! X${FoundSeasonal} = Xtrue ] ; then
+			eval ${compname}_${flag_post}_Seasonal=ON
+		    fi
+		    #
+		    if [ $( eval echo \${${compname}_${flag_post}_Seasonal} ) = ON ] ; then
+			Seasonal=true
+		    fi
+		    
+		    # Dimension = vide si vieille card.
+		    IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars
+		    IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches
+		    if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not found ${flag_post}" ] ; then
+			# New TimeSeriesVar description, with 2D, 3D and associate ChunckJob.
+			ListDimension[0]=2D
+			ListDimension[1]=3D
+			TimeSeries=false
+			iLoop=${#ListDimension[*]}
+			j=0
+			until [ $j -ge ${iLoop} ]; do
+			    Dimension=${ListDimension[${j}]}
+			    IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars${Dimension}
+			    IGCM_card_DefineVariableFromOption ${card} ${flag_post} ChunckJob${Dimension}
+		            #
+	                    # Time series WITHOUT chunk
+	                    #
+			    if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
+				if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then
+				    IGCM_debug_Print 3 "${Dimension} time series activated for ${flag_post} according to ${card}"
+				    eval TimeSeries${Dimension}=true
+				fi
+			    fi
+                            #
+	                    # Time series WITH chunk
+		            #
+			    if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
+				chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} )
+				if [ ! ${chunck_size} = NONE ] &&  [ ! ${chunck_size} = OFF ] ; then
+				    IGCM_debug_Print 3 "${Dimension} time series activated with chunck for ${flag_post} according to ${card}"
+				    eval TimeSeriesChunck${Dimension}=true
+				    eval set +A CHUNCK${Dimension}_COMP \${CHUNCK${Dimension}_COMP[*]} ${comp}
+				    eval set +A CHUNCK${Dimension}_FLAG \${CHUNCK${Dimension}_FLAG[*]} ${i}
+				    eval set +A CHUNCK${Dimension}_SIZE \${CHUNCK${Dimension}_SIZE[*]} ${chunck_size}
+				fi
+			    fi
+			    (( j=j+1 ))
+			done
+		    else
+			ListDimension[0]=""
+			TimeSeries=true
+			TimeSeries2D=false
+			TimeSeries3D=false
+			TimeSeriesChunck2D=false
+			TimeSeriesChunck3D=false
+		    fi
+		fi
+		(( i=i+3 ))
+	    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"
+}
+
+#=======================================================================
+# Definition of Smooth modulo function
+# usage : 
+# IGCM_SmoothModulo StringModulo value
+#
+# StringModulo : A string of min max and modulo like definition of Scilab vectors.
+# [min]:[modulo:][max]
+# where :
+# [] value are optionnals; 
+# empty min equal 1
+# empty max equal infinity
+# modulo not given or empty equal 1
+# empty string or just ':' equal always.
+#
+# value : the value to test with the definition
+#
+# return : true(1)/false(0) 
+function IGCM_SmoothModulo
+{
+    IGCM_debug_PushStack "IGCM_SmoothModulo"
+    typeset defVector ModValue
+
+    eval set +A defVector -- $( echo "${1}" | \
+	gawk -F ':' '{print ($1 == "" ? 1 : $1) " " (NF==3 ? ($2 == "" ? 1 : $2) : 1) " " (NF==3 ? ($3 == "" ? -1 : $3) : ($2 == "" ? -1 : $2))}' )
+
+    # Test limits : 
+    # ${defVector[0]} <= ${2} <= ${defVector[2]} 
+    #                                      or ${defVector[2]} == -1
+    if ( [ ${2} -ge ${defVector[0]} ] && \
+         ( [ ${2} -le ${defVector[2]} ] || \
+           [ ${defVector[2]} -lt 0 ] ) ) ; then
+
+        # Test modulo
+        ModValue=$( expr \( ${2} - ${defVector[0]} \) % ${defVector[1]} )
+        if [ ${ModValue} -eq 0 ] ;  then
+	    echo true
+	    IGCM_debug_PopStack "IGCM_SmoothModulo"
+	    return 1
+	else
+	    echo false
+	    IGCM_debug_PopStack "IGCM_SmoothModulo"
+	    return 0
+	fi
+    else
+	echo false
+	IGCM_debug_PopStack "IGCM_SmoothModulo"
+	return 0
+    fi
+}
+
+#=======================================================================
+function IGCM_comp_GetInputSmoothFiles
+{
+    IGCM_debug_PushStack "IGCM_comp_GetInputSmoothFiles"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_GetInputSmoothFiles :"
+    echo
+
+    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ i__
+    typeset file_in_ file_in file_out_ file_out ret SmoothDef
+
+    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 "Smooth files ${compname}"
+
+	card=${SUBMIT_DIR}/COMP/${compname}.card
+
+	IGCM_card_DefineArrayFromOption ${card} SmoothFiles List
+	ListFilesName=${compname}_SmoothFiles_List
+ 	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+	if ( [ X${FileName0} != X${NULL_STR} ] && [ X${FileName0} != X"Section" ] ) ; 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_}
+
+		# define CumulPeriod definition for this file
+		(( i__ = i+2 ))
+		eval SmoothDef=\${${ListFilesName}[$i__]}
+		IGCM_debug_Print 3 "  ${file_in} ${SmoothDef}"
+		eval ret=$( IGCM_SmoothModulo ${SmoothDef} ${CumulPeriod} )
+		if ( [ X${ret} = Xtrue ] || [ ${Period} -eq 1 ] ) ; then
+		    IGCM_sys_Get ${file_in} ${file_out}
+
+		    #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+		fi
+		(( i=i+3 ))
+	    done
+	fi
+    done
+    
+    IGCM_debug_PopStack "IGCM_comp_GetInputSmoothFiles"
+}
+
+#=======================================================================
+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 Path_temp
+    typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
+    typeset file_in file_out file_in_ file_out_ file_in_Name
+    typeset -Z4 j4
+
+    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
+	#
+	card=${SUBMIT_DIR}/COMP/${compname}.card
+	#
+	IGCM_card_DefineArrayFromOption ${card} RestartFiles List
+	ListFilesName=${compname}_RestartFiles_List
+	eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
+
+	# Debug Print :
+	IGCM_debug_Print 3 "restart ${compname}"
+
+	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
+
+		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}
+
+			generic_restart_file_name_in=$( basename ${file_in_Name} .nc )
+			generic_restart_file_name_out=$( basename ${file_out} .nc )
+			
+			eval Path_temp=\${Path_r}/${generic_restart_file_name_in}
+			nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_temp}_????.nc)
+
+			if [ ${nb_restart_file} -gt 1 ] ; then
+			    j=0
+			    until [ $j -ge $nb_restart_file ]; do
+				j4=${j}
+				eval IGCM_sys_Get ${Path_r}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+				#IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+				#eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1
+				(( j=j+1 ))
+			    done
+			else
+			    eval IGCM_sys_Get ${Path_r}/${file_in_Name} ${file_out}  
+			    #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+			fi
+		
+			(( 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
+	elif [ ${Period} -eq 1 ] ; then
+            # if not FirstInitialize and first loop of this job
+
+	    # Restore Restarts files
+	    #-----------------------
+	    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}
+
+		    generic_restart_file_name_in=$( basename ${file_in_Name} .nc )
+		    generic_restart_file_name_out=$( basename ${file_out} .nc )
+
+		    eval Path_temp=\${R_OUT_${comp}_R}/${generic_restart_file_name_in}
+		    nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_temp}_????.nc)
+
+		    if [ ${nb_restart_file} -gt 1 ] ; then
+			j=0
+			until [ $j -ge $nb_restart_file ]; do
+			    j4=${j}
+			    eval IGCM_sys_Get \${R_OUT_${comp}_R}/${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+			    #IGCM_comp_PrepareDeletedFiles ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+			    #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_out}_${j4}.nc" > /dev/null 2>&1
+
+			    (( j=j+1 ))
+			done
+		    else
+			eval IGCM_sys_Get \${R_OUT_${comp}_R}/${file_in_Name} ${file_out}
+			#IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+		    fi
+
+		    (( 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 u+rw *
+
+    IGCM_debug_PopStack "IGCM_comp_GetInputRestartFiles"
+}
+
+#=======================================================================
+function IGCM_comp_PeriodStart
+{
+    IGCM_debug_PushStack "IGCM_comp_PeriodStart"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_comp_PeriodStart :"
+    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]}
+
+	# Debug Print
+	IGCM_debug_Print 3 "PeriodStart ${compname} Driver Function (if any)."
+	# UPDATE component
+        ${comp}_PeriodStart 2> /dev/null
+
+    done
+
+    IGCM_debug_PopStack "IGCM_comp_PeriodStart"
+}
+
+#=======================================================================
+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 missing executable then stop!
+	#if [ ! X${ExeNameIn} = X ] && [ ! -f ${R_EXE}/${ExeNameIn} ] ; then
+	#    IGCM_debug_Exit "IGCM_comp_Update missing executable ${ExeNameIn}"
+	#fi 
+
+	if [ ${Period} -eq 1 ] && [ -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
+	elif [ -f ${R_EXE}/${ExeNameIn} ] && [ ! -f ${RUN_DIR}/${ExeNameOut} ] ; 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 SaveOnArchive
+    typeset i i_ file_in file_in_ file_out file_out_ file_outin file_outin_ generic_file_name nb_rebuild_file
+    typeset -Z4 j4
+    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_}
+
+		(( i_ = i+2 ))
+		eval file_outin_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		eval file_outin=${file_outin_}
+
+		generic_restart_file_name_in=$(    basename ${file_in} .nc )
+		generic_restart_file_name_out=$(   basename ${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out} .nc )
+		generic_restart_file_name_outin=$( basename ${file_outin} .nc )
+			
+		nb_restart_file=$( ls ${generic_restart_file_name_in}_????.nc 2>/dev/null | wc -l ) 
+		if [ ${nb_restart_file} -gt 1 ] ; then
+		    j=0
+		    until [ $j -ge $nb_restart_file ]; do
+			j4=${j}
+			eval IGCM_sys_Put_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
+			if [ ! ${file_in} = ${file_outin} ] ; then
+			    if ( ${ExitFlag} ) ; then
+				echo "IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc not executed."
+			    else
+				IGCM_sys_Mv ${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_outin}_${j4}.nc
+			    fi
+			fi
+			#eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${generic_restart_file_name_in}_${j4}.nc" > /dev/null 2>&1
+			(( j=j+1 ))
+		    done
+		else
+		    eval IGCM_sys_Put_Rest ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
+		    if [ ! ${file_in} = ${file_outin} ] ; then
+			if ( ${ExitFlag} ) ; then
+			    echo "IGCM_sys_Mv ${file_in} ${file_outin} not executed."
+			else
+			    IGCM_sys_Mv ${file_in} ${file_outin}
+			fi
+		    fi
+		    #eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
+		fi
+
+		(( 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
+		SaveOnArchive=true
+		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_}
+		(( i_ = i+2 ))
+		eval flag_post=\${${ListFilesName}[$i_]} > /dev/null 2>&1
+		#
+		generic_file_name=$( basename ${file_in} .nc )
+		nb_rebuild_file=$( ls | grep "^${generic_file_name}_[0-9]*.nc" | wc -l )
+		#
+		if ( [ ${nb_rebuild_file} -eq 1 ] && [ -f ${generic_file_name}_0000.nc ] ) ; then
+		    IGCM_debug_Print 2 "Parallelism with 1 process. Rebuilding ${file_in} not needed"
+		    IGCM_sys_Mv ${generic_file_name}_0000.nc ${file_in}
+		elif [ ${nb_rebuild_file} -gt 1 ] ; then
+		    IGCM_debug_Print 2 "Parallelism detected rebuilding ${file_in} is needed"
+		    if ( [ X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ X${config_Post_RebuildFrequency} = XNONE ] ) ; then
+			IGCM_debug_Print 2 "Rebuilding ${file_in} online"
+			IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc
+		    else
+			IGCM_debug_Print 2 "Preparing offline rebuild for ${file_in}"
+			[ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+			IGCM_sys_Mv ${generic_file_name}_????.nc ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+
+		        # Prepare headers for the shell dedicated to offline rebuild
+			if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+			    if [ $DRYRUN -le 1 ]; then
+			    echo "#!/bin/ksh                                          " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "function IGCM_FlushRebuild                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "{                                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    fi
+			fi
+			# Prepare the shell dedicated to offline rebuild
+			if [ $DRYRUN -le 1 ]; then
+			    echo "IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_Verif_Exit                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			fi
+			#
+			# Load Patch we need to apply and apply
+			if [ $DRYRUN -le 1 ]; then
+			    if [ X$( eval echo \${${compname}_${flag_post}_Patches[0]} ) !=  X${NULL_STR} ]; then
+				for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
+				    echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "IGCM_${Patch} ${file_in}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				done
+			    fi
+			fi
+			#
+			if [ $DRYRUN -le 1 ]; then
+			    echo "IGCM_sys_Put_Out ${file_in} ${file_out}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_Verif_Exit                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_sys_Rm ${generic_file_name}_*.nc                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			fi
+			SaveOnArchive=false
+		    fi
+		fi
+		#
+		if [ ${SaveOnArchive} = true ] ; then
+		    #
+		    # If we need to apply a patch we use TMP DIRECTORY before ARCHIVING if asynchronous rebuild is on
+		    #
+		    thereisapatch=$( eval echo \${${compname}_${flag_post}_Patches[0]} )
+		    
+		    if ( [ ! X${thereisapatch} =  X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = X ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
+			if [ -f ${file_in} ] ; then
+                            [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+
+			    IGCM_sys_Mv ${file_in} ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+			    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=REBUILD_${PeriodDateBegin}/${file_in} > /dev/null 2>&1
+			    #
+			    if [ $DRYRUN -le 1 ]; then
+				if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+				    echo "#!/bin/ksh                                          " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "function IGCM_FlushRebuild                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "{                                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				fi
+                                #
+				for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
+				    echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				    echo "IGCM_${Patch} ${file_in}                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				done
+			        #
+				echo "IGCM_sys_Put_Out ${file_in} ${file_out}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+				echo "IGCM_debug_Verif_Exit                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		                #
+			    fi
+			fi
+		    else
+                        [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+			if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+			    echo "#!/bin/ksh                                          " > ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "function IGCM_FlushRebuild                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "{                                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			fi
+
+			IGCM_sys_Put_Out ${file_in} ${file_out}
+			[ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
+			if [ ${nb_rebuild_file} -gt 1 ] ; then
+			    for DelFile in $( ls | grep "${generic_file_name}[_0-9]*.nc" ) ; do
+				eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${DelFile} > /dev/null 2>&1
+			    done
+			fi
+		    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}
+		    [ $? -eq 0 ] && eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
+		fi
+	    done
+	fi
+    done
+
+    IGCM_debug_PopStack "IGCM_comp_Finalize"
+}
Index: /tags/libIGCM_v1_8/libIGCM_config/libIGCM_config.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_config/libIGCM_config.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_config/libIGCM_config.ksh	(revision 333)
@@ -0,0 +1,731 @@
+#!/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}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    IGCM_sys_TestDir ${libIGCM}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    IGCM_sys_TestDir ${R_EXE}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    IGCM_sys_TestDir ${SUBMIT_DIR}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+
+    if ( $DEBUG_debug ) ; then
+	echo "Keep trace of inital SUBMIT_DIR : "
+	ls -lta ${SUBMIT_DIR}
+    fi
+
+    #==================================
+
+    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
+    if [ 3 -le ${Verbosity} ] ; then
+	echo "--------------Debug3-->" "config_UserChoices_LongName="
+	echo "--------------Debug3-->" \"${config_UserChoices_LongName}\"
+    fi
+    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=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 ))
+    InitYear=$(( $( 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}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+    IGCM_sys_TestDirArchive ${R_IN}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+
+    #====================================================
+    #R_SAVE : Job output directory
+    if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
+	FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+	R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+	R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    else
+	R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+	R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    fi
+
+    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}
+    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+
+    #==================================
+    # Post : 
+    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post
+
+    echo
+    IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
+
+    for option in ${config_Post[*]} ; do
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option}
+	eval auxprint=\${config_Post_${option}}
+	IGCM_debug_Print 3 "${option} : ${auxprint}"
+    done
+
+    #====================================================
+    # Define REBUILD_DIR : where we store files needing rebuild process
+    if [ X${config_Post_RebuildFromArchive} = Xtrue ] ; then
+	REBUILD_DIR=${R_SAVE}/TMP
+	IGCM_sys_MkdirArchive ${REBUILD_DIR}
+    else
+	REBUILD_DIR=${BIG_DIR}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+	IGCM_sys_MkdirWork ${REBUILD_DIR}
+    fi
+
+    #====================================================
+    # Experience type : DEB(ug), DEV(elopment), RUN 
+    if [ X${JobType} != XRUN ] ; then
+	echo
+        echo "===================================================="
+	echo "libIGCM JOB is NOT in RUN type mode."
+	echo "!! OUTPUT files will NOT be PROTECTED !!"
+        echo "Be carefull : you can ERASE the result of this job !"
+
+	case ${JobType} in
+	    DEB)
+		echo "DEBUG mode : activation of 'set -vx' mode."
+		echo "DEBUG mode : no protection for output files."
+		echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency."
+		;;
+	    DEV)
+		echo "DEVelopment mode : no protection for output files."
+		echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency."
+		;;
+	esac
+
+	if [ X${config_Post_RebuildFrequency} != XNONE ] ; then
+            if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then
+		echo "------------"
+		echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency"
+		echo "          to PeriodLength : ${config_UserChoices_PeriodLength}"
+		echo "------------"
+		config_Post_RebuildFrequency=${config_UserChoices_PeriodLength}
+	    fi
+	fi
+        echo "===================================================="
+	echo
+    fi
+
+    #====================================================
+    #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_Analyse_PeriodLength
+{
+    IGCM_debug_PushStack "IGCM_config_Analyse_PeriodLength"
+
+    typeset i
+
+    # Determine number of day(s) in PeriodLength :
+    case ${config_UserChoices_PeriodLength} in
+	*Y|*y)
+	    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' ) 
+	    IGCM_debug_Print 1 "Number of years for PeriodLength : ${PeriodLengthInYears}"
+	    PeriodLengthInDays=0
+	    i=0
+	    until [ $i -ge $PeriodLengthInYears ] ; do 
+	 	(( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) )) 
+	 	(( i=i+1 )) 
+	    done 
+	    ;;
+	*M|*m)
+	    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' ) 
+	    IGCM_debug_Print 1 "Number of months for PeriodLength : ${PeriodLengthInMonths}"
+	    PeriodLengthInDays=0
+	    i=0
+	    until [ $i -ge $PeriodLengthInMonths ] ; do 
+	 	if [ $(( month + i )) -lt 13 ] ; then 
+	 	    (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i )) ) ))  
+	 	else 
+ 	            (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) ))  
+	 	fi 
+ 	        (( i=i+1 )) 
+	    done 
+ 	    ;;
+	*D|*d)  
+	    PeriodLengthInMonths=0
+	    PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' );;
+	*) 
+	    IGCM_debug_Exit "IGCM_config_Analyse_PeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D."
+	    IGCM_debug_Verif_Exit ;;
+    esac
+
+    IGCM_debug_PopStack "IGCM_config_Analyse_PeriodLength"
+
+}
+
+#===================================
+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
+	year_m1=$(( year - 1 ))
+	year_p1=$(( year + 1 ))	
+	IGCM_config_Analyse_PeriodLength
+
+	eval PeriodDateBegin=${DateBegin} > /dev/null 2>&1
+	PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${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 iLastPeriod Last_Script_Output_Name
+	    (( LastPeriod=CumulPeriod-PeriodNb ))
+	    iLastPeriod=$( printf "%06d" ${LastPeriod} )
+	    Last_Script_Output_Name="${Script_Output_Prefix}_${config_UserChoices_JobName}.${iLastPeriod}"
+	    Last_run_card="run.card.${iLastPeriod}"
+ 	    #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}/${Last_Script_Output_Name}.$$ rw
+	    IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/${Last_run_card}.$$ rw
+	    IGCM_sys_Cd ${RUN_DIR}
+	else
+	    unset FileToBeDeleted
+	fi
+
+	IGCM_date_GetYearMonth $PeriodDateBegin year month
+	year_m1=$(( year - 1 ))
+	year_p1=$(( year + 1 ))	
+	IGCM_config_Analyse_PeriodLength
+
+	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
+    [ -f stack ] && FileToBeDeleted[0]="stack"
+
+    # Test if the same run as already been saved :
+    if [ X${JobType} = XRUN ] ; then
+	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
+    else
+	if ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${PREFIX}_${Exe_Output} ) ; then
+	    IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. DEBUG of DEV mode."
+	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}"
+
+    IGCM_sys_Put_Out ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/run.card rw
+    
+    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
+    # Would be nice to have next line but no way to format ls output (need to ls -l --time-style "+%Y-%m-%dT%H:%M")
+    # ExeDate = ATM_2009-06-12T09:34+SRF_2009-06-12T09:34+OCE_2009-06-12T09:34+ICE_2009-06-12T09:34+CPL_2009-06-12T09:34
+    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]}
+	# Only if we really have an executable for the component :
+	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 -- $( LC_TIME=en_US 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]}
+	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} !"
+		eval FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut}
+	    fi
+	    eval IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw
+	fi
+    done
+
+    if [ ${DRYRUN} -le 1 ] ; then
+	typeset ExeCpuLog
+	tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt
+	ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt )
+	RET=$?
+	if [ $RET -eq 0 ] ; then
+	    # ExeCpuLog variable contents 5 fields
+	    echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" |   \
+	     gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \
+                              $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${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
+    IGCM_debug_Print 1 "Files that will be deleted before next period-run : "
+
+    if [ ${DRYRUN} -le 2 ] ; then
+	for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done
+    else
+	echo ${FileToBeDeleted[@]}
+    fi
+
+    #=================================================#
+    #         Modification of libIGCM behaviour       #
+    #=================================================#
+
+    # To use this function, one must copy libIGCM.card from ${libIGCM} directory
+    # and put it in ${SUBMIT_DIR} directory. Ater modifications of ${SUBMIT_DIR}/libIGCM.card,
+    # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop. 
+    if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then
+	echo
+	echo "########################################################################"
+	echo "!!!                 Modification of libIGCM behaviour                !!!"
+	echo
+
+	IGCM_debug_Print 1 "DefineArrayFromOption  : libIGCM_UserChanges in libIGCM.card"
+	IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges
+	IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]}
+
+	# Special treatments for libIGCM internals
+	for option in ${libIGCM_UserChanges[*]} ; do
+            IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option}
+
+	    echo "We will change : ${option}."
+	    eval echo "Previous value : " \${${option}}
+	    eval echo "Change to : " \${libIGCM_UserChanges_${option}}
+	    
+	    eval ${option}=\${libIGCM_UserChanges_${option}}
+
+	    case ${option} in
+		config_UserChoices_DateEnd)
+		    IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
+		    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 libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that."
+			IGCM_debug_Exit "IGCM_PeriodEnd" " Wrong Dates."
+			IGCM_debug_Verif_Exit 
+		    fi
+		    ;;
+		config_UserChoices_PeriodLength)
+		    ;;
+		PeriodNb)
+		    IGCM_debug_Print 3  "Loop in main Job with ${PeriodNb} period(s)"
+		    ;;
+		config_Post_RebuildFrequency)
+		    IGCM_debug_Print 3  "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure"
+		    IGCM_post_Configure
+		    ;;
+		config_Post_TimeSeriesFrequency)
+		    IGCM_debug_Print 3  "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Initialize"
+		    IGCM_post_Configure
+		    ;;
+		config_Post_SeasonalFrequency)
+		    IGCM_debug_Print 3  "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Initialize"
+		    IGCM_post_Configure
+		    ;;
+	    esac
+	done
+
+	echo
+	echo "########################################################################"
+	echo
+    fi
+
+    #=================================================#
+    #         Determine next computed period          #
+    #=================================================#
+
+    PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 )
+    IGCM_date_GetYearMonth $PeriodDateBegin year month
+    year_m1=$(( year - 1 ))
+    year_p1=$(( year + 1 ))
+    IGCM_config_Analyse_PeriodLength
+    PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${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
+
+    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
+
+	#==========================#
+        # End of entire simulation #
+        #==========================#
+
+	# Mail notification
+	IGCM_sys_SendMail
+
+	#
+	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"
+
+        # Name of next Ksh Script output :
+	eval Script_Output="${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} )"
+
+	IGCM_debug_Print 1 "Submit next job"
+        # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR
+	IGCM_sys_Cd ${SUBMIT_DIR}
+	IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}
+        IGCM_sys_Cd -
+    fi
+
+    # Supress Non Deleted Boundary files
+    if [ ${DRYRUN} -le 2 ] ; then
+	IGCM_comp_DelFixeBoundaryFiles
+	ls -la
+    fi
+    
+    # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+    # Only for production run (No clean up in DEV or DEB mode)
+    # and command sent from .. directory.
+    IGCM_sys_Cd ..
+    [ X${JobType} = XRUN ] && IGCM_sys_Rm -rf ${RUN_DIR}
+
+    IGCM_debug_PopStack "IGCM_config_Finalize"
+}
+
+#===================================
Index: /tags/libIGCM_v1_8/libIGCM_date/IGCM_date_Test.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_date/IGCM_date_Test.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_date/IGCM_date_Test.ksh	(revision 333)
@@ -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_8/libIGCM_date/IGCM_date_Test4.ref
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_date/IGCM_date_Test4.ref	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_date/IGCM_date_Test4.ref	(revision 333)
@@ -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_8/libIGCM_date/IGCM_date_Test5.ref
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_date/IGCM_date_Test5.ref	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_date/IGCM_date_Test5.ref	(revision 333)
@@ -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_8/libIGCM_date/libIGCM_date.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_date/libIGCM_date.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_date/libIGCM_date.ksh	(revision 333)
@@ -0,0 +1,837 @@
+#!/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.
+#D-  types of calendars are possible :
+#D-
+#D-  - gregorian (other name leap) :
+#D-      The normal calendar. The time origin for the
+#D-      julian day in this case is 24 Nov -4713.
+#D-  - noleap :
+#D-      A 365 day year without leap years.
+#D-  - all_leap :
+#D-      A 366 day year with only leap years.
+#D-  - 360d :
+#D-      Year of 360 days with month of equal length.
+
+# 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 $( gawk "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 $( gawk "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_SupressZeros
+{
+    IGCM_debug_PushStack "IGCM_date_SupressZeros" $@
+    echo $( print ${1} | sed -e "s/0*//" )
+    IGCM_debug_PopStack "IGCM_date_SupressZeros"
+}
+
+#==================================================================
+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 :
+    case ${config_UserChoices_CalendarType} in
+	360d)
+	    if [ X$2 = X ] ; then
+		echo 360
+	    else
+		eval $2=360 > /dev/null 2>&1
+	    fi
+#	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	    return;;
+	noleap)
+	    if [ X$2 = X ] ; then
+	        echo 365
+	    else
+	        eval $2=365 > /dev/null 2>&1
+	    fi
+
+#	    IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	    return;;
+	all_leap)
+	    if [ X$2 = X ] ; then
+		echo 366
+	    else
+	        eval $2=366 > /dev/null 2>&1
+	    fi
+
+#	        IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	    return;;
+    esac
+
+    typeset y a
+
+    # 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=$(( $y % 400 ))
+    if [ $a = 0 ]
+	then
+	if [ X$2 = X ] ; then
+	    echo 366
+	else
+	    eval $2=366 > /dev/null 2>&1
+	fi
+
+#	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	return
+    fi
+
+    #if it is evenly divisible by 100 it must not be a leap year
+    a=$(( $y % 100 ))
+    if [ $a = 0 ]
+	then
+	if [ X$2 = X ] ; then
+	    echo 365
+	else
+	    eval $2=365 > /dev/null 2>&1
+	fi
+
+#	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	return
+    fi
+	
+    # if it is evenly divisible by 4 it must be a leap year
+    a=$(( $y % 4 ))
+    if [ $a = 0 ]
+	then
+	if [ X$2 = X ] ; then
+	    echo 366
+	else
+	    eval $2=366 > /dev/null 2>&1
+	fi
+
+#	IGCM_debug_PopStack "IGCM_date_DaysInYear"
+	return
+    fi
+
+    # otherwise it is not a leap year
+    if [ X$2 = X ] ; then
+        echo 365
+    else
+        eval $2=365 > /dev/null 2>&1
+    fi
+
+#    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
+	if [ X$3 = X ] ; then
+	    echo 30
+	else
+	    eval $3=30 > /dev/null 2>&1
+	fi
+
+#	IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+	return
+    fi
+
+    typeset ymd y m
+
+    # 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=$(( ( $1 * 10000 ) + ( $2 * 100 ) + 1 ))
+    fi
+
+    # extract the year and the month
+    y=$(( $ymd / 10000 )) ;
+    m=$(( ( $ymd % 10000 ) / 100 )) ;
+
+    # 30 days hath september etc.
+    case $m in
+	1|3|5|7|8|10|12) 
+	    if [ X$3 = X ] ; then
+	        echo 31
+	    else
+	        eval $3=31 > /dev/null 2>&1
+	    fi
+
+#	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+	    return ;;
+	4|6|9|11) 
+	    if [ X$3 = X ] ; then
+	        echo 30
+	    else
+	        eval $3=30 > /dev/null 2>&1
+	    fi
+	
+#	    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.
+    IGCM_date_DaysInYear $y diy
+    case $diy in
+	365) 
+	    if [ X$3 = X ] ; then
+	        echo 28
+	    else
+	        eval $3=28 > /dev/null 2>&1
+	    fi
+
+#	    IGCM_debug_PopStack "IGCM_date_DaysInMonth"
+	    return ;;
+	366) 
+	    if [ X$3 = X ] ; then
+	        echo 29
+	    else
+	        eval $3=29 > /dev/null 2>&1
+	    fi
+
+#	    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
+
+    typeset dt y m d x jul
+
+    # 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=$( IGCM_date_SupressZeros $1 )
+    fi
+
+    # break the yyyymmdd into separate parts for year, month and day
+    y=$(( $dt / 10000 ))
+    m=$(( ( $dt % 10000 ) / 100 ))
+    d=$(( ( $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 [ $x -lt $m ]
+      do
+      IGCM_date_DaysInMonth $y $x md
+      d=$(( $d + $md ))
+      x=$(( $x + 1 ))
+    done
+
+    # combine the year and day back together again and you have the julian date.
+    jul=$(( ( $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
+
+    typeset dt y m d grg
+
+    # 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=$(( $dt / 1000 ))
+    d=$(( $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 [ $d -gt 0 ]
+      do
+      IGCM_date_DaysInMonth $y $m md
+      d=$(( $d - $md ))
+      m=$(( $m + 1 ))
+    done
+
+    d=$(( $d + $md ))
+
+    # the loop steps one past the correct month, so back up the month
+    m=$(( $m - 1 ))
+
+    # assemble the results into a gregorian date
+    grg=$(( ( $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 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
+
+    typeset dif yd d y
+
+    # 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=$(( $yd % 1000 ))
+    y=$(( $yd / 1000 ))
+
+    # Add the number of days (if days is negative this results is
+    # a subtraction)
+    d=$(( $d + $dif ))
+
+    # Extract the days in the year
+    IGCM_date_DaysInYear $y diy
+
+    # 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 [ $d -gt $diy ]
+      do
+      d=$(( $d - $diy ))
+      y=$(( $y + 1 ))
+      IGCM_date_DaysInYear $y diy
+    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 [ $d -lt 1 ]
+      do
+      y=$(( $y - 1 ))
+      IGCM_date_DaysInYear $y diy
+      d=$(( $d + $diy ))
+    done
+
+    # put the year and day back together and echo the result
+    yd=$(( ( $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 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=$(( $jul1 / 1000 ))
+    yyyy2=$(( $jul2 / 1000 ))
+    ddd1=$(( $jul1 % 1000 ))
+    ddd2=$(( $jul2 % 1000 ))
+
+    # Subtract days
+    res=$(( $ddd1 - $ddd2 ))
+
+    # Then add days in year until year2 matches year1
+
+    if [ "${config_UserChoices_CalendarType}" = "360d" ] ; then
+	res=$(( ( ( $yyyy1 - $yyyy2 ) * 360 ) + $res ))
+    elif [ "${config_UserChoices_CalendarType}" = "noleap" ] ; then
+	res=$(( ( ( $yyyy1 - $yyyy2 ) * 365 ) + $res ))
+    elif [ "${config_UserChoices_CalendarType}" = "all_leap" ] ; then
+	res=$(( ( ( $yyyy1 - $yyyy2 ) * 366 ) + $res ))
+    elif ( [ "${config_UserChoices_CalendarType}" = "leap" ] || [ "${config_UserChoices_CalendarType}" = "gregorian" ] ) ; then
+	while [ $yyyy2 -lt $yyyy1 ]
+	  do
+	  IGCM_date_DaysInYear $yyyy2 diy
+	  res=$(( $res + $diy ))
+	  yyyy2=$(( $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=$(( $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;;
+	    all_leap) 
+		aux=-366;;
+	    leap|gregorian)
+		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;;
+	    all_leap) 
+		aux=365634;;
+	    leap|gregorian)
+		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;;
+	    all_leap) 
+		aux=695034;;
+	    leap|gregorian)
+		aux=693595;;
+	esac
+	num=19000101
+    fi
+    echo $(( $( 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 gawk > /dev/null 2>&1
+    if [ ! $? -eq 0 ] ; then
+	echo "Check libIGCM_date ...........................................[ FAILED ]"
+        echo "--Error--> gawk 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_8/libIGCM_debug/IGCM_debug_Test.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_debug/IGCM_debug_Test.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_debug/IGCM_debug_Test.ksh	(revision 333)
@@ -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_8/libIGCM_debug/IGCM_debug_Test.ref
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_debug/IGCM_debug_Test.ref	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_debug/IGCM_debug_Test.ref	(revision 333)
@@ -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_8/libIGCM_debug/libIGCM_debug.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_debug/libIGCM_debug.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_debug/libIGCM_debug.ksh	(revision 333)
@@ -0,0 +1,314 @@
+#!/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 DEBUG_debug=${DEBUG_debug:=false}
+
+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}
+unset IGCM_debug_Stack
+unset IGCM_debug_StackArgs
+IGCM_debug_Stack[0]=${NULL_STR}
+IGCM_debug_StackArgs[0]=${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
+	echo "!------------------------!"
+    fi
+}
+
+#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[0]=$(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 ( $DEBUG_debug ) ; then
+	if ( ${ExitFlag} ) ; then
+	    echo '!!! ExitFlag has been activated !!!' >> stack
+	fi
+	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 tmpStack -- ${IGCM_debug_Stack[*]}
+	    unset IGCM_debug_Stack
+	    set +A IGCM_debug_Stack -- ${tmpStack[*]} 
+
+	    set +A tmpStack -- ${IGCM_debug_StackArgs[*]}
+	    unset IGCM_debug_StackArgs
+	    set +A IGCM_debug_StackArgs -- ${tmpStack[*]}
+	    unset tmpStack
+	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}
+	  unset IGCM_debug_Stack
+	  unset IGCM_debug_StackArgs
+	  IGCM_debug_Stack[0]=${NULL_STR}
+          IGCM_debug_StackArgs[0]=${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
+    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."
+	echo
+	if ( $DEBUG_debug ) ; then
+	    IGCM_sys_Cp stack ${SUBMIT_DIR}/stack_error
+	    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
+	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 [ X"${1}" = X"-e" ]; then
+	typeset cmd_echo="echo -e"
+	shift
+    else
+	typeset cmd_echo="echo"
+    fi
+
+    if [ ${level} -le ${Verbosity} ] ; then
+	typeset i
+	case "${level}" in
+	    1) for i in "$@" ; do
+		    ${cmd_echo} "--Debug1-->" ${i}
+	      done ;; 
+	    2) for i in "$@" ; do
+		    ${cmd_echo} "--------Debug2-->" ${i}
+	      done ;; 
+	    3) for i in "$@" ; do
+		    ${cmd_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
+
+    list=$( set | grep $1 | sed -e "s/'//g" )
+
+    if [ "X${list}" != X ]  ; then
+        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_8/libIGCM_post/IGCM_Patch_20070220_histcom_time_axis.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20070220_histcom_time_axis.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20070220_histcom_time_axis.ksh	(revision 333)
@@ -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_8/libIGCM_post/IGCM_Patch_20090317_histcom__Fillvalue.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20090317_histcom__Fillvalue.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20090317_histcom__Fillvalue.ksh	(revision 333)
@@ -0,0 +1,36 @@
+#!/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 change _Fillvalue to old missing_value    !!!!
+#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+function IGCM_Patch_20090317_histcom__Fillvalue {
+    IGCM_debug_PushStack "IGCM_Patch_histcom__Fillvalue" $@
+ 
+    typeset file
+
+    file=t_$1
+    IGCM_sys_Mv ${1} ${file}
+    IGCM_sys_Chmod 644 ${file}
+
+    #IGCM_sys_ncrename -O --hst -a _Fillvalue,missing_value ${file}
+
+    miss=$( ncdump -h ${file} | grep _Fillvalue | head -1 | awk "-F=" '{print $2}' |  awk "-Ff" '{print $1}' )
+
+    [ ! X${miss} = X ] && IGCM_sys_ncatted -a missing_value,,c,f,${miss} ${file} 
+
+    IGCM_sys_Mv ${file} ${1}
+    
+    IGCM_debug_PopStack "IGCM_Patch_histcom__Fillvalue"
+}
Index: /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20090407_histcom_time_axis.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20090407_histcom_time_axis.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20090407_histcom_time_axis.ksh	(revision 333)
@@ -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_20090407_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:]][fd][lo][ou][ab][tl][ e] *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_8/libIGCM_post/IGCM_Patch_20091030_histcom_time_axis.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091030_histcom_time_axis.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091030_histcom_time_axis.ksh	(revision 333)
@@ -0,0 +1,91 @@
+#!/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_20091030_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:]][fd][lo][ou][ab][tl][ e] *t_ave_\([0-9a-zA-Z]*\).*/\1/')
+    # liste => tous les axes de temps vont s'appeler time_counter !!
+    if [ $? -eq 0 ] ; then
+      if [ ${#AXISt[*]} -ge 1 ] ; 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
+
+        # Rename coordinates attribut from t_ave_xxxx to time_counter
+
+        set +A VARName $( cat ${file}_ncdump-h | grep "[0-9a-zA-Z_]*.*:coordinates.*" | grep "t_ave_${AXISt_i}" | sed -e "s/[[:space:]]*\(.*\):coordinates.*/\1/" )
+        for var in ${VARName[*]} ; do
+            # Old attribute value
+            ATTN=$( cat ${file}_ncdump-h | grep "${var}:coordinates.*" | grep "t_ave_${AXISt_i}" | sed -e "s/.*:coordinates = \"\(.*\)\" ;/\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 coordinates,${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
+    fi
+    IGCM_sys_Rm ${1}_ncdump-h
+    
+    IGCM_debug_PopStack "IGCM_Patch_histcom_time_axis"
+}
Index: /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091116_ncks_ncra.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091116_ncks_ncra.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091116_ncks_ncra.ksh	(revision 333)
@@ -0,0 +1,56 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Marie-Alice Foujols
+# Contact: Foujols_ipsl.jussieu.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2009)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+#
+#**************************************************************
+
+#------------------------------------------------------------
+# ncks CPL files for 1D frequency, ncra for 1M averaged files
+#------------------------------------------------------------
+
+function IGCM_Patch_20091116_ncks_ncra {
+    IGCM_debug_PushStack "IGCM_Patch_ncks_ncra" $@
+
+    CPL_OkDay=y
+    CPL_OkMonth=y
+
+    PREFIX=TEMPO
+    if [ -f FIRST_TIME_CPL ] ; then
+       echo FIRST_TIME_CPL exists
+    else
+       # create FIRST_TIME_CPL file
+       date > FIRST_TIME_CPL
+
+       ls -l S*_out.*.nc C*_out.*.nc
+
+       rm -f ${PREFIX}_*_cpl_*.nc 
+
+       for file in S*_out.*.nc C*_out.*.nc
+       do
+           [[ ${CPL_OkDay}   = "y" ]] && IGCM_sys_ncks -A ${file} ${PREFIX}_1D_cpl_atm.nc  > /dev/null 2>&1
+           [[ ${CPL_OkMonth} = "y" ]] && IGCM_sys_ncra -A ${file} ${PREFIX}_1M_cpl_atm.nc  > /dev/null 2>&1
+       done
+       rm -f S*_out.*.nc C*_out.*.nc
+
+       ls -l O*_out.*.nc
+
+       for file in O*_out.*.nc
+       do
+           [[ ${CPL_OkDay}   = "y" ]] && IGCM_sys_ncks -A ${file} ${PREFIX}_1D_cpl_oce.nc   > /dev/null 2>&1
+           [[ ${CPL_OkMonth} = "y" ]] && IGCM_sys_ncra -A ${file} ${PREFIX}_1M_cpl_oce.nc   > /dev/null 2>&1
+       done
+       rm -f O*_out.*.nc
+
+       ls -s ${PREFIX}_*_cpl_*.nc 
+
+     fi
+    
+    IGCM_debug_PopStack "IGCM_Patch_ncks_ncra"
+}
Index: /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091118_mask.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091118_mask.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091118_mask.ksh	(revision 333)
@@ -0,0 +1,124 @@
+#!/bin/ksh
+
+#**************************************************************
+# Author: Arnaud Caubel
+# Contact: Arnaud.Caubel_lsce.ipsl.fr
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2009)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+#
+#**************************************************************
+
+#------------------------------------------------------------
+# Add mask from meshmask file to oceanic variables
+#------------------------------------------------------------
+
+function IGCM_Patch_20091118_mask {
+
+    IGCM_debug_PushStack "IGCM_Patch_mask" $@
+
+    [ -f ${config_UserChoices_JobName}_mesh_mask.nc ] || IGCM_sys_Get ${R_SAVE}/OCE/Output/${config_UserChoices_JobName}_mesh_mask.nc .
+
+    filename=${1}
+
+    chaineT=${filename%%'grid_T'*}
+    chaineU=${filename%%'grid_U'*}
+    chaineV=${filename%%'grid_V'*}
+    chaineW=${filename%%'grid_W'*}
+    chaineIce=${filename%%'icemod'*}
+    chaineTrc=${filename%%'ptrc_T'*}
+    chaineDia=${filename%%'diad_T'*}
+
+    if [ ${filename} != ${chaineT} ]; then
+	mask='tmask' ; depth='deptht'
+    elif [ ${filename} != ${chaineU} ]; then
+	mask='umask' ; depth='depthu'
+    elif [ ${filename} != ${chaineV} ]; then
+	mask='vmask' ; depth='depthv'
+    elif [ ${filename} != ${chaineW} ]; then
+	mask='tmask' ; depth='depthw'
+    elif [ ${filename} != ${chaineIce} ]; then
+	mask='tmask' ; depth='deptht'
+    elif [ ${filename} != ${chaineTrc} ]; then
+	mask='tmask' ; depth='deptht'
+    elif [ ${filename} != ${chaineDia} ]; then
+	mask='tmask' ; depth='deptht'
+    fi
+
+    #============================================
+    # Remove nav_lon, nav_lat file
+    IGCM_sys_ncks -Oh -x -v nav_lon,nav_lat ${filename} file1.nc
+
+    #============================================
+    # Extract mask variable
+    IGCM_sys_ncks -Oh -v ${mask} ${config_UserChoices_JobName}_mesh_mask.nc mask3D.nc
+
+    #============================================
+    # Rename deptht dimension
+    IGCM_sys_ncrename -Oh -d z,${depth} mask3D.nc
+
+    #============================================
+    # Remove single dimension t
+    IGCM_sys_ncwa -Oh -a t mask3D.nc mask3D.nc
+
+    #============================================
+    # Create mask2D 
+    IGCM_sys_ncks -Oh -d ${depth},0,0 mask3D.nc mask2D.nc
+    IGCM_sys_ncwa -Oh -a ${depth} mask2D.nc mask2D.nc
+    IGCM_sys_ncrename -h -v ${mask},mask2D mask2D.nc
+
+    #============================================
+    # Append mask (2D) to file1.nc
+    IGCM_sys_ncks -Ah -c -v mask2D mask2D.nc file1.nc
+
+    if [ ${filename} = ${chaineIce} ]; then
+
+        #============================================
+        # Append mask (3D) only for oceanic files
+	IGCM_sys_ncks -Ah -v ${mask} mask3D.nc file1.nc
+	IGCM_sys_ncrename -h -v ${mask},mask3D file1.nc
+
+        #============================================
+        # Add record dimension only for oceanic files
+	IGCM_sys_ncecat -Oh file1.nc file1.nc
+
+        #============================================
+        # Apply mask 3D only for oceanic files
+	IGCM_sys_ncwa -Oh -a record -B 'mask3D==1' file1.nc file2.nc
+	IGCM_sys_Rm file1.nc
+	IGCM_sys_Mv file2.nc file1.nc
+
+
+    fi
+
+    #============================================
+    # Add record dimension
+    IGCM_sys_ncecat -Oh file1.nc file1.nc
+
+    #============================================
+    # Apply mask 2D
+    IGCM_sys_ncwa -Oh -b -a record -B 'mask2D==1' file1.nc file1.nc
+
+    #============================================
+    # Permute record dimension in time_counter dimension
+    IGCM_sys_ncpdq -Oh -a time_counter,record file1.nc file1.nc
+    IGCM_sys_ncwa -Oh -a record file1.nc file1.nc
+
+    #============================================
+    # Remove mask
+    IGCM_sys_ncks -Oh -x -v mask2D,mask3D file1.nc file_mask.nc
+
+    #============================================
+    # Add nav_lon nav_lat
+    IGCM_sys_ncks -Ah -v nav_lon,nav_lat ${filename} file_mask.nc
+
+    #============================================
+    # Cleaning
+    IGCM_debug_Verif_Exit_Post
+    IGCM_sys_Mv file_mask.nc ${filename}
+    IGCM_sys_Rm mask3D.nc mask2D.nc file1.nc
+    
+    IGCM_debug_PopStack "IGCM_Patch_mask"
+}
Index: /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091119_put_out.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091119_put_out.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_post/IGCM_Patch_20091119_put_out.ksh	(revision 333)
@@ -0,0 +1,24 @@
+#!/bin/ksh
+
+#**************************************************************
+# Contact: Foujols_ipsl.jussieu.fr
+# Modified by Marie-Alice Foujols
+# $Date$
+# $Author$
+# $Revision$
+# IPSL (2009)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+#
+#**************************************************************
+
+#------------------------------------------------------------
+# to put_out the result of IGCM_Patch_20091116_ncks_ncra.ksh
+#------------------------------------------------------------
+
+function IGCM_Patch_20091119_put_out {
+    IGCM_debug_PushStack "IGCM_Patch_put_out" $@
+
+       ncdump -h $@
+
+    IGCM_debug_PopStack "IGCM_Patch_put_out"
+}
Index: /tags/libIGCM_v1_8/libIGCM_post/libIGCM_post.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_post/libIGCM_post.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_post/libIGCM_post.ksh	(revision 333)
@@ -0,0 +1,723 @@
+#!/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_Configure
+{
+    IGCM_debug_PushStack "IGCM_post_Configure"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_post_Configure :"
+    echo
+
+    typeset NbDays PeriodEndJul PostEndJul PeriodPost
+    RebuildFrequency=false
+
+    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
+
+	IGCM_debug_Print 1 "Asynchronous rebuild has been activated."
+	echo
+
+	case ${config_Post_RebuildFrequency} in
+            *y|*Y)
+                PeriodYear=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[yY]//" )
+		case ${config_UserChoices_PeriodLength} in
+		    *Y|*y)
+			PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" )
+			if [ ${PeriodPost} -le ${PeriodYear} ] ; then
+			    if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodYear}  ) -eq 0 ] ;  then
+				RebuildFrequency=true
+				NbRebuildDir=$( expr ${PeriodYear} / ${PeriodPost} )
+			    fi
+			else
+			    IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			    IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
+			fi ;;
+		    *M|*m)
+ 	                PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
+			if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then
+ 	                    if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then
+ 				RebuildFrequency=true
+				NbRebuildDir=$( expr $(( 12 * ${PeriodYear} )) / ${PeriodPost} )
+			    fi
+			else
+			    IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			    IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
+ 	                fi ;;
+                    *D|*d)
+                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
+			NbDays=$( IGCM_date_DaysInYear ${year} )
+			if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then
+			    if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then
+				if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${PeriodPost} \) ) ) -eq 0 ] ; then
+                                    RebuildFrequency=true
+				    NbRebuildDir=$( expr $(( ${NbDays} * ${PeriodYear} )) / ${PeriodPost} )
+				fi
+			    else
+				IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+				IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
+			    fi
+			else
+#			    if [ ${PeriodYear} -eq 1 ] ; then
+#				PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
+#				PostEndJul=${year}${NbDays}
+#                               #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}"
+#				#echo "PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
+#				if [ ${PostEndJul} -eq ${PeriodEndJul} ] ; then
+#				    RebuildFrequency=true
+#				    NbRebuildDir=$( expr ${NbDays} / ${PeriodPost} )
+#				fi
+#			    else
+			    IGCM_debug_Print 3 "For RebuildFrequency with leap calendar:"
+			    IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y."
+			    IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment."
+#			    fi
+                        fi;;
+		esac ;;
+	    *M|*m)
+		PeriodMonth=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[mM]//" )
+                case ${config_UserChoices_PeriodLength} in
+		    *Y|*y)
+                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
+		    *M|*m)
+			PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
+			if [ ${PeriodPost} -le ${PeriodMonth} ] ; then
+			    if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodMonth}  ) -eq 0 ] ;  then
+				RebuildFrequency=true
+				NbRebuildDir=$( expr ${PeriodMonth} / ${PeriodPost} )
+			    fi
+			else
+			    IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			    IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
+			fi ;;
+		    *D|*d)
+			IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" ;;
+		esac
+                ;;
+            *D|*d)
+                PeriodDay=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[dD]//" )
+                case ${config_UserChoices_PeriodLength} in
+                    *Y|*y)
+                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
+                    *M|*m)
+                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
+                    *D|*d)
+                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
+                        if [ ${PeriodPost} -le ${PeriodDay} ] ; then
+                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodDay}  ) -eq 0 ] ;  then
+                                RebuildFrequency=true
+                                NbRebuildDir=$( expr ${PeriodDay} / ${PeriodPost} )
+                            fi
+                        else
+                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
+                        fi ;;
+
+                esac
+                ;;
+            NONE|none)
+		;;
+	    *)
+		IGCM_debug_Print 3 "KeyWord not allowed for RebuildFrequency in config.card"
+		;;
+        esac
+    else
+	#
+	IGCM_debug_Print 1 "Asynchronous rebuild has not been activated"
+	IGCM_debug_Print 1 "Proceed with standard post-treatment pathway"
+	echo
+	#
+    fi
+
+    IGCM_debug_Print 1 "RebuildFrequency flag value : ${RebuildFrequency}"
+    IGCM_post_Initialize
+
+    IGCM_debug_PopStack "IGCM_post_Configure"
+}
+
+function IGCM_post_Initialize
+{
+    IGCM_debug_PushStack "IGCM_post_Initialize"
+
+    # Debug Print :
+    echo
+    IGCM_debug_Print 1 "IGCM_post_Initialize :"
+    echo
+
+    typeset NbDays PeriodEndJul PostEndJul
+    #
+    # Initialize
+    #
+    POST=false
+    TimeSeriesFrequency=false
+    SeasonalFrequency=false
+    #
+    # ONLY IF SOMETHING NEEDS TO BE DONE (EATHER TIME SERIES OR SEASONAL) COMPUTE THE MODULOS
+    #
+    if ( [ X${TimeSeries} = Xtrue ] || [ X${TimeSeries2D} = Xtrue ] || [ X${TimeSeries3D} = Xtrue ] ) ; then
+	list_post=TimeSeriesFrequency
+    fi
+    #
+    if [ X${Seasonal} = Xtrue ] ; then
+	list_post="${list_post} SeasonalFrequency"
+    fi
+    #
+    # READ TIME SERIES OR SEASONAL FREQUENCY
+    # AND TURN ON THE SUBMISSION FLAG WHEN MODULO IS ZERO
+    #
+    for post_freq in ${list_post} ; do
+        #
+        # Extract frequency from previously defined variable
+        #
+        config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} )
+	#
+	# Offset for Seasonal Average starting period
+	#
+	if [ ${post_freq} = SeasonalFrequency ] ; then
+	    if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
+		PeriodOffset=0
+	    else
+		PeriodOffset=${config_Post_SeasonalFrequencyOffset}
+	    fi
+	else
+	    PeriodOffset=0
+	fi
+        #
+        if ( [ X${config_Post_post_freq} = X${NULL_STR} ] || [ X${config_Post_post_freq} = XNONE ] ) ; then
+            #
+            continue
+            #
+        fi
+        #
+	case ${config_Post_post_freq} in
+	    *y|*Y)
+		PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" )
+		#
+		case ${config_UserChoices_PeriodLength} in
+		    *Y|*y)
+			PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" )
+			if [ ${PeriodPost} -le ${PeriodYear} ] ; then
+			    if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodYear} ) -eq 0 ] ;  then
+				[ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
+				[ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true
+			    fi
+			else
+			    IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			    IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
+			fi ;;
+		    *M|*m)
+ 			PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
+			if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then
+			    if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then
+				[ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && eval ${post_freq}=true
+				[ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && POST=true
+			    fi
+			else
+			    IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			    IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
+			fi ;;
+		    *D|*d)
+			PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
+			NbDays=$( IGCM_date_DaysInYear ${year} )
+			if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then
+			    if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then
+				if [ $( expr $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) % \
+				    $(( ${NbDays} * ${PeriodYear} / ${PeriodPost} )) ) -eq 0 ] ; then
+				    [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] && eval ${post_freq}=true
+				    [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] POST=true
+				fi
+			    else
+				IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+				IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
+			    fi
+			else
+#					    if [ ${PeriodYear} -eq 1 ] ; then
+#						PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
+#						PostEndJul=${year}${NbDays}
+#                                                #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}"
+#						#echo PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
+#						if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then
+#						    eval ${post_freq}=true
+#						    POST=true
+#						fi
+#					    else
+			    IGCM_debug_Print 3 "For ${post_freq} with leap calendar, for ${comp} and ${file_in} :"
+			    IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y."
+			    IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment."
+#					    fi
+			fi;;
+		esac ;;
+	    *M|*m)
+		PeriodMonth=$( echo ${config_Post_post_freq} | sed -e "s/[mM]//" )
+		case ${config_UserChoices_PeriodLength} in
+		    *Y|*y)
+			IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
+		    *M|*m)
+			PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
+			if [ ${PeriodPost} -le ${PeriodMonth} ] ; then
+			    if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) % ${PeriodMonth}  ) -eq 0 ] ;  then
+				[ $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
+				[ $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) -ne 0 ] && POST=true
+			    fi
+			else
+			    IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			    IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
+			fi;;
+		    *D|*d)
+			IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+			IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
+		esac ;;
+            *D|*d)
+                PeriodDay=$( echo ${config_Post_post_freq} | sed -e "s/[dD]//" )
+                case ${config_UserChoices_PeriodLength} in
+                    *Y|*y)
+                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
+                    *M|*m)
+                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
+                    *D|*d)
+                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
+                        if [ ${PeriodPost} -le ${PeriodDay} ] ; then
+                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodDay}  ) -eq 0 ] ;  then
+                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
+                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true
+                            fi
+                        else
+                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
+                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
+                        fi;;
+                esac ;;
+	    NONE|none)
+		;;
+	    *)
+		IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card"
+		;;
+	esac
+    done
+    #
+    if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \
+	 [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]        && \
+	 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
+	TimeSeriesFrequency=true
+	POST=true
+    fi
+
+    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \
+	 [ ! X${config_Post_RebuildFrequency} = XNONE ]        && \
+	 [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
+	RebuildFrequency=true
+	POST=true
+    fi
+
+    #
+    IGCM_debug_Print 1 "POST-TREATEMENT flag value : ${POST}"
+    #
+    IGCM_post_Submit
+
+    IGCM_debug_PopStack "IGCM_post_Initialize"
+}
+
+function IGCM_post_Submit
+{
+    IGCM_debug_PushStack "IGCM_post_Submit"
+
+    POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+
+    if [ ${POST} = true ]; then
+	echo
+	IGCM_debug_Print 1 "IGCM_post_Submit :"
+	echo
+	IGCM_debug_Print 1 "POST_DIR = ${POST_DIR}"
+    fi
+
+    #============ TIME SERIES POST-TREATMENT ===========#
+    if [ ${TimeSeriesFrequency} = true ] ; then
+
+        IGCM_debug_Print 2 "TIME SERIES POST-PROCESSING ACTIVATED :"
+        echo
+
+
+
+	# Get information from last execution
+	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted
+	CompletedFlag=${run_PostProcessing_TimeSeriesCompleted}
+        #
+
+
+
+        typeset listVarEnv
+        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,CompletedFlag,TsTask,CompToRead,FlagToRead,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_BIOS,config_UserChoices_JobName,R_SAVE"
+	#
+	jLoop=${#ListDimension[*]}
+	j=0
+	until [ $j -ge ${jLoop} ]; do
+	    Dimension=${ListDimension[${j}]}
+	    #
+	    if [ X$( eval echo \${TimeSeries${Dimension}} ) = Xtrue ] ; then
+		#
+		IGCM_debug_Print 2 "TIME SERIES POST-PROCESSING ${Dimension} ACTIVATED :"
+		echo
+                #
+		if [ X${Dimension} = X ] ; then
+		    TsTask="empty"
+		else
+		    TsTask=${Dimension}
+		fi
+	        #
+		if [ ${RebuildFrequency} = true ] && [ ${DRYRUN} -le 1 ] ; then
+	            #
+		    if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+			echo "export DEBUG_debug=${DEBUG_debug}            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export MODIPSL=${MODIPSL}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export libIGCM_SX=${libIGCM}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export libIGCM=${libIGCM_POST}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export SUBMIT_DIR=${SUBMIT_DIR}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export POST_DIR=${POST_DIR}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export MASTER=${MASTER}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export RebuildFrequency=${RebuildFrequency}  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export DateBegin=${DateBegin}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export PeriodDateEnd=${PeriodDateEnd}        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export StandAlone=false                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export CompletedFlag=${CompletedFlag}        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export TsTask=${TsTask}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export RESOL_ATM=${RESOL_ATM}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export RESOL_OCE=${RESOL_OCE}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export RESOL_ICE=${RESOL_ICE}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export RESOL_MBG=${RESOL_MBG}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export RESOL_SRF=${RESOL_SRF}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export RESOL_BIOS=${RESOL_BIOS}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export R_SAVE=${R_SAVE}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "export listVarEnv=${listVarEnv}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "IGCM_sys_MkdirWork ${POST_DIR}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "IGCM_debug_Verif_Exit                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			echo "IGCM_sys_QsubPost create_ts                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		    fi
+	            #
+		else
+	            #
+		    IGCM_sys_RshPost <<-EOF
+                    export DEBUG_debug=${DEBUG_debug}
+                    export MODIPSL=${MODIPSL}
+                    export libIGCM_SX=${libIGCM}
+                    export libIGCM=${libIGCM_POST}
+                    export SUBMIT_DIR=${SUBMIT_DIR}
+                    export POST_DIR=${POST_DIR}
+                    export MASTER=${MASTER}
+                    export RebuildFrequency=${RebuildFrequency}
+                    export DateBegin=${DateBegin}
+                    export PeriodDateEnd=${PeriodDateEnd}
+                    export StandAlone=false
+                    export CompletedFlag=${CompletedFlag}
+                    export TsTask=${TsTask}
+                    export RESOL_ATM=${RESOL_ATM}
+                    export RESOL_OCE=${RESOL_OCE}
+                    export RESOL_ICE=${RESOL_ICE}
+                    export RESOL_MBG=${RESOL_MBG}
+                    export RESOL_SRF=${RESOL_SRF}
+                    export RESOL_BIOS=${RESOL_BIOS}
+                    export config_UserChoices_JobName=${config_UserChoices_JobName}
+                    export R_SAVE=${R_SAVE}
+                    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
+	    fi
+	    #
+	    if [ X$( eval echo \${TimeSeriesChunck${Dimension}} ) = Xtrue ] ; then
+		#
+		IGCM_debug_Print 2 "TIME SERIES POST-PROCESSING ${Dimension} WITH CHUNCK ACTIVATED :"
+		echo
+		# Need to Remember This One
+		SavedDateBegin=${DateBegin}
+		# Kind of task create_ts will perform
+		TsTask=Chunck${Dimension}
+	        # Number of chunck jobs to configure and submit
+		eval NbJob=\${#CHUNCK${Dimension}_COMP[@]}
+		export i=0
+		until [ $i -ge $NbJob ]; do
+		    CompToRead=$( eval echo \${CHUNCK${Dimension}_COMP[\${i}]} )
+		    FlagToRead=$( eval echo \${CHUNCK${Dimension}_FLAG[\${i}]} )
+		    ChunckSize=$( eval echo \${CHUNCK${Dimension}_SIZE[\${i}]} )
+		    # Chunck Length (mandatory in Year)
+		    YearsChunckLength=$( echo ${ChunckSize} | sed -e "s/[yY]//" )
+		    #
+		    IGCM_date_GetYearMonth ${DateBegin}     YearBegin MonthBegin
+		    #
+		    IGCM_date_GetYearMonth ${PeriodDateEnd} YearEnd   MonthEnd
+		    # How many chunck in total since simulation began
+		    NbYearsChunckLoop=$(( ( ${YearEnd} - ${YearBegin} + 1 ) / ${YearsChunckLength} ))
+		    #  Tweak special case
+		    [ $(( ( ${YearEnd} - ${YearBegin} + 1 ) % ${YearsChunckLength} )) = 0 ] && NbYearsChunckLoop=$(( ${NbYearsChunckLoop} - 1 ))
+		    # Starting Year of the current chunck
+		    ChunckTsYearBegin=$(( ${NbYearsChunckLoop} *  ${YearsChunckLength} + ${YearBegin} ))
+		    # Starting date of the current chunck
+		    ChunckTsDateBegin=${ChunckTsYearBegin}${MonthBegin}01
+		    #
+		    if [ ${RebuildFrequency} = true ] && [ ${DRYRUN} -le 1 ] ; then
+	                #
+			if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+			    echo "export DEBUG_debug=${DEBUG_debug}            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export MODIPSL=${MODIPSL}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export libIGCM_SX=${libIGCM}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export libIGCM=${libIGCM_POST}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export SUBMIT_DIR=${SUBMIT_DIR}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export POST_DIR=${POST_DIR}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export MASTER=${MASTER}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export RebuildFrequency=${RebuildFrequency}  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export DateBegin=${ChunckTsDateBegin}        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export PeriodDateEnd=${PeriodDateEnd}        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export StandAlone=false                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export CompletedFlag=${CompletedFlag}        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export TsTask=${TsTask}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export CompToRead=${CompToRead}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export FlagToRead=${FlagToRead}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export RESOL_ATM=${RESOL_ATM}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export RESOL_OCE=${RESOL_OCE}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export RESOL_ICE=${RESOL_ICE}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export RESOL_MBG=${RESOL_MBG}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export RESOL_SRF=${RESOL_SRF}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export RESOL_BIOS=${RESOL_BIOS}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export R_SAVE=${R_SAVE}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "export listVarEnv=${listVarEnv}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_sys_MkdirWork ${POST_DIR}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_debug_Verif_Exit                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			    echo "IGCM_sys_QsubPost create_ts                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+			fi
+	                #
+		    else
+	                #
+			IGCM_sys_RshPost <<-EOF
+                        export DEBUG_debug=${DEBUG_debug}
+                        export MODIPSL=${MODIPSL}
+                        export libIGCM_SX=${libIGCM}
+                        export libIGCM=${libIGCM_POST}
+                        export SUBMIT_DIR=${SUBMIT_DIR}
+                        export POST_DIR=${POST_DIR}
+                        export MASTER=${MASTER}
+                        export RebuildFrequency=${RebuildFrequency}
+                        export DateBegin=${ChunckTsDateBegin}
+                        export PeriodDateEnd=${PeriodDateEnd}
+                        export StandAlone=false
+                        export CompletedFlag=${CompletedFlag}
+                        export TsTask=${TsTask}
+                        export CompToRead=${CompToRead}
+                        export FlagToRead=${FlagToRead}
+                        export RESOL_ATM=${RESOL_ATM}
+                        export RESOL_OCE=${RESOL_OCE}
+                        export RESOL_ICE=${RESOL_ICE}
+                        export RESOL_MBG=${RESOL_MBG}
+                        export RESOL_SRF=${RESOL_SRF}
+                        export RESOL_BIOS=${RESOL_BIOS}
+                        export config_UserChoices_JobName=${config_UserChoices_JobName}
+                        export R_SAVE=${R_SAVE}
+                        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
+		    #
+		    export DateBegin=${SavedDateBegin}
+		    #
+		    (( i=i+1 ))
+		    #
+		done
+	    fi
+	    (( j=j+1 ))
+	done
+    fi
+
+    #=============  SEASONAL POST-TREATMENT ============#
+    if [ ${SeasonalFrequency} = true ] ; then
+        #
+        IGCM_debug_Print 2 "SEASONNAL POST-TREATMENT :"
+        echo
+        #
+        typeset listVarEnv
+	listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,RebuildFrequency,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_BIOS,config_UserChoices_JobName,R_SAVE"
+
+	if [ ${RebuildFrequency} = true ] && [ ${DRYRUN} -le 1 ] ; then
+	    #
+	    echo "export DEBUG_debug=${DEBUG_debug}            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export MODIPSL=${MODIPSL}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export libIGCM_SX=${libIGCM}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export libIGCM=${libIGCM_POST}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export SUBMIT_DIR=${SUBMIT_DIR}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export POST_DIR=${POST_DIR}                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export MASTER=${MASTER}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export RebuildFrequency=${RebuildFrequency}  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export DateBegin=${DateBegin}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export PeriodDateEnd=${PeriodDateEnd}        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export StandAlone=false                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export RESOL_ATM=${RESOL_ATM}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export RESOL_OCE=${RESOL_OCE}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export RESOL_ICE=${RESOL_ICE}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export RESOL_MBG=${RESOL_MBG}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export RESOL_SRF=${RESOL_SRF}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export RESOL_BIOS=${RESOL_BIOS}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "export R_SAVE=${R_SAVE}                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "export listVarEnv=${listVarEnv}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "IGCM_sys_MkdirWork ${POST_DIR}               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "IGCM_debug_Verif_Exit                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+            echo "IGCM_sys_QsubPost create_se                  " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    #
+	else
+	    #
+            IGCM_sys_RshPost <<-EOF
+            export DEBUG_debug=${DEBUG_debug}
+            export MODIPSL=${MODIPSL}
+	    export libIGCM_SX=${libIGCM}
+            export libIGCM=${libIGCM_POST}
+            export SUBMIT_DIR=${SUBMIT_DIR}
+            export POST_DIR=${POST_DIR}
+            export MASTER=${MASTER}
+            export RebuildFrequency=${RebuildFrequency}
+            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_MBG=${RESOL_MBG}
+            export RESOL_SRF=${RESOL_SRF}
+            export RESOL_BIOS=${RESOL_BIOS}
+            export config_UserChoices_JobName=${config_UserChoices_JobName}
+            export R_SAVE=${R_SAVE}
+            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
+    fi
+
+    #============== REBUILD POST-TREATMENT =============#
+    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
+	# -----------------------------------------------------------------------------------
+        # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now
+        # -----------------------------------------------------------------------------------
+	if [ ${DRYRUN} -le 1 ] ; then
+	    echo "IGCM_debug_PopStack \"IGCM_FlushRebuild\" " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	    echo "}                                       " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	fi
+        if [ ${config_Post_RebuildFromArchive} = true ] ; then
+            IGCM_sys_Put_Dir REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
+        else
+            IGCM_sys_Mv      REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
+        fi
+    fi
+    #
+    if [ ${RebuildFrequency} = true ] ; then
+	#
+        if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then
+            #
+            IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM ARCHIVE:"
+            echo
+            #
+            typeset listVarEnv
+            listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_BIOS,config_UserChoices_JobName,R_SAVE"
+            IGCM_sys_RshPost <<-EOF
+            export DEBUG_debug=${DEBUG_debug}
+            export MODIPSL=${MODIPSL}
+	    export libIGCM_SX=${libIGCM}
+            export libIGCM=${libIGCM_POST}
+            export SUBMIT_DIR=${SUBMIT_DIR}
+            export REBUILD_DIR=${REBUILD_DIR}
+            export POST_DIR=${POST_DIR}
+            export MASTER=${MASTER}
+            export RebuildFromArchive=${config_Post_RebuildFromArchive}
+            export DateBegin=${DateBegin}
+            export PeriodDateBegin=${PeriodDateBegin}
+            export PeriodDateEnd=${PeriodDateEnd}
+            export NbRebuildDir=${NbRebuildDir}
+            export StandAlone=false
+            export RESOL_ATM=${RESOL_ATM}
+            export RESOL_OCE=${RESOL_OCE}
+            export RESOL_ICE=${RESOL_ICE}
+            export RESOL_MBG=${RESOL_MBG}
+            export RESOL_SRF=${RESOL_SRF}
+            export RESOL_BIOS=${RESOL_BIOS}
+            export config_UserChoices_JobName=${config_UserChoices_JobName}
+            export R_SAVE=${R_SAVE}
+            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 rebuild_fromArchive
+EOF
+        else
+            #
+            IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM WORKDIR:"
+	    echo
+	    #
+            typeset listVarEnv
+            listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,POST_DIR,MASTER,RebuildFromArchive,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_BIOS,config_UserChoices_JobName,R_SAVE"
+	    IGCM_sys_RshPost <<-EOF
+            export DEBUG_debug=${DEBUG_debug}
+            export MODIPSL=${MODIPSL}
+            export libIGCM_SX=${libIGCM}
+            export libIGCM=${libIGCM_POST}
+            export SUBMIT_DIR=${SUBMIT_DIR}
+            export REBUILD_DIR=${REBUILD_DIR}
+            export POST_DIR=${POST_DIR}
+            export MASTER=${MASTER}
+            export RebuildFromArchive=${config_Post_RebuildFromArchive}
+            export DateBegin=${DateBegin}
+            export PeriodDateBegin=${PeriodDateBegin}
+            export PeriodDateEnd=${PeriodDateEnd}
+            export NbRebuildDir=${NbRebuildDir}
+            export StandAlone=false
+            export RESOL_ATM=${RESOL_ATM}
+            export RESOL_OCE=${RESOL_OCE}
+            export RESOL_ICE=${RESOL_ICE}
+            export RESOL_MBG=${RESOL_MBG}
+            export RESOL_SRF=${RESOL_SRF}
+            export RESOL_BIOS=${RESOL_BIOS}
+            export config_UserChoices_JobName=${config_UserChoices_JobName}
+            export R_SAVE=${R_SAVE}
+            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 rebuild_fromWorkdir
+EOF
+        fi
+    fi
+
+    IGCM_debug_PopStack "IGCM_post_Submit"
+}
Index: /tags/libIGCM_v1_8/libIGCM_sys/IGCM_add_out.awk
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/IGCM_add_out.awk	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/IGCM_add_out.awk	(revision 333)
@@ -0,0 +1,377 @@
+# 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: Patrick.Brockmann@cea.fr
+#
+#**************************************************************
+
+#==========================
+function myprint(str) {
+  if (debug) {
+     print str
+  }
+}
+
+
+#==========================
+BEGIN {
+#  print "traitement de " ARGV[1]
+
+  nbarg=ARGC
+  if (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
+  Information_ksh_SX_found=0
+  vargas_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
+
+  RunDateBegin="2000-01-01T00:00:00"
+  RunDateEnd="2000-01-01T00:00:00"
+
+}
+
+#==========================
+{
+  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
+    }
+
+  }
+# 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")))
+
+  }
+# AIX vargas system time
+  else if (match($0, "real   [0-9]*"))
+  {
+    myprint( "vargas" )
+    vargas_found=1  
+    counter=counter+1
+
+    RealTime=substr($0,8)
+    next
+  }
+  else if (vargas_found=1 )
+  {
+    if (match($0, "user   [0-9]*"))
+      {
+	UserTime=substr($0,8)
+	next
+      }
+    if (match($0, "sys    [0-9]*"))
+      {
+	SysTime=substr($0,7)
+	next
+      }
+  }
+# Get information with time output on SX hosts
+# ksh time
+  else if (match($0, "real *[0-9:.]*"))
+  {
+    myprint("ksh SX")
+    Information_ksh_SX_found=1
+    counter=counter+1
+
+    RealTime=0
+    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
+    {
+	sub1=(match($2, ":")-1)
+	sub2=sub1+2
+	fin=(substr($2,sub2))
+	sub3=(match(fin, ":")-1)+sub2
+	RealTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
+    }
+    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
+    {
+	RealTime=(substr($2,1,match($2, ":")-1))
+    }
+  }
+  else if (Information_ksh_SX_found == 1 && match($0, "user *[0-9:.]*"))
+  {
+    myprint("ksh SX ")
+
+    UserTime=0
+    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
+    {
+	sub1=(match($2, ":")-1)
+	sub2=sub1+2
+	fin=(substr($2,sub2))
+	sub3=(match(fin, ":")-1)+sub2
+	UserTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
+    }
+    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
+    {
+	UserTime=(substr($2,1,match($2, ":")-1))
+    }
+  }
+  else if (Information_ksh_SX_found == 1 && match($0, "sys *[0-9:.]*"))
+  {
+    myprint("ksh SX ")
+
+    SysTime=0
+    if (match($2, "[0-9]*:[0-9]*:[0-9]*\\.[0-9]*"))
+    {
+	sub1=(match($2, ":")-1)
+	sub2=sub1+2
+	fin=(substr($2,sub2))
+	sub3=(match(fin, ":")-1)+sub2
+	SysTime=(substr($2,1,sub1))*60+(substr($2,sub2,sub3))
+    }
+    else if (match($2, "[0-9]*:[0-9]*\\.[0-9]*"))
+    {
+	SysTime=(substr($2,1,match($2, ":")-1))
+    }
+  }
+
+# RUN_DATE_BEGIN
+if ($0 ~ /RunDateBegin.*=/) {
+    myprint( "start date" )
+    split($0,a,"=")
+    RunDateBegin=a[2]
+}
+
+# RUN_DATE_END
+if ($0 ~ /RunDateEnd.*=/) {
+    myprint( "end date" )
+    split($0,a,"=")
+    RunDateEnd=a[2]
+  }
+
+}
+
+#==========================
+END {
+
+    myprint("exit_value : " exit_value)
+    myprint("counter    : " counter)
+
+  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 :")
+      myprint("Start Time             :" RunDateBegin)
+      myprint("End   Time             :" RunDateEnd)
+
+      printf("%s %s %.5f %.5f %.5f", RunDateBegin, RunDateEnd, RealTime, UserTime, SysTime) 
+      exit(0)
+    }
+    else
+    { 
+      exit(1)
+    }
+  }
+  else
+  { 
+    exit(2)
+  }
+  
+}
Index: /tags/libIGCM_v1_8/libIGCM_sys/IGCM_analyse_rsync_out.awk
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/IGCM_analyse_rsync_out.awk	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/IGCM_analyse_rsync_out.awk	(revision 333)
@@ -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 (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_8/libIGCM_sys/libIGCM_sys.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys.ksh	(revision 333)
@@ -0,0 +1,97 @@
+#!/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: JobType ( Protect output datas )
+#
+#**************************************************************
+
+# bypass specific internationalization (for awk)
+export LC_ALL="C"
+
+# By default, all libIGCM_sys save functions will protect output datas (RUN execution mode) 
+# other values : DEB(ug), DEV(elopment).
+JobType=${JobType:=RUN}
+
+echo
+echo "===================================================="
+echo "Where do we run ?" $( hostname )
+uname -a
+echo "===================================================="
+echo
+
+
+if [ X${JobType} = XDEB ] ; then
+    echo "DEBUG mode : activation of 'set -vx' mode."
+    set -vx
+    DEBUG_debug=true
+    DEBUG_sys=true
+    echo "===================================================="
+fi
+
+case $( hostname -s ) in
+
+    brodie*)
+	echo "sys source brodie Nec SX8 lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_brodie.ksh;;
+
+    vargas*)
+        echo "sys source vargas IBM P6 lib."
+        . ${libIGCM}/libIGCM_sys/libIGCM_sys_vargas.ksh;;
+
+    ulam)
+        echo "sys source ulam Intel X-64 lib."
+        . ${libIGCM}/libIGCM_sys/libIGCM_sys_ulam.ksh;;
+
+    mercure)
+	echo "sys source mercure frontend TX7 IA-64 lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_mercureTX.ksh;;
+
+    mercure0?)
+	echo "sys source mercure frontend X-64 lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_mercure.ksh;;
+
+    mercure1?)
+	echo "sys source mercure Nec SX8-R lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_mercurex8.ksh;;
+
+    mercure2?)
+	echo "sys source mercure Nec SX9 lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_mercurex9.ksh;;
+
+    platine*)
+	echo "sys source platine Intel IA-64 lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_platine.ksh;;
+
+    titane*)
+	echo "sys source platine Intel X-64 lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_titane.ksh;;
+
+    cesium*)
+	echo "sys source cesium Intel X-64 lib."
+	. ${libIGCM}/libIGCM_sys/libIGCM_sys_cesium.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;;
+
+    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_8/libIGCM_sys/libIGCM_sys_brodie.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_brodie.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_brodie.ksh	(revision 333)
@@ -0,0 +1,1120 @@
+#!/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 SX8
+#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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${LOGIN:=$( whoami )}
+# $hostname of the MASTER job
+typeset -r MASTER=brodie
+
+#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 rsync
+typeset -r RSYNC_opt="-va"
+# ie storage filesystem
+typeset -r RHOST=gaya
+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 SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=$( rsh gaya -n env | grep PWD | gawk "-F=" '{print $2}' )
+
+#====================================================
+#- Mirror libIGCM from brodie to ulam 
+typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+
+#====================================================
+#- libIGCM_POST
+PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM
+
+#====================================================
+#- 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 ulam -n echo $WORKDIR | gawk "-F=" "{print $2}" )/IGCM_OUT 
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}}
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${WORKDIR}/REBUILD}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    rsh gaya exec /bin/ksh <<-EOF
+    ${@}
+EOF
+    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: Post-process 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 ulam 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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_SendMail :" $@
+    fi
+
+    cat  << END_MAIL > job_end.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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ X${config_UserChoices_MailName} != X ] ; then
+        mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
+    elif [ -f ~/.forward ] ; then
+        mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    else
+        mailx -s "${config_UserChoices_JobName} completed" ${USER} < job_end.mail
+    fi
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l"
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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
+    cd ${POST_DIR}
+    /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job
+    cd -
+    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 ulam
+#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 ${HOME}/MIRROR/${PATHlibIGCM}
+EOF
+    rsh ulam -n hostname > /dev/null 2>&1
+    RET=$?
+    if [ $RET -eq 0 ] ; then
+	echo ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
+	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on ulam."
+	    cat out_rsync
+	fi
+    else
+	echo "No POST-TREATMENT avaible because ulam is down."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+}
+
+#====================================================
+#- Call IGCM_sys_Mirror_libIGCM now !
+if ( $MirrorlibIGCM ) ; then
+    IGCM_sys_Mirror_libIGCM
+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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+	#
+	#USUAL WAY
+	mfput $1 $2 > out_rsync 2>&1
+  	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+	#USUAL WAY
+	mfput $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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
+	#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} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${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} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+############################################################## 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=${MPISUSPEND:=OFF}
+
+#D-- MPIPROGINF #other choices : ALL_DETAIL2
+    export MPIPROGINF=ALL
+#D- activate ftrace (with -ftrace)
+    export F_FTRACE=YES
+#D- communication information (with -ftrace)
+    export MPICOMMINF=DETAIL
+
+# --------------------------------------------------------------------
+#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- I/O performance (FORTRAN I/O only not netCDF)
+    export F_FILEINF=${F_FILEINF:=NO}
+#D- netCDF I/O performance
+    export NC_FILEINF=${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_8/libIGCM_sys/libIGCM_sys_calculo.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_calculo.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_calculo.ksh	(revision 333)
@@ -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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${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"
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+. /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"
+
+#====================================================
+#- SCRATCHDIR (=> ${R_DONNEES})
+typeset -r SCRATCHDIR=/home/${LOGIN}/TEMP_LOCAL
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset 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}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#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}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh  <<-EOF
+    ${@}
+EOF
+    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-
+(( 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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	sleep 60
+
+	#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
+	( ${DEBUG_debug} ) && 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
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+	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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+
+	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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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 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_8/libIGCM_sys/libIGCM_sys_cesium.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 333)
@@ -0,0 +1,1401 @@
+#!/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 Cesium
+#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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${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="-va"
+# ie storage filesystem
+typeset -r RHOST=cesium
+
+#====================================================
+# Source default environment
+#====================================================
+. /etc/profile
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+. /home/cont003/p86ipsl/.atlas_env_cesium_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"
+
+#====================================================
+# For interactive jobs on cesium 
+PBS_O_WORKDIR=${PBS_O_WORKDIR:=$(pwd)}
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset 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)
+PBS_JOBID=${PBS_JOBID:=TEMPDIR$$}
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/${PBS_JOBID}}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Just a fake command to wrapp
+#D-           IGCM_card call in post-treatment
+#D-           Ulam do not see brodie filesystem
+#D-           Cesium do not see all mercure filesystem
+#D-           That's why we need this hack.
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    #set -vx
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+    ssh ${MASTER} exec /bin/ksh <<-EOF
+    export libIGCM=${libIGCM_SX}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+    ${@}
+EOF
+    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
+    /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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_SendMail :" $@
+    fi
+
+    IGCM_sys_RshPost <<-EOF
+    export LOGIN=${LOGIN}
+    export config_UserChoices_JobName=${config_UserChoices_JobName}
+    export config_UserChoices_MailName=${config_UserChoices_MailName}
+    export DateBegin=${DateBegin}
+    export DateEnd=${DateEnd}
+    export R_SAVE=${R_SAVE}
+    export SUBMIT_DIR=${SUBMIT_DIR}
+
+    cat  << END_MAIL > job_end.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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ ! -z ${config_UserChoices_MailName} ] ; then
+       mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
+    elif [ -f ~/.forward ] ; then
+       mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    fi
+
+    sleep 10
+    rm -f job_end.mail
+EOF
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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/ccc_msub -o ${Script_Output} -e ${Script_Output}.e < $1
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_Qsub : erreur  -o ${Script_Output} -e ${Script_Output}.e $@"
+	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/ccc_msub -o ${POST_DIR}/$1.${PeriodDateEnd}.${TsTask}.${CompToRead}.${FlagToRead}.out -e ${POST_DIR}/$1.${PeriodDateEnd}.${TsTask}.${CompToRead}.${FlagToRead}.e.out -E "-v ${listVarEnv}" ${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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RmRunDir :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_RmRunDir : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_RmRunDir"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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=$( IGCM_sys_RshMaster [ -d $1 ] && echo 1 || echo 0 )
+	if [ ${TEST} -ne 1 ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ON ${MASTER}."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+	sleep 60
+
+	#USUAL WAY
+	scp -r ${MASTER}:$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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+	#
+	IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	# USUAL WAY
+	\cp $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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
+
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+        # USUAL WAY
+	cp $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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 "WARNING 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 SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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}/${R_DODS}/${1} > /dev/null 2>&1
+	dods_cp ${1} public/${LOGIN}/${R_DODS} > /dev/null 2>&1
+	RET=0
+        
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dods : error."
+	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
+	fi
+    else
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## 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/CESIUM/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
+    ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=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
+#     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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+#       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+##############################################################
+# CDO OPERATOR
+
+function IGCM_sys_cdo {
+    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
+
+    \cdo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_cdo : erreur ${@}."
+#       IGCM_debug_Exit "cdo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_cdo"
+}
+
+############################################################
+# 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_8/libIGCM_sys/libIGCM_sys_claude.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_claude.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_claude.ksh	(revision 333)
@@ -0,0 +1,1266 @@
+#!/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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${LOGIN:=$( whoami )}
+# $hostname of the MASTER job
+typeset -r MASTER=claude
+
+#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"
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+#. /home/${LOGIN}/.atlas_env_${HOST}_ksh
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SCRATCHDIR (=> ${R_DONNEES})
+typeset -r SCRATCHDIR=${TMPDIR}
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$}
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset 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}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#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}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh  <<-EOF
+    ${@}
+EOF
+    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-
+(( 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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_SendMail :" $@
+    fi
+
+    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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ ! -z ${config_UserChoices_MailName} ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
+    elif [ -f ~/.forward ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    fi
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RmRunDir :" $@
+	echo "Dummy call, let the scheduler do that."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	sleep 60
+
+	#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
+	( ${DEBUG_debug} ) && 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
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+
+	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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+
+	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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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 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_8/libIGCM_sys/libIGCM_sys_default.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_default.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_default.ksh	(revision 333)
@@ -0,0 +1,1279 @@
+#!/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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${LOGIN:=$( whoami )}
+# $hostname of the MASTER job
+typeset -r MASTER=${HOST}
+
+#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="-va"
+#"-Lt -v"
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+#. /home/${LOGIN}/.atlas_env_${HOST}_ksh
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SCRATCHDIR (=> ${R_DONNEES})
+typeset -r SCRATCHDIR=/tmp
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=/home
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- 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$$}
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
+
+#====================================================
+#- 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}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#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}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh  <<-EOF
+    ${@}
+EOF
+    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: Post-process 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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_SendMail :" $@
+    fi
+
+    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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ ! -z ${config_UserChoices_MailName} ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
+    elif [ -f ~/.forward ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    fi
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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 "${libIGCM_POST}/$1.job > ${POST_DIR}/$1.${PeriodDateEnd}.out 2>&1 &"
+    ${libIGCM_POST}/$1.job > ${POST_DIR}/$1.${PeriodDateEnd}.out 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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RmRunDir :" $@
+	echo "Dummy call, let the scheduler do that."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	sleep 60
+
+	#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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#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
+
+	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
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+
+	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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+
+	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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## 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_8/libIGCM_sys/libIGCM_sys_mercure.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 333)
@@ -0,0 +1,1238 @@
+#!/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 X64
+#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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${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="-va"
+# ie storage filesystem
+typeset -r RHOST=mercure
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+. /home/cont003/p86ipsl/.atlas_env_mercure01_ksh
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- 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 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}}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Just a fake command to wrapp
+#D-           IGCM_card call in post-treatment
+#D-           Ulam do not see brodie filesystem
+#D-           Cesium do not see all mercure 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}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+    ${@}
+EOF
+    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
+    /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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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 -o ${POST_DIR}/$1.${PeriodDateEnd}.${TsTask}.${CompToRead}.${FlagToRead}.out ${libIGCM}/$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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+        echo "IGCM_sys_RmRunDir :" $@
+        echo "Dummy call, let the scheduler do that." 
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	sleep 60
+
+	#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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+        # USUAL WAY
+	\cp $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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 "WARNING 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} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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+$? ))
+
+    else
+	( ${DEBUG_debug} ) && 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}/${R_DODS}/${1} > /dev/null 2>&1
+	dods_cp ${1} public/${LOGIN}/${R_DODS} > /dev/null 2>&1
+	RET=0
+        
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dods : error."
+	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
+	fi
+    else
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## 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/X86_64/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
+    ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=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
+#     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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+#       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+##############################################################
+# CDO OPERATOR
+
+function IGCM_sys_cdo {
+    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
+
+    \cdo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_cdo : erreur ${@}."
+#       IGCM_debug_Exit "cdo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_cdo"
+}
+
+############################################################
+# 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_8/libIGCM_sys/libIGCM_sys_mercureTX.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_mercureTX.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_mercureTX.ksh	(revision 333)
@@ -0,0 +1,1228 @@
+#!/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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${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="-va"
+# ie storage filesystem
+typeset -r RHOST=mercure
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+. /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
+#====================================================
+
+#====================================================
+#- 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 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}}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Just a fake command to wrapp
+#D-           IGCM_card call in post-treatment
+#D-           Ulam do not see brodie filesystem
+#D-           Cesium do not see all mercure 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}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+    ${@}
+EOF
+    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
+    /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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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}.${TsTask}.${CompToRead}.${FlagToRead}.out ${libIGCM}/$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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RmRunDir :" $@
+	echo "Dummy call, let the scheduler do that."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	sleep 60
+
+	#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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+        # USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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 "WARNING 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} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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+$? ))
+
+    else
+	( ${DEBUG_debug} ) && 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}/${R_DODS}/${1} > /dev/null 2>&1
+	dods_cp ${1} public/${LOGIN}/${R_DODS} > /dev/null 2>&1
+	RET=0
+        
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dods : error."
+	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
+	fi
+    else
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## 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/TX7/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
+    ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+#       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=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
+#     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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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_8/libIGCM_sys/libIGCM_sys_mercurex8.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_mercurex8.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_mercurex8.ksh	(revision 333)
@@ -0,0 +1,1210 @@
+#!/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 SX8-R
+#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
+#====================================================
+
+# gawk specific location on SX9
+export PATH=/applications/gawk-3.0.4/bin:${PATH}
+
+#====================================================
+# 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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${LOGIN:=$( whoami )}
+# $hostname of the MASTER job
+typeset -r MASTER=mercure
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/home/cont003/p86denv/SX_RSYNC/bin/rsync
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-va"
+# ie storage filesystem
+typeset -r RHOST=mercure
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=${DMFDIR}
+
+# ============ CESIUM START ============ #
+
+#====================================================
+#- Mirror libIGCM from mercure to cesium if needed
+#ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $2}' )
+#if [ ! ${ROOTSYS} = "home" ] ; then
+#    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+#else
+#    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
+#fi
+
+#====================================================
+#- libIGCM_POST
+#if ( ${MirrorlibIGCM} ) ; then
+#    PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+#    typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM
+#else
+#    typeset -r libIGCM_POST=${libIGCM}
+#fi
+
+# ============ CESIUM  END  ============ #
+
+#====================================================
+#- Mirror libIGCM from mercure to cesium if needed
+typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- 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}}
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+${@}
+EOF
+    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: Post-process rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+
+# ============ CESIUM START ============ #
+#    typeset NB_ESSAI DELAI status
+#    #nombre d'essai avant abandon
+#    NB_ESSAI=5
+#    #temps entre chaque essai
+#    DELAI=10
+#    i=0
+#    while [ $i -ne $NB_ESSAI ] ; do
+#        ssh -t mercure ssh cesium /bin/ksh ${@} 2>/dev/null
+#        status=$?
+#        if [ ${status} -ne 0 ];
+#        then
+#            sleep $DELAI
+#        else
+#            break
+#        fi
+#        let i=$i+1
+#    done 
+# ============ CESIUM  END  ============ #
+
+
+    /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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_SendMail :" $@
+    fi
+
+    ssh mercure /bin/ksh <<-EOF
+    export LOGIN=${LOGIN}
+    export config_UserChoices_JobName=${config_UserChoices_JobName}
+    export config_UserChoices_MailName=${config_UserChoices_MailName}
+    export DateBegin=${DateBegin}
+    export DateEnd=${DateEnd}
+    export R_SAVE=${R_SAVE}
+    export SUBMIT_DIR=${SUBMIT_DIR}
+
+    cat  << END_MAIL > job_end.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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ ! -z ${config_UserChoices_MailName} ] ; then
+       mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
+    elif [ -f ~/.forward ] ; then
+       mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    fi
+
+    sleep 10
+    rm -f job_end.mail
+EOF
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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" $@
+    typeset ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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
+    # ============ CESIUM START ============ #
+    #/usr/local/bin/ccc_msub -o ${POST_DIR}/$1.${PeriodDateEnd}.out -e ${POST_DIR}/$1.${PeriodDateEnd}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
+    # ============ CESIUM  END  ============ #
+    /usr/bin/nqsII/qsub -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM}/$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 cesium
+#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
+
+    mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
+
+    echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
+    ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
+	cat out_rsync
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+}
+
+#====================================================
+#- Call IGCM_sys_Mirror_libIGCM now !
+if ( $MirrorlibIGCM ) ; then
+    IGCM_sys_Mirror_libIGCM
+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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+	#
+	IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	# USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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
+
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+        # USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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 SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+############################################################## 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/SX8/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=${MPISUSPEND:=OFF}
+
+#D-- MPIPROGINF #other choices : ALL_DETAIL2
+    export MPIPROGINF=ALL
+#D- activate ftrace (with -ftrace)
+    export F_FTRACE=YES
+#D- communication information (with -ftrace)
+    export MPICOMMINF=DETAIL
+
+# --------------------------------------------------------------------
+#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- I/O performance (FORTRAN I/O only not netCDF)
+    export F_FILEINF=${F_FILEINF:=NO}
+#D- netCDF I/O performance
+    export NC_FILEINF=${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_8/libIGCM_sys/libIGCM_sys_mercurex9.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 333)
@@ -0,0 +1,1204 @@
+#!/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 SX9
+#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
+#====================================================
+
+# gawk specific location on SX9
+export PATH=/applications/gawk-3.0.4/bin:${PATH}
+
+#====================================================
+# 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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${LOGIN:=$( whoami )}
+# $hostname of the MASTER job
+typeset -r MASTER=mercure
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/home/cont003/p86denv/SX_RSYNC/bin/rsync
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-va"
+# ie storage filesystem
+typeset -r RHOST=mercure
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=${DMFDIR}
+
+# ============ CESIUM START ============ #
+
+#====================================================
+#- Mirror libIGCM from mercure to cesium if needed
+ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $2}' )
+if [ ! ${ROOTSYS} = "home" ] ; then
+    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+else
+    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
+fi
+
+#====================================================
+#- libIGCM_POST
+if ( ${MirrorlibIGCM} ) ; then
+    PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+    typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM
+else
+    typeset -r libIGCM_POST=${libIGCM}
+fi
+
+# ============ CESIUM  END  ============ #
+
+#====================================================
+#- MirrorlibIGCM uncomment for frontend
+#typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
+
+#====================================================
+#- libIGCM_POST uncomment for frontend
+#typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- 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}}
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="mpirun"}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+${@}
+EOF
+    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: Post-process rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+
+# ============ CESIUM START ============ #
+    typeset NB_ESSAI DELAI status
+    # keep standard input for the loop onto temporary file
+    cat >tmp_IGCM_sys_RshPost_$$
+    # number of tentative
+    NB_ESSAI=10
+    # time delay between tentative
+    DELAI=10
+    i=0
+    while [ $i -ne $NB_ESSAI ] ; do
+        ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
+        status=$?
+        if [ ${status} -ne 0 ];
+        then
+            sleep $DELAI
+        else
+            break
+        fi
+        let i=$i+1
+    done 
+    # delete temporary file
+    /bin/rm tmp_IGCM_sys_RshPost_$$
+# ============ CESIUM  END  ============ #
+
+# Uncomment for frontend 
+#    /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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_SendMail :" $@
+    fi
+
+    cat  << END_MAIL > job_end.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}
+  Script file and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if  [ X"${config_UserChoices_MailName}" != X ] ; then
+       mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
+    elif [ -f ~/.forward ] ; then
+       mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    else
+       mailx -s "${config_UserChoices_JobName} completed" ${LOGIN} < job_end.mail
+    fi
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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" $@
+    typeset ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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
+    # ============ CESIUM START ============ #
+    /usr/local/bin/ccc_msub -o ${POST_DIR}/$1.${PeriodDateEnd}.out -e ${POST_DIR}/$1.${PeriodDateEnd}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
+    # ============ CESIUM  END  ============ #
+    #/usr/bin/nqsII/qsub -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM}/$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 cesium
+#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
+
+    mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
+
+    echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
+    ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
+	cat out_rsync
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+}
+
+#====================================================
+#- Call IGCM_sys_Mirror_libIGCM now !
+if ( $MirrorlibIGCM ) ; then
+    IGCM_sys_Mirror_libIGCM
+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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+	#
+	IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	# USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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
+
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+        # USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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 SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+############################################################## 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/SX8/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=${MPISUSPEND:=OFF}
+
+#D-- MPIPROGINF #other choices : ALL_DETAIL2
+    export MPIPROGINF=ALL
+#D- activate ftrace (with -ftrace)
+    export F_FTRACE=YES
+#D- communication information (with -ftrace)
+    export MPICOMMINF=DETAIL
+
+# --------------------------------------------------------------------
+#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- I/O performance (FORTRAN I/O only not netCDF)
+    export F_FILEINF=${F_FILEINF:=NO}
+#D- netCDF I/O performance
+    export NC_FILEINF=${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_8/libIGCM_sys/libIGCM_sys_obelix.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_obelix.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_obelix.ksh	(revision 333)
@@ -0,0 +1,1315 @@
+#!/bin/ksh 
+
+#**************************************************************
+# Author: Sebastien Denvil, Martial Mancip, Christian Laguerre
+# 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 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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${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="-va"
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+. /home/users/brock/.atlas_env_asterix_ksh
+
+#=========================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SCRATCHDIR (=> ${R_DONNEES})
+if [ X${PBS_O_WORKDIR} != X ] ; then
+    typeset -r SCRATCHDIR=/scratch/$PBS_O_LOGNAME.$PBS_JOBID
+#==${WORKDIR} 
+# cf /usr/Local/Env sur obelix
+else
+    typeset -r SCRATCHDIR=/tmp
+fi
+#FOR DEBUG RUN :
+#typeset -r SCRATCHDIR=/home/scratch01/${LOGIN}
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+if [ X${PBS_O_WORKDIR} != X ] ; then
+    typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
+else
+    typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
+fi
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=/home/scratch01/${LOGIN}
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- IN
+typeset -r R_IN=${R_IN:=/home/orchidee01/mmancip/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$$}
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
+
+#====================================================
+#- 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}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Just a fake command to wrapp
+#D-           IGCM_card call in post-treatment
+#D-           Ulam do not see brodie filesystem
+#D-           Cesium do not see all mercure filesystem
+#D-           That's why we need this hack.
+#D-* Examples:
+#D-
+function IGCM_sys_RshMaster {
+    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
+
+    ssh ${HOST} exec /bin/ksh  <<-EOF
+    export libIGCM=${libIGCM}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+    ${@}
+EOF
+    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: Post-process 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 obelix3 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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_SendMail :" $@
+    fi
+
+    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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ ! -z ${config_UserChoices_MailName} ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
+    elif [ -f ~/.forward ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    fi
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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 -q short -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
+    /usr/local/bin/qsub -q medium -o ${Script_Output} -N ${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
+    /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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RmRunDir :" $@
+    fi
+
+    typeset RET
+
+    echo rm $@ > out_rsync 2>&1
+    \rm $@ >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_RmRunDir : error."
+	cat out_rsync
+	IGCM_debug_Exit "IGCM_sys_RmRunDir"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	sleep 60
+
+	#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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#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
+
+	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
+
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+
+	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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+
+	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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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 [ ! -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
+	#DO NOTHING
+    else
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## 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"
+}
+
+##############################################################
+# CDO OPERATOR
+
+function IGCM_sys_cdo {
+    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
+
+    \cdo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_cdo : erreur ${@}."
+#       IGCM_debug_Exit "cdo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_cdo"
+}
+
+############################################################
+# 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_8/libIGCM_sys/libIGCM_sys_platine.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_platine.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_platine.ksh	(revision 333)
@@ -0,0 +1,1372 @@
+#!/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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${LOGIN:=$( whoami )}
+# $hostname of the MASTER job
+typeset MASTER=platine
+
+#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="-va"
+# ie storage filesystem
+typeset -r RHOST=platine
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+. /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"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=${DMFDIR}
+
+#====================================================
+#- libIGCM_POST
+typeset -r libIGCM_POST=${libIGCM}
+
+#====================================================
+#- 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}/TMPDIR_IGCM/tmp$$
+    if [ ! -d ${RUN_DIR_PATH} ]; then 
+	\mkdir -p ${RUN_DIR_PATH}
+	if [ $? -gt 0 ] ; then
+	    echo "Error in creation of "${RUN_DIR_PATH}
+	fi
+    fi
+fi
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time srun"}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Just a fake command to wrapp
+#D-           IGCM_card call in post-treatment
+#D-           Ulam do not see brodie filesystem
+#D-           Cesium do not see all mercure 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}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+    ${@}
+EOF
+    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: Post-process 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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+       echo "IGCM_sys_SendMail :" $@
+    fi
+    cat  << END_MAIL > job_end.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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ ! -z ${config_UserChoices_MailName} ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} < job_end.mail
+    elif [ -f ~/.forward ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    fi
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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" $@
+    typeset ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RmRunDir :" $@
+	echo "Dummy call, let the scheduler do that."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	sleep 60
+
+	#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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+	#
+	IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	# USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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
+        #
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+        # USUAL WAY
+	putfer $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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}/${R_DODS}/${1} > /dev/null 2>&1
+	dods_cp ${1} public/${LOGIN}/${R_DODS} > /dev/null 2>&1
+	RET=0
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dods : error."
+	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
+	fi
+    else
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## 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/IA64/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
+    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
+    NUM_PROC_OCE=1
+    (( NUM_PROC_ATM = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE - 1))
+    (( nb_tot_m1    = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE ))
+    if [ $1 = MPI1 ]; then
+	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
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+  
+}
Index: /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_titane.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 333)
@@ -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 Titane
+#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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${LOGIN:=$( whoami )}
+# $hostname of the MASTER job
+typeset MASTER=titane
+
+#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="-va"
+# ie storage filesystem
+typeset -r RHOST=titane
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+#. /home/cont003/p86ipsl/.atlas_env_titane_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"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=${DMFDIR}
+
+#====================================================
+#- Mirror libIGCM from titane to cesium if needed
+ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $2}' )
+if [ ! ${ROOTSYS} = "home" ] ; then
+    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+else
+    typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
+fi
+
+#====================================================
+#- libIGCM_POST
+if ( ${MirrorlibIGCM} ) ; then
+    PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+    typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM
+else
+    typeset -r libIGCM_POST=${libIGCM}
+fi
+
+#====================================================
+#- 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}}
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshMaster
+#D-* Purpose: Just a fake command to wrapp
+#D-           IGCM_card call in post-treatment
+#D-           Ulam do not see brodie filesystem
+#D-           Cesium do not see all mercure 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}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+    ${@}
+EOF
+    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: Post-process rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshPost {
+    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RshPost :" $@
+    fi
+
+    typeset NB_ESSAI DELAI status
+    # keep standard input for the loop onto temporary file
+    cat >tmp_IGCM_sys_RshPost_$$
+    # number of tentative
+    NB_ESSAI=10
+    # time delay between tentative
+    DELAI=10
+    i=0
+    while [ $i -ne $NB_ESSAI ] ; do
+        ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
+        status=$?
+        if [ ${status} -ne 0 ];
+        then
+            sleep $DELAI
+        else
+            break
+        fi
+        let i=$i+1
+    done
+    # delete temporary file
+    /bin/rm tmp_IGCM_sys_RshPost_$$
+
+    if [ ${status} -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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+       echo "IGCM_sys_SendMail :" $@
+    fi
+
+    IGCM_sys_RshPost <<-EOF
+    export LOGIN=${LOGIN}
+    export config_UserChoices_JobName=${config_UserChoices_JobName}
+    export config_UserChoices_MailName=${config_UserChoices_MailName}
+    export DateBegin=${DateBegin}
+    export DateEnd=${DateEnd}
+    export R_SAVE=${R_SAVE}
+    export SUBMIT_DIR=${SUBMIT_DIR}
+
+    cat  << END_MAIL > job_end.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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ ! -z ${config_UserChoices_MailName} ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} < job_end.mail
+    elif [ -f ~/.forward ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    fi
+
+    sleep 10
+    rm -f job_end.mail
+EOF
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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" $@
+    typeset ExistFlag
+    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    ls ${@} 2>/dev/null | wc -l
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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/local/bin/ccc_msub -o ${Script_Output} -r ${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
+    /usr/local/bin/ccc_msub -o ${POST_DIR}/$1.${PeriodDateEnd}.out -e ${POST_DIR}/$1.${PeriodDateEnd}.e.out -E "-v ${listVarEnv}" ${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_Miror_libIGCM
+#D-* Purpose: Mirror libIGCM PATH and lib to cesium
+#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
+
+    mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
+
+    echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
+    ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
+    RET=$?
+
+    if [ ${RET} -gt 0 ] ; then
+	echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium."
+	cat out_rsync
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+}
+
+#====================================================
+#- Call IGCM_sys_Mirror_libIGCM now !
+if ( $MirrorlibIGCM ) ; then
+    IGCM_sys_Mirror_libIGCM
+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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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
+	sleep 60
+
+	#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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+}
+
+#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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+	#
+	IGCM_sys_TestDirArchive $( dirname $2 )
+	#
+	# USUAL WAY
+	\cp $1 $2 > out_rsync 2>&1
+        RET=$?
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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
+
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+        # USUAL WAY
+	\cp $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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"
+#  	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 SSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+############################################################## 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/X64/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
+    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
+    NUM_PROC_OCE=1
+    (( NUM_PROC_ATM = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE - 1))
+    (( nb_tot_m1    = $BATCH_NUM_PROC_TOT - NUM_PROC_OCE ))
+    if [ $1 = MPI1 ]; then
+	cat <<EOF > run_file
+-np 1 ./oasis
+-np ${NUM_PROC_ATM} ./lmdz.x
+-np ${NUM_PROC_OCE} ./opa.xx
+EOF
+	config_UserChoices_JobRunOptions='"--app"'
+	IGCM_sys_Chmod u+x run_file
+    fi
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+  
+}
Index: /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_ulam.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_ulam.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_ulam.ksh	(revision 333)
@@ -0,0 +1,1234 @@
+#!/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 Ulam
+#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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${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
+
+#====================================================
+# Set environment tools (ferret, nco, cdo)
+#====================================================
+. /home/rech/psl/rpsl035/.atlas_env_ulam_bash
+
+#====================================================
+# Host specific DIRECTORIES
+#====================================================
+
+#====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset SUBMIT_DIR=${SUBMIT_DIR:=${LOADL_STEP_INITDIR}}
+
+#====================================================
+#- 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}}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=12
+
+#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 ${MASTER} exec /bin/ksh <<-EOF
+    export libIGCM=${libIGCM_SX}
+    export DEBUG_debug=${DEBUG_debug}
+    . ${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_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    /bin/ksh <<-EOF
+    ${@}
+EOF
+    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
+    /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
+    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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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 ExistFlag
+    ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l"
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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
+    cd ${POST_DIR}
+    /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM}/$1.job
+    cd -
+    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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RmRunDir :" $@
+	echo "Dummy call, let the scheduler do that."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+
+	# due to rcommand latency
+	sleep 30
+
+    else
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && 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=$( IGCM_sys_RshMaster [ -d $1 ] && echo 1 || echo 0 )
+	if [ ${TEST} -ne 1 ] ; then
+	    echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ON ${MASTER}."
+	    IGCM_debug_PopStack "IGCM_sys_Get_Master"
+	    return
+	fi
+
+	typeset RET
+	sleep 60
+
+	#USUAL WAY
+	rcp -r ${MASTER}:$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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+	#
+	# USUAL WAY
+	mfput $1 $2 > out_rsync 2>&1
+	RET=$?
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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_Print 1 "mfput failed. Make a second try :"
+	    #
+	    mfput $1 $2 > out_rsync 2>&1
+	    RET=$?
+	    #
+	    if [ ${RET} -gt 0 ] ; then
+		echo "IGCM_sys_Put_Out : error."
+		IGCM_debug_Print 1 "mfput failed twice. You have a problem"
+		cat out_rsync
+		IGCM_debug_Exit "IGCM_sys_Put_Out"
+	    fi
+	fi
+    else
+	( ${DEBUG_debug} ) && 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
+	for BugFileIdris in ${dm_liste[*]} ; do 
+	    echo ${BugFileIdris}
+	    mfget ${BugFileIdris} ${DEST} >>out_rsync 2>&1
+	    RET=$?
+	    if [ ${RET} -gt 0 ] ; then
+		echo "IGCM_sys_Get : copy error."
+		cat out_rsync
+		#IGCM_debug_Exit "IGCM_sys_Get"
+	    fi
+	done
+
+# 	#RSYNC WITH NETWORK RSH CALL
+# 	echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${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} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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+$? ))
+
+    else
+	( ${DEBUG_debug} ) && 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
+	# We take our time on that
+	sleep 15
+	IGCM_sys_TestDirArchive ${R_SAVE}/${1} 
+	if [ $? != 0 ] ; 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}/${R_DODS}/${1} > /dev/null 2>&1
+        /bin/chmod -R u+w ${R_SAVE}/${1}
+        /usr/local/bin/dods_cp ${1} DODS/pub/${LOGIN}/${R_DODS} > /dev/null 2>&1
+        /bin/chmod -R +rX ${R_SAVE}/${1}
+	/bin/chmod -R u+w ${R_SAVE}/${1}
+EOF
+        RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Put_Dods : error."
+	    IGCM_debug_Exit "IGCM_sys_Put_Dods"
+	fi
+    else
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+}
+
+############################################################## 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/ces/rces452/REBUILD/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
+    ncap $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncap : erreur ${@}."
+       IGCM_debug_Exit "ncap"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncap"
+}
+
+ncatted=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
+#     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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    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
+    ncwa $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_ncwa : erreur ${@}."
+       IGCM_debug_Exit "ncwa"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_ncwa"
+}
+
+##############################################################
+# CDO OPERATOR
+
+function IGCM_sys_cdo {
+    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
+
+    \cdo $@
+    if [ $? -gt 0 ] ; then
+       echo "IGCM_sys_cdo : erreur ${@}."
+#       IGCM_debug_Exit "cdo"
+    fi
+
+    IGCM_debug_PopStack "IGCM_sys_cdo"
+}
+
+############################################################
+# 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_8/libIGCM_sys/libIGCM_sys_vargas.ksh
===================================================================
--- /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 333)
+++ /tags/libIGCM_v1_8/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 333)
@@ -0,0 +1,1122 @@
+#!/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 Vargas
+#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  HOST=${HOST:=$( hostname )}
+# $username ou whoami
+typeset  LOGIN=${LOGIN:=$( whoami )}
+# $hostname of the MASTER job
+typeset -r MASTER=vargas
+
+#D-
+#D-#==================================================
+#D-Program used in libIGCM
+#D-#==================================================
+
+# rsync with path
+typeset -r RSYNC=/usr/local/bin/rsync
+# RSYNC_opt args to rsync
+typeset -r RSYNC_opt="-va"
+# 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 SUBMIT_DIR=${SUBMIT_DIR:=${LOADL_STEP_INITDIR}}
+
+#====================================================
+#- ARCHIVE
+typeset -r ARCHIVE=$( echo ${HOME} | sed -e "s/homegpfs/u/" )
+
+#====================================================
+#- Mirror libIGCM from vargas to ulam 
+typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
+
+#====================================================
+#- libIGCM_POST
+PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
+typeset -r HOME_POST=$( echo ${HOME} | sed -e "s/homegpfs/home/" )
+typeset -r libIGCM_POST=${HOME_POST}/MIRROR/${PATHlibIGCM}/libIGCM
+
+#====================================================
+#- 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=$( echo ${HOME} | sed -e "s/homegpfs/workdir/" )/IGCM_OUT
+
+#====================================================
+#- RUN_DIR_PATH : Temporary working directory (=> TMP)
+typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}}
+
+#====================================================
+#- BIG_DIR : BIG_DIR to store files waiting for rebuild
+typeset -r BIG_DIR=${BIG_DIR:=${WORKDIR}}
+
+#====================================================
+#- HOST_MPIRUN_COMMAND
+typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time poe"}
+
+#====================================================
+#- Max number of arguments passed to nco operator or demigration command
+UNIX_MAX_LIMIT=360
+
+#D-#==================================================
+#D-function IGCM_sys_RshArchive
+#D-* Purpose: Archive rsh command
+#D-* Examples:
+#D-
+function IGCM_sys_RshArchive {
+    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
+    rsh gaya exec /bin/ksh <<-EOF
+    ${@}
+EOF
+    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: Post-process 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 ulam 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_SendMail
+#D-* Purpose: Send mail when simulation is over
+#D-* Examples:
+#D-
+function IGCM_sys_SendMail {
+    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_SendMail :" $@
+    fi
+    cat  << END_MAIL > job_end.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}
+  Script files and Script Outputs are available in ${SUBMIT_DIR}
+END_MAIL
+
+    if [ ! -z ${config_UserChoices_MailName} ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
+    elif [ -f ~/.forward ] ; then
+	mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
+    else
+	mailx -s "${config_UserChoices_JobName} completed" ${USER} < job_end.mail
+    fi
+
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_SendMail : erreur."
+	IGCM_debug_Exit "IGCM_sys_SendMail"
+    fi
+    IGCM_debug_PopStack "IGCM_sys_SendMail"
+}
+
+#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
+    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
+}
+
+#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
+	( ${DEBUG_debug} ) && 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
+    typeset ExistFlag
+    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
+    IGCM_debug_PopStack "IGCM_sys_TestDir"
+
+    return ${ExistFlag}
+}
+
+#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
+    typeset ExistFlag
+    ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" )
+    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
+
+    return ${ExistFlag}
+}
+
+#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" $@
+    typeset ExistFlag
+    ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" )
+    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
+
+    return ${ExistFlag}
+}
+
+#D-#==================================================
+#D-function IGCM_sys_CountFileArchive
+#D-* Purpose: Count files on Archive filesystem
+#D-* Examples:
+#D-
+function IGCM_sys_CountFileArchive {
+    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
+    IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l"
+    if [ $? -gt 0 ] ; then
+	echo "IGCM_sys_CountFileArchive : erreur."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
+}
+
+#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_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
+    {
+      [ ${#@} = 1 ] &&  { cd $LOADL_STEP_INITDIR ; /usr/local/bin/llsubmit $1 ; ERROR=$? ; cd - ; }
+      [ ${#@} = 2 ] &&  { cd $2 ; /usr/local/bin/llsubmit $1 ; ERROR=$? ; cd - ; }
+    }
+    if [ ${ERROR} -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
+    cd ${POST_DIR}
+    /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job
+    cd -
+    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 ulam
+#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
+
+    IGCM_sys_RshPost <<-EOF
+    mkdir -p ${HOME_POST}/MIRROR/${PATHlibIGCM}
+EOF
+    rsh ulam -n hostname > /dev/null 2>&1
+    RET=$?
+    if [ $RET -eq 0 ] ; then
+	echo ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
+	${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
+	RET=$?
+
+	if [ ${RET} -gt 0 ] ; then
+	    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on ulam."
+	    cat out_rsync
+	fi
+    else
+	echo "No POST-TREATMENT avaible because ulam is down."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
+}
+
+#====================================================
+#- Call IGCM_sys_Mirror_libIGCM now !
+if ( $MirrorlibIGCM ) ; then
+    IGCM_sys_Mirror_libIGCM
+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_RmRunDir
+#D-* Purpose: rm tmpdir (dummy function most of the time batch
+#D-                      scheduler will do the job)
+#D-* Examples:
+#D-
+function IGCM_sys_RmRunDir {
+    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_RmRunDir :" $@
+	echo "Dummy call, let the scheduler do that."
+    fi
+    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
+}
+
+#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
+
+    if [ $DRYRUN = 0 ]; then
+
+        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
+    else
+        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    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
+	( ${DEBUG_debug} ) && 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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
+}
+
+#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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    IGCM_sys_Chmod 444 ${1}
+	fi
+	#
+	# 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} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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
+	#
+	if [ X${JobType} = XRUN ] ; then
+	    if [ X${3} = X ] ; then
+		IGCM_sys_Chmod 444 ${1}
+	    fi
+	fi
+	#
+	# 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} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1
+# 	${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1
+
+#  	#RSYNC WITH NFS USE
+#  	echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && 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} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
+# 	${RSYNC} ${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} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
+#  	${RSYNC} ${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
+	( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
+    fi
+    IGCM_debug_PopStack "IGCM_sys_Get"
+}
+
+############################################################## 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/rpsl035/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- Other specifications
+# --------------------------------------------------------------------
+
+    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- Other specifications
+# --------------------------------------------------------------------
+
+    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
+  
+}
+
+############################################################
+# Build run file
+
+function IGCM_sys_build_run_file {
+    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
+set -x
+    if ( $DEBUG_sys ) ; then
+	echo "IGCM_sys_build_run_file " $@
+    fi
+    (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - 2 ))
+    NUM_PROC_OASIS=1
+    NUM_PROC_OCE=1
+    
+    if [ $1 = MPI2 ]; then
+       echo "IGCM_sys_build_run_file : error - MPI2 not available on vargas. "
+       IGCM_debug_Exit "IGCM_sys_build_run_file"
+    elif [ $1 = MPI1 ]; then
+	cat <<EOF > run_file
+./oasis
+EOF
+
+	(( i = 0 ))
+	while [ ${i} -lt ${NUM_PROC_ATM} ] ; do
+	    (( i = i + 1 ))
+	    cat <<EOF >> run_file
+./lmdz.x
+EOF
+	done
+
+	cat <<EOF >> run_file
+./opa.xx
+EOF
+	wc -l run_file
+    fi
+set +x
+    IGCM_debug_PopStack "IGCM_sys_build_run_file"
+}
Index: /tags/libIGCM_v1_8/run.card.init
===================================================================
--- /tags/libIGCM_v1_8/run.card.init	(revision 333)
+++ /tags/libIGCM_v1_8/run.card.init	(revision 333)
@@ -0,0 +1,35 @@
+# $Date: $
+# $Name: $
+# $Revision: $
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+
+#========================================================================
+[Configuration]
+#last PREFIX
+OldPrefix=
+#Compute date of loop
+PeriodDateBegin=
+PeriodDateEnd=
+CumulPeriod=
+# State of Job "Start", "Running", "OnQueue", "Completed"
+PeriodState="Start"
+
+#========================================================================
+[PostProcessing]
+
+#RebuildRunning=y/n
+#RebuildToComplete=number of dir to rebuild
+#RebuildDateID=PeriodDateEnd correspondant au dernier flag de RebuildFrequency=true
+
+TimeSeriesRunning=n
+TimeSeriesCompleted=
+
+#========================================================================
+[Log]
+# Executables Size
+LastExeSize=()
+
+#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+# CumulPeriod | PeriodDateBegin |   PeriodDateEnd |        RunDateBegin |          RunDateEnd |     RealCpuTime |     UserCpuTime |      SysCpuTime | ExeDate
+#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
