Index: /branches/libIGCM_MPI_OpenMP/AA_SaveSourceModifications
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_SaveSourceModifications	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_SaveSourceModifications	(revision 592)
@@ -145,5 +145,5 @@
 fi
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 if ( ! ${DEBUG_debug} ) ; then
     IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /branches/libIGCM_MPI_OpenMP/AA_TimeSeries_Checker
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_TimeSeries_Checker	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_TimeSeries_Checker	(revision 592)
@@ -41,7 +41,10 @@
 POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
 
+# project 
+export BRIDGE_MSUB_PROJECT=gen2211
+
 if [ ! -d ${CARD_DIR} ]; then
-    echo "No ${CARD_DIR}, we stop here"
-    exit
+  echo "No ${CARD_DIR}, we stop here"
+  exit
 fi
 
@@ -65,55 +68,71 @@
 read ActionAnswer
 
-case ${ActionAnswer} in    
-    oui|OUI|o|y|yes|YES)
-	echo "OK. I will submit jobs but ask permissions before removing files"
-	action=true
-	;;
-    non|NON|n|no|NO)
-	echo "OK. I won't submit jobs and only print out files I could remove"
-	action=false
-	;;
-    *)
-	echo "I did not recognize your answer. I will stop here."
-	echo "Please respond: oui|OUI|o|y|yes|YES"
-	echo "Or please respond: non|NON|n|no|NO"
-	exit
-	;;
+case ${ActionAnswer} in
+oui|OUI|o|y|yes|YES)
+  echo "OK. I will submit jobs but ask permissions before removing files"
+  action=true
+  ;;
+non|NON|n|no|NO)
+  echo "OK. I won't submit jobs and only print out files I could remove"
+  action=false
+  ;;
+*)
+  echo "I did not recognize your answer. I will stop here."
+  echo "Please respond: oui|OUI|o|y|yes|YES"
+  echo "Or please respond: non|NON|n|no|NO"
+  exit
+  ;;
 esac
 
+#==================================
 # First of all
+#
+typeset option
+
+#==================================
+# Read UserChoices section: 
 IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
-typeset option
+echo
+IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
 for option in ${config_UserChoices[*]} ; do
     IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
+    eval auxprint=\${config_UserChoices_${option}}
+    IGCM_debug_Print 3 "${option} : ${auxprint}"
 done
-
-echo
-IGCM_debug_Print 1 "DefineVariableFromOption  : 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
+
+#==================================
+# Read Post section: 
+IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Post
+echo
+IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
+
+for option in ${config_Post[*]} ; do
+  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post ${option}
+  eval auxprint=\${config_Post_${option}}
+  IGCM_debug_Print 3 "${option} : ${auxprint}"
+done
+#
+echo
 
 if [ -f ${CARD_DIR}/run.card ] ; then
-    IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration OldPrefix
-    IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration PeriodState
-    IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card PostProcessing TimeSeriesCompleted
-    IGCM_debug_Print 1 "DefineVariableFromOption  : run_Configuration"
-    IGCM_debug_PrintVariables 3 run_Configuration_OldPrefix
-    IGCM_debug_PrintVariables 3 run_Configuration_PeriodState
-    IGCM_debug_Print 1 "DefineVariableFromOption  : run_PostProcessing"
-    IGCM_debug_PrintVariables 3 run_PostProcessing_TimeSeriesCompleted
-    if [ X${run_Configuration_PeriodState} != X"Completed" ] ; then
-	DateEnd=$( IGCM_date_ConvertFormatToGregorian $( echo ${run_Configuration_OldPrefix} | awk -F'_' '{print $2}' ) )
-    else
-	DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
-    fi
-    CompletedFlag=${run_PostProcessing_TimeSeriesCompleted}
+  IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration OldPrefix
+  IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration PeriodState
+  IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card PostProcessing TimeSeriesCompleted
+  IGCM_debug_Print 1 "DefineVariableFromOption  : run_Configuration"
+  IGCM_debug_PrintVariables 3 run_Configuration_OldPrefix
+  IGCM_debug_PrintVariables 3 run_Configuration_PeriodState
+  IGCM_debug_Print 1 "DefineVariableFromOption  : run_PostProcessing"
+  IGCM_debug_PrintVariables 3 run_PostProcessing_TimeSeriesCompleted
+  if [ X${run_Configuration_PeriodState} != X"Completed" ] ; then
+    DateEnd=$( IGCM_date_ConvertFormatToGregorian $( echo ${run_Configuration_OldPrefix} | awk -F'_' '{print $2}' ) )
+  else
+    DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
+  fi
+  CompletedFlag=${run_PostProcessing_TimeSeriesCompleted}
 else
-    DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
-    CompletedFlag=""
+  DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
+  CompletedFlag=""
 fi
 SavedCompletedFlag=${CompletedFlag}
@@ -133,12 +152,12 @@
 #R_BUFR : Job output buffered 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_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
-    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+  FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
+  R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+  R_BUFR=${R_BUF}/${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_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
-    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
 
@@ -146,314 +165,313 @@
 
 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
+  # 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
     #
-    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
         #
-	#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
+        # 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" ] ; then
+          # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob.
+          unset ListDimension
+          ListDimension[0]=2D
+          ListDimension[1]=3D
+          TimeSeries=false
+          TimeSeries2D=false
+          TimeSeries3D=false
+          chunck=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 ))
+            #
+            # If TimeSeriesVars list is empty or OFF we skip
+            #
+            if ( [ $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] || \
+              [ ${chunck_size} = OFF ] ) ; then
+              #IGCM_debug_Print 2 "Empty TS : ${compname}_Post_${FILE}_TimeSeriesVars${Dimension}"
+              #(( i=i+3 ))
+              continue
+            fi
+            #
+            #  ICI ON TESTE 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
+            #
+            # We need LIST of variables not allready produced (useful for standalone mode)
+            #
+            DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
+            IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
+
+            # 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=$(( YearEnd - YearBegin + 1 ))
+
+            NbYearsChunckLoop=$(( ( YearEnd - YearBegin + 1 ) / YearsChunckLength ))
+            Reste=$(( ( YearEnd - YearBegin + 1 ) % YearsChunckLength ))
+
+            if [ ${Reste} -ne 0 ] ; then
+              NbYearsChunckLoop=$(( 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
+              unset RemoveList
+              unset PotentialCompletedFlag
+              for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do
+                TestedFile=${config_UserChoices_JobName}_${ChunckDebut}_${ChunckFin}_${FlagDir}_${var}.nc
                 #
-		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" ] ; then
-		    # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob.
-		    unset ListDimension
-		    ListDimension[0]=2D
-		    ListDimension[1]=3D
-		    TimeSeries=false
-		    TimeSeries2D=false
-		    TimeSeries3D=false
-		    chunck=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 ))
-	                #
-		        # If TimeSeriesVars list is empty or OFF we skip
-		        #
-			if ( [ $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] || \
-			    [ ${chunck_size} = OFF ] ) ; then
-			    #IGCM_debug_Print 2 "Empty TS : ${compname}_Post_${FILE}_TimeSeriesVars${Dimension}"
-			    #(( i=i+3 ))
-			    continue
-			fi
-			#
-			#  ICI ON TESTE 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
-		        #
-	                # We need LIST of variables not allready produced (useful for standalone mode)
-	                #
-			DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
-			IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
-
-			# 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=$(( YearEnd - YearBegin + 1 ))
-
-			NbYearsChunckLoop=$(( ( YearEnd - YearBegin + 1 ) / YearsChunckLength ))
-			Reste=$(( ( YearEnd - YearBegin + 1 ) % YearsChunckLength ))
-
-			if [ ${Reste} -ne 0 ] ; then
-			    NbYearsChunckLoop=$(( 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
-			    unset RemoveList
-			    unset PotentialCompletedFlag
-			    for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do
-				TestedFile=${config_UserChoices_JobName}_${ChunckDebut}_${ChunckFin}_${FlagDir}_${var}.nc
-	                        #
-				if [ -d ${DIRECTORY} ] ; then
-				    Candidat=$( find ${DIRECTORY} -name "${config_UserChoices_JobName}_${ChunckDebut}_*_${FlagDir}_${var}.nc" )
-				else
-				    Candidat=""
-				fi
-				#
-				BestCandidat=${ChunckDebut}
-				#
-				FoundCandidat=false
-				if [ ! "X${Candidat}" = "X" ] ; then
-				    for candid in ${Candidat} ; do
-					#IGCM_debug_Print 1 -e "\033[1;32m[CompletedFlag CANDIDAT MATCH FOUND]\033[m $( basename ${candid} )"
-					CandidatEnd=$( echo ${candid}   | awk -F${config_UserChoices_JobName} '{print $3}' | awk -F_ '{print $3}' )
-					if [ ${CandidatEnd} -gt ${ChunckFin} ] ; then
-					    #IGCM_debug_Print 3 -e "File $( basename ${candid} ) should be suppress"
-					    set +A RemoveList ${RemoveList[*]} ${candid}
-					elif [ ${CandidatEnd} -lt ${ChunckFin} ] ; then
-					    #IGCM_debug_Print 3 -e "File $( basename ${candid} ) should be suppress or used as a CompletedFlag baseline"
-					    # We keep the best candidat and remove the others
-                                            if [ ${BestCandidat} -lt ${CandidatEnd} ] ; then
-                                                if [ ${FoundCandidat} = true ] ; then
-                                                   set +A RemoveList ${RemoveList[*]} ${DIRECTORY}/${config_UserChoices_JobName}_${ChunckDebut}_${BestCandidat}_${FlagDir}_${var}.nc
-                                                else
-                                                   FoundCandidat=true
-                                                fi
-                                                BestCandidat=${CandidatEnd}
-                                            else
-                                                set +A RemoveList ${RemoveList[*]} ${candid}
-                                            fi
-					fi
-				    done
-				else
-				    # No CompletedFlag candidat found
-				    CandidatCompletedFlag=""
-				fi
-				#
-				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}
-				    # Then we keep a track of the Best Candidat
-				    if [ ${FoundCandidat} = true ] ; then
-					if [ ${chunck} = true ] ; then
-					    set +A PotentialCompletedFlag ${PotentialCompletedFlag[*]} ${BestCandidat}
-					else
-					    eval set +A PotentialCompletedFlag${Dimension} \${PotentialCompletedFlag${Dimension}[*]} \${BestCandidat}
-					fi
-				    fi
-				else
-				    (( countGood = countGood + 1 ))
-				    # Then we do not need the best candidat if any
-				    [ ${FoundCandidat} = true ] && set +A RemoveList ${RemoveList[*]} ${DIRECTORY}/${config_UserChoices_JobName}_${ChunckDebut}_${BestCandidat}_${FlagDir}_${var}.nc
-				fi
-				(( countTotal = countTotal + 1 ))
-			    done
-
-			    SuccessRate=$(( countGood * 100 / countTotal ))
-			    if [ ${SuccessRate} -ne 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
-
-			    # Remove what's in the RemoveList
-			    if [ ${RemoveList} ] ; then
-				IGCM_debug_Print 2 "File(s) that will be removed ${RemoveList[*]}"
-				if [ ${action} = true ] ; then
-				    echo -e "\033[1;32mDo you want to remove them?\033[m"
-				    echo -n " Your answer (y/n) : "
-				    read RemoveAnswer
-				    case ${RemoveAnswer} in    
-					oui|OUI|o|y|yes|YES)
-					    echo "OK. I will erase them"
-					    IGCM_sys_Rm -f ${RemoveList[*]}
-					    ;;
-					non|NON|n|no|NO)
-					    echo "OK. I won't erase them"
-					    ;;
-					*)
-					    echo "I did not recognize your answer."
-					    echo "Please respond: oui|OUI|o|y|yes|YES"
-					    echo "Or please respond: non|NON|n|no|NO"
-					    exit
-					    ;;
-				    esac
-				fi
-			    fi
-			    #[ ${FoundCandidat} = true ] && IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag[*]}"
-			    if ( [ ${chunck} = true ] && [ ${SuccessRate} -ne 100 ] ) ; then
-				#
-				# TO REWRITE BEGIN
-				#
-				NbCandidats=${#PotentialCompletedFlag[@]}
-				countCandid=1
-				if [ ${NbCandidats} -eq 0 ] ; then
-				    ChunckCompletedFlag=""
-				    IGCM_debug_Print 2 -e "\033[1;31mNO CompletedFlag\033[m"
-				elif [ ${NbCandidats} -eq 1 ] ; then
-				    ChunckCompletedFlag=${PotentialCompletedFlag[0]}
-				    IGCM_debug_Print 2 -e "\033[1;32mCompletedFlag=${ChunckCompletedFlag}\033[m"
-				elif [ ${NbCandidats} -gt 1 ] ; then
-				    k=1
-				    until [ $k -ge ${NbCandidats} ]; do
-					((k_m1=k-1))
-					if [ ${PotentialCompletedFlag[${k_m1}]} = ${PotentialCompletedFlag[${k}]} ] ; then
-					    ((countCandid=countCandid+1))
-					fi
-					((k=k+1))
-				    done
-				    if [ ${NbCandidats} -eq ${countCandid} ] ; then
-					ChunckCompletedFlag=${PotentialCompletedFlag[0]}
-					IGCM_debug_Print 2 -e "\033[1;32mCompletedFlag=${ChunckCompletedFlag}\033[m"
-				    else
-					ChunckCompletedFlag=${PotentialCompletedFlag[0]}
-					IGCM_debug_Print 2 -e "\033[1;31mToo Many Potential CompletedFlag\033[m Let start with first CompletedPeriod"
-					IGCM_debug_Print 2 -e "\033[1;31mYou will have to redo TimeSeries_Checker\033[m for other period."
-				    fi
-				fi
-				#
-				# TO REWRITE END
-				#
-				if [ ${action} = true ] ; then
-				    IGCM_debug_Print 2 -e "\033[1;31mSubmit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin} and CompletedFlag=${ChunckCompletedFlag}"
-				    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask,CompToRead,FlagToRead"
-				    export libIGCM=${libIGCM}
-				    export SUBMIT_DIR=${CARD_DIR}
-				    export POST_DIR=${POST_DIR}
-				    export DateBegin=${ChunckDebut}
-				    export PeriodDateEnd=${ChunckFin}
-				    export CompletedFlag=${ChunckCompletedFlag}
-				    export TsTask=Chunck${Dimension}
-				    export CompToRead=${comp}
-				    export FlagToRead=${i}
-				    export NameToRead=${flag_post}
-				    export listVarEnv=${listVarEnv}
-                                    IGCM_sys_MkdirWork ${POST_DIR}
-                                    IGCM_debug_Verif_Exit_Post
-				    Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}.${CompToRead}.${NameToRead}
-                                    IGCM_sys_QsubPost create_ts
-				    echo
-				else
-				    IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin} and CompletedFlag=${ChunckCompletedFlag}"
-				fi
-			    fi
-
-			    if ( [ ${chunck} = false ] && [ ${SuccessRate} -ne 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
-				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
+                if [ -d ${DIRECTORY} ] ; then
+                  Candidat=$( find ${DIRECTORY} -name "${config_UserChoices_JobName}_${ChunckDebut}_*_${FlagDir}_${var}.nc" )
+                else
+                  Candidat=""
+                fi
+                #
+                BestCandidat=${ChunckDebut}
+                #
+                FoundCandidat=false
+                if [ ! "X${Candidat}" = "X" ] ; then
+                  for candid in ${Candidat} ; do
+                    #IGCM_debug_Print 1 -e "\033[1;32m[CompletedFlag CANDIDAT MATCH FOUND]\033[m $( basename ${candid} )"
+                    CandidatEnd=$( echo ${candid}   | awk -F${config_UserChoices_JobName} '{print $3}' | awk -F_ '{print $3}' )
+                    if [ ${CandidatEnd} -gt ${ChunckFin} ] ; then
+                      #IGCM_debug_Print 3 -e "File $( basename ${candid} ) should be suppress"
+                      set +A RemoveList ${RemoveList[*]} ${candid}
+                    elif [ ${CandidatEnd} -lt ${ChunckFin} ] ; then
+                      #IGCM_debug_Print 3 -e "File $( basename ${candid} ) should be suppress or used as a CompletedFlag baseline"
+                      # We keep the best candidat and remove the others
+                      if [ ${BestCandidat} -lt ${CandidatEnd} ] ; then
+                        if [ ${FoundCandidat} = true ] ; then
+                          set +A RemoveList ${RemoveList[*]} ${DIRECTORY}/${config_UserChoices_JobName}_${ChunckDebut}_${BestCandidat}_${FlagDir}_${var}.nc
+                        else
+                          FoundCandidat=true
+                        fi
+                        BestCandidat=${CandidatEnd}
+                      else
+                        set +A RemoveList ${RemoveList[*]} ${candid}
+                      fi
+                    fi
+                  done
+                else
+                  # No CompletedFlag candidat found
+                  CandidatCompletedFlag=""
+                fi
+                #
+                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}
+                  # Then we keep a track of the Best Candidat
+                  if [ ${FoundCandidat} = true ] ; then
+                    if [ ${chunck} = true ] ; then
+                      set +A PotentialCompletedFlag ${PotentialCompletedFlag[*]} ${BestCandidat}
+                    else
+                      eval set +A PotentialCompletedFlag${Dimension} \${PotentialCompletedFlag${Dimension}[*]} \${BestCandidat}
+                    fi
+                  fi
+                else
+                  (( countGood = countGood + 1 ))
+                  # Then we do not need the best candidat if any
+                  [ ${FoundCandidat} = true ] && set +A RemoveList ${RemoveList[*]} ${DIRECTORY}/${config_UserChoices_JobName}_${ChunckDebut}_${BestCandidat}_${FlagDir}_${var}.nc
+                fi
+                (( countTotal = countTotal + 1 ))
+              done
+
+              SuccessRate=$(( countGood * 100 / countTotal ))
+              if [ ${SuccessRate} -ne 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
+
+              # Remove what's in the RemoveList
+              if [ ${RemoveList} ] ; then
+                IGCM_debug_Print 2 "File(s) that will be removed ${RemoveList[*]}"
+                if [ ${action} = true ] ; then
+                  echo -e "\033[1;32mDo you want to remove them?\033[m"
+                  echo -n " Your answer (y/n) : "
+                  read RemoveAnswer
+                  case ${RemoveAnswer} in
+                  oui|OUI|o|y|yes|YES)
+                    echo "OK. I will erase them"
+                    IGCM_sys_Rm -f ${RemoveList[*]}
+                    ;;
+                  non|NON|n|no|NO)
+                    echo "OK. I won't erase them"
+                    ;;
+                  *)
+                    echo "I did not recognize your answer."
+                    echo "Please respond: oui|OUI|o|y|yes|YES"
+                    echo "Or please respond: non|NON|n|no|NO"
+                    exit
+                    ;;
+                  esac
+                fi
+              fi
+              #[ ${FoundCandidat} = true ] && IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag[*]}"
+              #
+              # TO REWRITE BEGIN
+              #
+              if ( [ ${chunck} = true ] && [ ${SuccessRate} -ne 100 ] ) ; then
+                NbCandidats=${#PotentialCompletedFlag[@]}
+                countCandid=1
+                if [ ${NbCandidats} -eq 0 ] ; then
+                  ChunckCompletedFlag=""
+                  IGCM_debug_Print 2 -e "\033[1;31mNO CompletedFlag\033[m"
+                elif [ ${NbCandidats} -eq 1 ] ; then
+                  ChunckCompletedFlag=${PotentialCompletedFlag[0]}
+                  IGCM_debug_Print 2 -e "\033[1;32mCompletedFlag=${ChunckCompletedFlag}\033[m"
+                elif [ ${NbCandidats} -gt 1 ] ; then
+                  k=1
+                  until [ $k -ge ${NbCandidats} ]; do
+                    ((k_m1=k-1))
+                    if [ ${PotentialCompletedFlag[${k_m1}]} = ${PotentialCompletedFlag[${k}]} ] ; then
+                      ((countCandid=countCandid+1))
+                    fi
+                    ((k=k+1))
+                  done
+                  if [ ${NbCandidats} -eq ${countCandid} ] ; then
+                    ChunckCompletedFlag=${PotentialCompletedFlag[0]}
+                    IGCM_debug_Print 2 -e "\033[1;32mCompletedFlag=${ChunckCompletedFlag}\033[m"
+                  else
+                    ChunckCompletedFlag=${PotentialCompletedFlag[0]}
+                    IGCM_debug_Print 2 -e "\033[1;31mToo Many Potential CompletedFlag\033[m Let start with first CompletedPeriod"
+                    IGCM_debug_Print 2 -e "\033[1;31mYou will have to redo TimeSeries_Checker\033[m for other period."
+                  fi
+                fi
+                #
+                # TO REWRITE END
+                #
+                if [ ${action} = true ] ; then
+                  IGCM_debug_Print 2 -e "\033[1;31mSubmit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin} and CompletedFlag=${ChunckCompletedFlag}"
+                  listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask,CompToRead,FlagToRead"
+                  export libIGCM=${libIGCM}
+                  export SUBMIT_DIR=${CARD_DIR}
+                  export POST_DIR=${POST_DIR}
+                  export DateBegin=${ChunckDebut}
+                  export PeriodDateEnd=${ChunckFin}
+                  export CompletedFlag=${ChunckCompletedFlag}
+                  export TsTask=Chunck${Dimension}
+                  export CompToRead=${comp}
+                  export FlagToRead=${i}
+                  export NameToRead=${flag_post}
+                  export listVarEnv=${listVarEnv}
+                  IGCM_sys_MkdirWork ${POST_DIR}
+                  IGCM_debug_Verif_Exit_Post
+                  Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}.${CompToRead}.${NameToRead}
+                  IGCM_sys_QsubPost create_ts
+                  echo
+                else
+                  IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin} and CompletedFlag=${ChunckCompletedFlag}"
+                fi
+              fi
+
+              if ( [ ${chunck} = false ] && [ ${SuccessRate} -ne 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
+                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
 
@@ -468,46 +486,46 @@
 
 if [ X${Launch2D} = Xtrue ] ; then
-    if [ ${action} = true ] ; then
-        #IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag2D[*]}"
-	IGCM_debug_Print 2 -e "\033[1;31mSubmit 2D\033[m without chunck period ${DateBegin}-${DateEnd}"
-	listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask"
-	export libIGCM=${libIGCM}
-	export SUBMIT_DIR=${CARD_DIR}
-	export POST_DIR=${POST_DIR}
-	export DateBegin=${DateBegin}
-	export PeriodDateEnd=${DateEnd}
-	export CompletedFlag=${CompletedFlag}
-	export TsTask=2D
-	export listVarEnv=${listVarEnv}
-	IGCM_sys_MkdirWork ${POST_DIR}
-	IGCM_debug_Verif_Exit_Post
-	Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}
-	IGCM_sys_QsubPost create_ts
-	echo
-    else
-	IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit 2D without chunck\033[m period ${DateBegin}-${DateEnd}"
-    fi
+  if [ ${action} = true ] ; then
+    #IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag2D[*]}"
+    IGCM_debug_Print 2 -e "\033[1;31mSubmit 2D\033[m without chunck period ${DateBegin}-${DateEnd}"
+    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask"
+    export libIGCM=${libIGCM}
+    export SUBMIT_DIR=${CARD_DIR}
+    export POST_DIR=${POST_DIR}
+    export DateBegin=${DateBegin}
+    export PeriodDateEnd=${DateEnd}
+    export CompletedFlag=${CompletedFlag}
+    export TsTask=2D
+    export listVarEnv=${listVarEnv}
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit_Post
+    Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}
+    IGCM_sys_QsubPost create_ts
+    echo
+  else
+    IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit 2D without chunck\033[m period ${DateBegin}-${DateEnd}"
+  fi
 fi
 
 if [ X${Launch3D} = Xtrue ] ; then
-    if [ ${action} = true ] ; then
-        #IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag3D[*]}"
-	IGCM_debug_Print 2 -e "\033[1;31mSubmit 3D\033[m without chunck period ${DateBegin}-${DateEnd}"
-	listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask"
-	export libIGCM=${libIGCM}
-	export SUBMIT_DIR=${CARD_DIR}
-	export POST_DIR=${POST_DIR}
-	export DateBegin=${DateBegin}
-	export PeriodDateEnd=${DateEnd}
-	export CompletedFlag=${CompletedFlag}
-	export TsTask=3D
-	export listVarEnv=${listVarEnv}
-	IGCM_sys_MkdirWork ${POST_DIR}
-	IGCM_debug_Verif_Exit_Post
-	Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}
-	IGCM_sys_QsubPost create_ts
-	echo
-    else
-	IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit 3D without chunck\033[m  period ${DateBegin}-${DateEnd}"
-    fi
+  if [ ${action} = true ] ; then
+    #IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag3D[*]}"
+    IGCM_debug_Print 2 -e "\033[1;31mSubmit 3D\033[m without chunck period ${DateBegin}-${DateEnd}"
+    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask"
+    export libIGCM=${libIGCM}
+    export SUBMIT_DIR=${CARD_DIR}
+    export POST_DIR=${POST_DIR}
+    export DateBegin=${DateBegin}
+    export PeriodDateEnd=${DateEnd}
+    export CompletedFlag=${CompletedFlag}
+    export TsTask=3D
+    export listVarEnv=${listVarEnv}
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit_Post
+    Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}
+    IGCM_sys_QsubPost create_ts
+    echo
+  else
+    IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit 3D without chunck\033[m  period ${DateBegin}-${DateEnd}"
+  fi
 fi
Index: /branches/libIGCM_MPI_OpenMP/AA_atlas_LMDZ
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_atlas_LMDZ	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_atlas_LMDZ	(revision 592)
@@ -185,12 +185,15 @@
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_BUFR=${R_BUF}/${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_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
 #
+IGCM_sys_MkdirArchive ${R_FIGR}
 
 R_ATLAS=ATLAS/SE_${YEARS}
@@ -228,12 +231,12 @@
 
 # Save files
-IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+IGCM_sys_Put_Dir ATLAS ${R_FIGR}
 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}
+IGCM_sys_TestDirArchive ${R_FIGR}/${R_ATLAS}
 [ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /branches/libIGCM_MPI_OpenMP/AA_atlas_ORCA_LIM
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_atlas_ORCA_LIM	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_atlas_ORCA_LIM	(revision 592)
@@ -185,12 +185,15 @@
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_BUFR=${R_BUF}/${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_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
 #
+IGCM_sys_MkdirArchive ${R_FIGR}
 
 R_ATLAS=ATLAS/SE_${YEARS}
@@ -263,5 +266,5 @@
 
 # Save files
-IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+IGCM_sys_Put_Dir ATLAS ${R_FIGR}
 
 IGCM_sys_Rm -Rf ATLAS
@@ -274,7 +277,7 @@
 
 # DODS copy
-IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS}
+IGCM_sys_TestDirArchive ${R_FIGR}/${R_ATLAS}
 [ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /branches/libIGCM_MPI_OpenMP/AA_atlas_ORCHIDEE
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_atlas_ORCHIDEE	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_atlas_ORCHIDEE	(revision 592)
@@ -194,12 +194,15 @@
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_BUFR=${R_BUF}/${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_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
 #
+IGCM_sys_MkdirArchive ${R_FIGR}
 
 R_ATLAS=ATLAS/SE_${YEARS}
@@ -234,12 +237,12 @@
 
 # Save files
-IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+IGCM_sys_Put_Dir ATLAS ${R_FIGR}
 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}
+IGCM_sys_TestDirArchive ${R_FIGR}/${R_ATLAS}
 [ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /branches/libIGCM_MPI_OpenMP/AA_atlas_PISCES
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_atlas_PISCES	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_atlas_PISCES	(revision 592)
@@ -186,12 +186,15 @@
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_BUFR=${R_BUF}/${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_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
 #
+IGCM_sys_MkdirArchive ${R_FIGR}
 
 R_ATLAS=ATLAS/SE_${YEARS}
@@ -232,5 +235,5 @@
 
 # Save files
-IGCM_sys_Put_Dir ATLAS ${R_SAVE}
+IGCM_sys_Put_Dir ATLAS ${R_FIGR}
 
 IGCM_sys_Rm -Rf ATLAS
@@ -239,7 +242,7 @@
 
 # DODS copy
-IGCM_sys_TestDirArchive ${R_SAVE}/${R_ATLAS}
+IGCM_sys_TestDirArchive ${R_FIGR}/${R_ATLAS}
 [ $? = 0 ] && IGCM_sys_Put_Dods ${R_ATLAS}
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /branches/libIGCM_MPI_OpenMP/AA_create_multi_se
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_create_multi_se	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_create_multi_se	(revision 592)
@@ -546,4 +546,4 @@
 fi
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /branches/libIGCM_MPI_OpenMP/AA_create_se
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_create_se	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_create_se	(revision 592)
@@ -697,4 +697,4 @@
 fi
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /branches/libIGCM_MPI_OpenMP/AA_create_ts
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_create_ts	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_create_ts	(revision 592)
@@ -244,25 +244,44 @@
 fi
 
-#
+#==================================
 # First of all
 #
+typeset option
+
+#==================================
+# Read UserChoices section: 
 IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
-typeset option
+echo
+IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
 for option in ${config_UserChoices[*]} ; do
     IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
+    eval auxprint=\${config_UserChoices_${option}}
+    IGCM_debug_Print 3 "${option} : ${auxprint}"
 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
+
+#==================================
+# Read Post section: 
+IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Post
 echo
+IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
+for option in ${config_Post[*]} ; do
+  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post ${option}
+  eval auxprint=\${config_Post_${option}}
+  IGCM_debug_Print 3 "${option} : ${auxprint}"
+done
+#
+echo
+
+#==================================
+# Define default value to keep compatibility with previous card: means before changes due to TGCC 
+[ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency}
+
+#==================================
+# If pack is active then PackFrequency overule the config_UserChoices_PeriodLength
+if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then
+  config_UserChoices_PeriodLength=${config_Post_PackFrequency}
+fi
 
 #==================================
@@ -869,5 +888,5 @@
 fi
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
 
Index: /branches/libIGCM_MPI_OpenMP/AA_monitoring
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_monitoring	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_monitoring	(revision 592)
@@ -231,16 +231,20 @@
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_BUFR=${R_BUF}/${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_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
 fi
+
+IGCM_sys_MkdirArchive ${R_FIGR}
 #
-IGCM_sys_TestDirArchive ${R_SAVE}/MONITORING
+IGCM_sys_TestDirArchive ${R_FIGR}/MONITORING
 if [ $? = 0 ] ; then
     IGCM_debug_Print 1 "Get MONITORING directory from archive"
-    IGCM_sys_Get_Dir ${R_SAVE}/MONITORING ${RUN_DIR}
+    IGCM_sys_Get_Dir ${R_FIGR}/MONITORING ${RUN_DIR}
 else
     IGCM_debug_Print 1 "MONITORING first pass. Nothing has been done before"
@@ -292,9 +296,9 @@
 
 # Save files
-IGCM_sys_Put_Dir MONITORING ${R_SAVE}
+IGCM_sys_Put_Dir MONITORING ${R_FIGR}
 
 # Dods copy
 IGCM_sys_Put_Dods MONITORING
 
-# Clean RUN_DIR_PATH (necessary for cesium)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Index: /branches/libIGCM_MPI_OpenMP/AA_pack_debug
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_pack_debug	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_pack_debug	(revision 592)
@@ -3,5 +3,5 @@
 #-Q- cesium ## CESIUM   CEA ##
 #-Q- cesium ######################
-#-Q- cesium #MSUB -r PACKDEBUG    # Nom du job                
+#-Q- cesium #MSUB -r PACKDEBUG    # Nom du job
 #-Q- cesium #MSUB -N 1              # Reservation du noeud
 #-Q- cesium #MSUB -n 1              # Reservation du processus
@@ -27,5 +27,5 @@
 #-Q- sx8brodie # Nom du travail LoadLeveler
 #-Q- sx8brodie # @ job_name   = PACKDEBUG
-#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # Fichier de sortie standard du travail
 #-Q- sx8brodie # @ output     = $(job_name).$(jobid)
 #-Q- sx8brodie # Fichier de sortie d'erreur du travail
@@ -81,5 +81,5 @@
 #-Q- sx9mercure ## CESIUM   CEA ##
 #-Q- sx9mercure ######################
-#-Q- sx9mercure #MSUB -r PACKDEBUG    # Nom du job                
+#-Q- sx9mercure #MSUB -r PACKDEBUG    # Nom du job
 #-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
 #-Q- sx9mercure #MSUB -n 1              # Reservation du processus
@@ -91,5 +91,5 @@
 #-Q- titane ## TITANE   CEA     ##
 #-Q- titane ######################
-#-Q- titane #MSUB -r PACKDEBUG    # Nom du job                
+#-Q- titane #MSUB -r PACKDEBUG    # Nom du job
 #-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
@@ -178,15 +178,15 @@
 #RESTART/ATM_****.nc
 #RESTART/OCE_****.nc
-#Attention de bien conserver les dates d'origines 
+#Attention de bien conserver les dates d'origines
 #
 #Dans le cadre de la production nouvelle chaine
 #ils auront directement le bon nom
 #
-#On veut egalement que l'archive soit par periode de temps 
-# cette periode est definie par la taille du pack donc connue 
-# en entree du script (1M, 1Y, 5Y, 10Y etc...) 
-#
-# $1= PATH/config_card d'une simulation avec 
-# TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd/PATH_SIMUL
+#On veut egalement que l'archive soit par periode de temps
+# cette periode est definie par la taille du pack donc connue
+# en entree du script (1M, 1Y, 5Y, 10Y etc...)
+#
+# $1= PATH/config_card d'une simulation avec
+# TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd
 # $2=PeriodPack en M/m ou Y/y
 
@@ -223,11 +223,8 @@
 fi
 
-#
+#====================================================
 # First of all
 #
-#### 0- lecture de config.card 
-#### on veut les renseignements suivants : 
-#### JobName, PATH_SIMUL, DateBegin et DateEnd
-
+# Read config.card
 IGCM_card_DefineArrayFromSection     ${CARD_DIR}/config.card UserChoices
 typeset option
@@ -250,6 +247,8 @@
 
 #====================================================
-#R_SAVE : Job output storage directory
-#R_BUFR : Job output buffered directory
+# Prepare environment
+#R_SAVE      : Job output storage directory
+#R_BUFR      : Job output buffered directory
+#STORE_DEBUG : Where we store tar files
 
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
@@ -264,20 +263,15 @@
 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
 
-#### Preparation de l'environnement
-# repertoire dans lequel seront crees les archives
-#STORE_DEBUG=/scratch/cont003/p86denv/Pack_Test/DEBUG
+#STORE_DEBUG=/ccc/store/cont003/dsm/p86denv/.../DEBUG
 STORE_DEBUG=${R_SAVE}/DEBUG
 IGCM_sys_MkdirArchive ${STORE_DEBUG}
 
+#cd ${STORE_DEBUG}
+#rm -f *
+
 # Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure)
 JobName=${config_UserChoices_JobName}
-PATH_SIMUL=${R_BUFR}
-echo $JobName $PATH_SIMUL $DateBegin $DateEnd
-
-#### 1- renommer les fichiers ######
-#cd ${STORE_DEBUG}
-#rm -rf *
-
-# On les copie sur le scratchdir en changeant le nom et conservant la date
+echo $JobName $DateBegin $DateEnd
+
 # Clear txt file lists
 rm -f ${RUN_DIR}/liste_debug_files.txt
@@ -286,5 +280,5 @@
 
 # Create sorted debug list to work with
-find ${PATH_SIMUL}/*/Debug -type f | sort >> ${RUN_DIR}/liste_debug_files.txt
+find ${R_BUFR}/*/Debug -type f | sort >> ${RUN_DIR}/liste_debug_files.txt
 
 # Rename debug files we will work with using symlinks
@@ -312,15 +306,14 @@
   IGCM_debug_PrintVariables 3 number_pack
 
-  DaysTemp=$( IGCM_date_DaysInNextPeriod ${date_begin_pack} ${PeriodPack} )
-  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} ${DaysTemp} )
+  DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack} )
+  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) )
 
   for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_debug_files.txt ); do
     extract_date_file=$( echo ${file}  | sed -e "s/.*${JobName}_[0-9]*_//" )
     date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' )
-#   echo pack nÂ°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack} 
-    if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 
+#   echo pack nÂ°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack}
+    if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then
         echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt
-	echo $( ls -L ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt
-
+        echo $( readlink ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt
 #    Will not work. Need to find a better ordering.
 #    elif [ ${date_file} -ge ${date_end_pack} ] ; then
@@ -350,2 +343,7 @@
 
 done
+
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
+
+date
Index: /branches/libIGCM_MPI_OpenMP/AA_pack_output
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_pack_output	(revision 592)
+++ /branches/libIGCM_MPI_OpenMP/AA_pack_output	(revision 592)
@@ -0,0 +1,334 @@
+#-Q- cesium #!/bin/ksh
+#-Q- cesium ######################
+#-Q- cesium ## CESIUM   CEA ##
+#-Q- cesium ######################
+#-Q- cesium #MSUB -r PACKOUTPUT    # 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 PACKOUTPUT            # 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- platine #BSUB -L /bin/ksh
+#-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   = PACKOUTPUT
+#-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 ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $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   = PACKOUTPUT
+#-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 ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
+#-Q- aix6 # @ queue
+#-Q- ulam #!/bin/ksh
+#-Q- ulam #######################
+#-Q- ulam ##   VARGAS   IDRIS  ##
+#-Q- ulam #######################
+#-Q- ulam # Temps Elapsed max. d'une requete hh:mm:ss
+#-Q- ulam # @ wall_clock_limit = 10:00:00
+#-Q- ulam # Nom du travail LoadLeveler
+#-Q- ulam # @ job_name   = PACKOUTPUT
+#-Q- ulam # Fichier de sortie standard du travail
+#-Q- ulam # @ output     = $(job_name).$(jobid)
+#-Q- ulam # Fichier de sortie d'erreur du travail
+#-Q- ulam # @ error      =  $(job_name).$(jobid)
+#-Q- ulam # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
+#-Q- ulam # @ notification = error
+#-Q- ulam # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
+#-Q- ulam # @ queue
+#-Q- sx8mercure #!/bin/ksh
+#-Q- sx8mercure ######################
+#-Q- sx8mercure ## SX8MERCURE   CEA ##
+#-Q- sx8mercure ######################
+#-Q- sx8mercure #PBS -N PACKOUTPUT          # 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 PACKOUTPUT    # 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 PACKOUTPUT    # Nom du job
+#-Q- titane #MSUB -eo
+#-Q- titane #MSUB -n 1              # Reservation du processus
+#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
+#-Q- titane #MSUB -q mono
+#-Q- lxiv8 ######################
+#-Q- lxiv8 ## OBELIX      LSCE ##
+#-Q- lxiv8 ######################
+#-Q- lxiv8 #PBS -N PACKOUTPUT
+#-Q- lxiv8 #PBS -m a
+#-Q- lxiv8 #PBS -j oe
+#-Q- lxiv8 #PBS -q medium
+#-Q- lxiv8 #PBS -o PACKOUTPUT.$$
+#-Q- lxiv8 #PBS -S /bin/ksh
+#-Q- default #!/bin/ksh
+#-Q- default ##################
+#-Q- default ## DEFAULT HOST ##
+#-Q- default ##################
+
+#**************************************************************
+# Author: Sebastien Denvil
+# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
+# $Revision::                                          $ Revision of last commit
+# $Author::                                            $ Author of last commit
+# $Date::                                              $ Date of last commit
+# IPSL (2006)
+#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
+#
+#**************************************************************
+
+#set -eu
+#set -vx
+
+date
+
+########################################################################
+
+#D- Flag to determine if this job in a standalone mode
+#D- Default : value from AA_job if any
+StandAlone=${StandAlone:=true}
+
+#D- Path to libIGCM
+#D- Default : value from AA_job if any
+# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
+# WARNING you must check MirrorlibIGCM variable in sys library.
+# WARNING If this variable is true, you must use libIGCM_POST path instead
+# WARNING of your running libIGCM directory.
+libIGCM=${libIGCM:=::modipsl::/libIGCM}
+
+#-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
+MASTER=${MASTER:=mercure|titane|brodie|vargas}
+
+#D- Flag to determine begin date for restart pack
+#D- Default : value from AA_job if any
+DateBegin=${DateBegin:=20000101}
+
+#D- Flag to determine end date for restart pack
+#D- Default : value from AA_job if any
+DateEnd=${DateEnd:=20691231}
+
+#D- Flag to determine pack period
+#D- Default : value from AA_job if any
+PeriodPack=${PeriodPack:=10Y}
+
+#D- Uncomment to run interactively
+#D- For testing purpose, will be remove
+#SUBMIT_DIR=${PWD}
+#RUN_DIR_PATH=${SCRATCHDIR}/Pack_Test
+
+#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}
+
+########################################################################
+
+. ${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}
+
+# ------------------------------------------------------------------
+# Test if all was right before proceeding further
+# ------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+
+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
+#
+# Read config.card
+
+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
+
+# Get ListOfComponents to drive the loop over find
+IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
+
+#====================================================
+#R_SAVE : Job output storage directory
+#R_BUFR : Job output buffered 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_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+else
+  R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+fi
+IGCM_sys_TestDirArchive ${R_SAVE}
+[ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
+
+# Where to store used file list /!\ TEMPORARY /!\
+STORE_DEBUG=${R_SAVE}/DEBUG
+
+# Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure)
+JobName=${config_UserChoices_JobName}
+echo $JobName $DateBegin $DateEnd
+
+# ------------------------------------------------------------------
+# Test if all was right before proceeding further
+# ------------------------------------------------------------------
+IGCM_debug_Verif_Exit_Post
+
+# Init loop
+date_begin_pack=${DateBegin}
+date_end_simulation=${DateEnd}
+number_pack=1
+
+IGCM_debug_PrintVariables 3 date_begin_pack
+IGCM_debug_PrintVariables 3 date_end_simulation
+
+while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do
+
+  IGCM_debug_PrintVariables 3 number_pack
+  DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack} )
+  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) )
+
+  for comp in ${config_ListOfComponents[*]} ; do
+    dirList=$( find ${R_BUFR}/${comp}/Output -maxdepth 1 -mindepth 1 -type d )
+    for dir in ${dirList} ; do
+      # dirID is like ATM.Output.MO
+      dirID=$( echo $dir | sed "s:${R_BUFR}/::" | sed "s:/:.:g" )
+      # Sort what's in the directory
+      find ${dir} -type f -name "${JobName}*.nc" -ls | sort -k 11 > liste_files.${dirID}.txt
+      # How much file type. Example : 1M_histmthCOSP.nc, 1M_histmth.nc, 1M_histmthNMC.nc, 1M_paramLMDZ_phy.nc
+      # /!\ fileType include the .nc extension /!\
+      fileType=$( gawk '{print $11}' liste_files.${dirID}.txt | gawk -F$dir/ '{print $2}' | sed "s:${JobName}_[0-9]\{8,9\}_[0-9]\{8,9\}_::g" | sort | uniq )
+      # Loop over the file type and pack them when in between date_begin_pack and date_end_pack
+      for myType in ${fileType} ; do
+        grep ${myType} liste_files.${dirID}.txt > liste_files.${dirID}.${myType}.txt
+        nbfile=0
+        for file in $( gawk '{print $11}' liste_files.${dirID}.${myType}.txt ); do
+          extract_date_file=$( echo ${file}  | sed -e "s/.*${JobName}_[0-9]*_//" )
+          date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' )
+          # echo pack nÂ°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack}
+          if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then
+            echo ${file} >> liste_pack_${myType}_${number_pack}.txt
+            ncdump -h ${file} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> liste_variables_${myType}_${number_pack}.txt
+            (( nbfile = nbfile + 1 ))
+          fi
+        done
+        # Select list of variables to work with
+        list_var=$( cat liste_variables_${myType}_${number_pack}.txt | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 != nbfile) {print $2}}' | paste -s -d ',' )
+        liste_file_tmp=$( for i in $( cat liste_pack_${myType}_${number_pack}.txt ) ; do basename $i ; done )
+        # Create packed files
+        IGCM_debug_Print 1 "Ncrcat ongoing for ${dir} and ${myType}"
+        output=${JobName}_${date_begin_pack}_${date_end_pack}_${myType}
+        #cat liste_pack_${myType}_${number_pack}.txt | xargs ncrcat -v ${list_var} -o ${output}
+        if [ X${list_var} = X ] ; then
+          IGCM_sys_ncrcat -p ${dir} ${liste_file_tmp} --output ${output}
+        else
+          IGCM_sys_ncrcat -x -v ${list_var} -p ${dir} ${liste_file_tmp} --output ${output}
+        fi
+        # ------------------------------------------------------------------
+        # Test if all was right before proceeding further
+        # ------------------------------------------------------------------
+        IGCM_debug_Verif_Exit_Post
+        # Save it
+        IGCM_sys_Put_Out ${output} ${R_SAVE}/$( echo $dir | sed "s:${R_BUFR}/::" )/${output}
+        # ------------------------------------------------------------------
+        # Test if all was right before proceeding further
+        # ------------------------------------------------------------------
+        IGCM_debug_Verif_Exit_Post
+        # Clean file produced by ncrcat
+        IGCM_sys_Rm ${output}
+        # Clean files used by ncrcat
+        cat liste_pack_${myType}_${number_pack}.txt | xargs rm
+        # Save the list of files that has been pack (ncrcat)
+        mv liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt ${STORE_DEBUG}
+        IGCM_debug_Print 1 "Ncrcat and cleaning done for ${dir} and ${myType}"
+      done
+    done
+  done
+  (( number_pack = number_pack + 1 ))
+  # Add 1 day to date_end_pack to have the new date_begin_pack
+  date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 )
+done
+
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
+
+date
Index: /branches/libIGCM_MPI_OpenMP/AA_pack_restart
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_pack_restart	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_pack_restart	(revision 592)
@@ -3,5 +3,5 @@
 #-Q- cesium ## CESIUM   CEA ##
 #-Q- cesium ######################
-#-Q- cesium #MSUB -r PACKRESTART    # Nom du job                
+#-Q- cesium #MSUB -r PACKRESTART    # Nom du job
 #-Q- cesium #MSUB -N 1              # Reservation du noeud
 #-Q- cesium #MSUB -n 1              # Reservation du processus
@@ -27,5 +27,5 @@
 #-Q- sx8brodie # Nom du travail LoadLeveler
 #-Q- sx8brodie # @ job_name   = PACKRESTART
-#-Q- sx8brodie # Fichier de sortie standard du travail       
+#-Q- sx8brodie # Fichier de sortie standard du travail
 #-Q- sx8brodie # @ output     = $(job_name).$(jobid)
 #-Q- sx8brodie # Fichier de sortie d'erreur du travail
@@ -81,5 +81,5 @@
 #-Q- sx9mercure ## CESIUM   CEA ##
 #-Q- sx9mercure ######################
-#-Q- sx9mercure #MSUB -r PACKRESTART    # Nom du job                
+#-Q- sx9mercure #MSUB -r PACKRESTART    # Nom du job
 #-Q- sx9mercure #MSUB -N 1              # Reservation du noeud
 #-Q- sx9mercure #MSUB -n 1              # Reservation du processus
@@ -91,5 +91,5 @@
 #-Q- titane ## TITANE   CEA     ##
 #-Q- titane ######################
-#-Q- titane #MSUB -r PACKRESTART    # Nom du job                
+#-Q- titane #MSUB -r PACKRESTART    # Nom du job
 #-Q- titane #MSUB -eo
 #-Q- titane #MSUB -n 1              # Reservation du processus
@@ -178,15 +178,15 @@
 #RESTART/ATM_****.nc
 #RESTART/OCE_****.nc
-#Attention de bien conserver les dates d'origines 
+#Attention de bien conserver les dates d'origines
 #
 #Dans le cadre de la production nouvelle chaine
 #ils auront directement le bon nom
 #
-#On veut egalement que l'archive soit par periode de temps 
-# cette periode est definie par la taille du pack donc connue 
-# en entree du script (1M, 1Y, 5Y, 10Y etc...) 
-#
-# $1= PATH/config_card d'une simulation avec 
-# TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd/PATH_SIMUL
+#On veut egalement que l'archive soit par periode de temps
+# cette periode est definie par la taille du pack donc connue
+# en entree du script (1M, 1Y, 5Y, 10Y etc...)
+#
+# $1= PATH/config_card d'une simulation avec
+# TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd
 # $2=PeriodPack en M/m ou Y/y
 
@@ -223,10 +223,8 @@
 fi
 
-#
+#====================================================
 # First of all
 #
-#### 0- lecture de config.card 
-#### on veut les renseignements suivants : 
-#### JobName, PATH_SIMUL, DateBegin et DateEnd
+# Read config.card
 
 IGCM_card_DefineArrayFromSection     ${CARD_DIR}/config.card UserChoices
@@ -250,6 +248,8 @@
 
 #====================================================
-#R_SAVE : Job output storage directory
-#R_BUFR : Job output buffered directory
+# Prepare environment
+#R_SAVE        : Job output storage directory
+#R_BUFR        : Job output buffered directory
+#STORE_RESTART : Where we store tar files
 
 if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
@@ -264,20 +264,15 @@
 [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
 
-#### Preparation de l'environnement
-# repertoire dans lequel seront crees les archives
-#STORE_RESTART=/scratch/cont003/p86denv/Pack_Test/RESTART
+#STORE_RESTART=/ccc/store/cont003/dsm/p86denv/.../RESTART
 STORE_RESTART=${R_SAVE}/RESTART
 IGCM_sys_MkdirArchive ${STORE_RESTART}
 
+#cd ${STORE_RESTART}
+#rm -f *
+
 # Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure)
 JobName=${config_UserChoices_JobName}
-PATH_SIMUL=${R_BUFR}
-echo $JobName $PATH_SIMUL $DateBegin $DateEnd
-
-#### 1- renommer les fichiers ######
-#cd ${STORE_RESTART}
-#rm -rf *
-
-# On les copie sur le scratchdir en changeant le nom et conservant la date
+echo $JobName $R_BUFR $DateBegin $DateEnd
+
 # Clear txt file lists
 rm -f ${RUN_DIR}/liste_restart_files.txt
@@ -286,5 +281,5 @@
 
 # Create sorted restart list to work with
-find ${PATH_SIMUL}/*/Restart -name "*nc" | sort >> ${RUN_DIR}/liste_restart_files.txt
+find ${R_BUFR}/*/Restart -name "*nc" | sort >> ${RUN_DIR}/liste_restart_files.txt
 
 # Rename restart files we will work with using symlinks
@@ -312,18 +307,17 @@
   IGCM_debug_PrintVariables 3 number_pack
 
-  DaysTemp=$( IGCM_date_DaysInNextPeriod ${date_begin_pack} ${PeriodPack} )
-  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} ${DaysTemp} )
+  DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack} )
+  date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) )
 
   for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_restart_files.txt ); do
     extract_date_file=$( echo ${file}  | sed -e "s/.*${JobName}_//" )
     date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' )
-#   echo pack nÂ°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack} 
-    if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 
-        echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt
-	echo $( ls -L ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt
-
-#    Will not work. Need to find a better ordering.
-#    elif [ ${date_file} -ge ${date_end_pack} ] ; then
-#      break
+#   echo pack nÂ°${number_pack}  ${date_file} ${date_begin_pack} ${date_end_pack}
+    if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then
+      echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt
+      echo $( readlink ${file} ) >> ${RUN_DIR}/liste_remove_pack_${number_pack}.txt
+#   Will not work. Need to find a better ordering.
+#   elif [ ${date_file} -ge ${date_end_pack} ] ; then
+#     break
     fi
   done
@@ -350,2 +344,7 @@
 
 done
+
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
+IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
+
+date
Index: /branches/libIGCM_MPI_OpenMP/AA_rebuild_fromArchive
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_rebuild_fromArchive	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_rebuild_fromArchive	(revision 592)
@@ -275,4 +275,6 @@
 done
 
-# Clean RUN_DIR_PATH (necessary for cesium only)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
+
+date
Index: /branches/libIGCM_MPI_OpenMP/AA_rebuild_fromWorkdir
===================================================================
--- /branches/libIGCM_MPI_OpenMP/AA_rebuild_fromWorkdir	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/AA_rebuild_fromWorkdir	(revision 592)
@@ -275,4 +275,6 @@
 done
 
-# Clean RUN_DIR_PATH (necessary for cesium only)
+# Clean RUN_DIR_PATH (necessary for cesium and titane only)
 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
+
+date
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_comp/libIGCM_comp.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_comp/libIGCM_comp.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_comp/libIGCM_comp.ksh	(revision 592)
@@ -482,6 +482,11 @@
 	eval file_out=${file_out_}
 
-	IGCM_sys_Get ${file_in} ${file_out}
-	IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+	IGCM_sys_IsFileArchived ${file_in}
+	if [ $? = 0 ] ; then
+	  IGCM_sys_Get ${file_in} ${file_out}
+	  #IGCM_comp_PrepareDeletedFiles ${file_in} ${file_out}
+	else
+	  IGCM_sys_Cp ${file_in} ${file_out}
+	fi
 
 	(( i=i+2 ))
@@ -603,5 +608,6 @@
   echo
 
-  typeset Date_tmp Date_r Path_r do_start CompOldName Path_OUT Path_BUF Buffered
+  typeset Date_tmp Date_r Path_r do_start CompOldName Path_OUT Path_BUF
+  typeset Buffered Archived Tared PotentialTarFile IsMatching TarFileFound
   typeset comp compname comptagname card ListFilesName FileName0 NbFiles i i_ 
   typeset file_in file_out file_in_ file_out_ file_in_Name
@@ -632,5 +638,5 @@
 	eval CompOldName=${comp}
       else
-	        # Read component Restarts parameters
+	# Read component Restarts parameters
 	IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card ${comp} Restart
 	eval do_start=\${config_${comp}_Restart} > /dev/null 2>&1
@@ -726,9 +732,32 @@
 
 	  if [ -f ${Path_BUF}*.nc ] ; then
+	    IGCM_debug_Print 3 "Buffered restart"
 	    Buffered=true
+	    Archived=false
+	    Tared=false
 	    nb_restart_file=$(IGCM_sys_CountFileBuffer ${Path_BUF}_????.nc)
+	  elif [ -f ${Path_OUT}*.nc ] ; then
+	    IGCM_debug_Print 3 "Archived restart"
+	    Buffered=false
+	    Archived=true
+	    Tared=false
+	    nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_OUT}_????.nc)
 	  else
+	    IGCM_debug_Print 3 "Tared restart"
 	    Buffered=false
-	    nb_restart_file=$(IGCM_sys_CountFileArchive ${Path_OUT}_????.nc)
+	    Archived=false
+	    Tared=true
+	    # Look after the tar file we want if we did not found it already
+	    if [ X${IsMatching} = X ] ; then
+	      for PotentialTarFile in $( find ${R_SAVE}/RESTART -name "${config_UserChoices_JobName}_*_restart.tar" ) ; do
+		IsMatching=$( echo ${PotentialTarFile} | sed "s:^${config_UserChoices_JobName}_::" | sed "s:\.restart\.tar$::" | gawk -F_ -v restartdate=${LastPeriodDateEnd} '{if (($1 < restartdate) && ($2 > restartdate)) {print $1"_"$2}}' )
+		if [ ! X${IsMatching} = X ] ; then
+		  TarFileFound=${PotentialTarFile}
+		  break
+		fi
+	      done
+	    fi
+	    tar xvf ${TarFileFound} ${comp}_${generic_restart_file_name_in}*.nc
+	    nb_restart_file=$( IGCM_sys_CountFileBuffer ${comp}_${generic_restart_file_name_in}_????.nc )
 	  fi
 
@@ -739,6 +768,8 @@
 	      if [ X${Buffered} = Xtrue ] ; then
 		IGCM_sys_GetBuffer ${Path_BUF}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
-	      else
+	      elif [ X${Archived} = Xtrue ] ; then
 		IGCM_sys_Get ${Path_OUT}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
+	      elif [ X${Tared} = Xtrue ] ; then
+		IGCM_sys_Mv ${comp}_${generic_restart_file_name_in}_${j4}.nc ${generic_restart_file_name_out}_${j4}.nc
 	      fi
 	      (( j=j+1 ))
@@ -747,9 +778,10 @@
 	    if [ X${Buffered} = Xtrue ] ; then
 	      eval IGCM_sys_GetBuffer \${R_BUF_${comp}_R}/${file_in_Name} ${file_out}
-	    else
+	    elif [ X${Archived} = Xtrue ] ; then
 	      eval IGCM_sys_Get \${R_OUT_${comp}_R}/${file_in_Name} ${file_out}
-	    fi
-	  fi
-
+	    elif [ X${Tared} = Xtrue ] ; then
+	      IGCM_sys_Mv ${comp}_${file_in_Name} ${file_out}
+	    fi
+	  fi
 	  (( i=i+3 ))
 	done
@@ -919,9 +951,9 @@
 	  until [ $j -ge $nb_restart_file ]; do
 	    j4=${j}
-            if [ X${Pack} = Xtrue ] ; then
+	    if [ X${Pack} = Xtrue ] ; then
 	      eval IGCM_sys_PutBuffer_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_BUF_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
-            else
-	      eval IGCM_sys_Put_Rest       ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
-            fi
+	    else
+	      eval IGCM_sys_Put_Rest ${generic_restart_file_name_in}_${j4}.nc \${R_OUT_${comp}_R}/${generic_restart_file_name_out}_${j4}.nc
+	    fi
 	    if [ ! ${file_in} = ${file_outin} ] ; then
 	      if ( ${ExitFlag} ) ; then
@@ -934,9 +966,9 @@
 	  done
 	else
-          if [ X${Pack} = Xtrue ] ; then
+	  if [ X${Pack} = Xtrue ] ; then
 	    eval IGCM_sys_PutBuffer_Rest ${file_in} \${R_BUF_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
-          else
-  	    eval IGCM_sys_Put_Rest       ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
-          fi
+	  else
+	    eval IGCM_sys_Put_Rest ${file_in} \${R_OUT_${comp}_R}/${config_UserChoices_JobName}_${PeriodDateEnd}_${file_out}
+	  fi
 	  if [ ! ${file_in} = ${file_outin} ] ; then
 	    if ( ${ExitFlag} ) ; then
@@ -976,4 +1008,13 @@
 	eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
 	eval file_out=${file_out_}
+	#
+	# Override file_out path remplacing R_SAVE by R_BUFR
+	#
+	if [ X${Pack} = Xtrue ] ; then
+	  file_out=$( echo $file_out | sed "s:^$R_SAVE:$R_BUFR:" )
+	fi
+	#
+	# Not necessarily the best option. /!\ Potential side effects /!\
+	#
 	(( i_ = i+2 ))
 	eval flag_post=\${${ListFilesName}[$i_]} > /dev/null 2>&1
@@ -1006,4 +1047,5 @@
 		echo "echo                                              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 		echo "export R_SAVE=${R_SAVE}                           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "export R_BUFR=${R_BUFR}                           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 		echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 	      fi
@@ -1027,5 +1069,9 @@
 	    #
 	    if [ $DRYRUN -le 1 ]; then
-	      echo "IGCM_sys_Put_Out ${file_in} ${file_out}             " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      if [ X${Pack} = Xtrue ] ; then
+		echo "IGCM_sys_PutBuffer_Out ${file_in} ${file_out}     " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      else
+		echo "IGCM_sys_Put_Out ${file_in} ${file_out}           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      fi
 	      echo "IGCM_debug_Verif_Exit_Post                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 	      echo "IGCM_sys_Rm ${generic_file_name}_*.nc               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
@@ -1066,5 +1112,9 @@
 	      done
 	      #
-	      echo "IGCM_sys_Put_Out ${file_in} ${file_out}           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      if [ X${Pack} = Xtrue ] ; then
+		echo "IGCM_sys_PutBuffer_Out ${file_in} ${file_out}   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      else
+		echo "IGCM_sys_Put_Out ${file_in} ${file_out}         " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      fi
 	      echo "IGCM_debug_Verif_Exit_Post                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
 	      #
@@ -1074,5 +1124,9 @@
 	    # No Patch, No Asynchronous rebuild, online rebuild has been done or was not needed
 	    #
-	    IGCM_sys_Put_Out ${file_in} ${file_out}
+	    if [ X${Pack} = Xtrue ] ; then
+	      IGCM_sys_PutBuffer_Out ${file_in} ${file_out}
+	    else
+	      IGCM_sys_Put_Out ${file_in} ${file_out}
+	    fi
 	    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
 	    if [ ${nb_rebuild_file} -gt 1 ] ; then
@@ -1130,8 +1184,8 @@
 	      done
 	      if [ X${Pack} = Xtrue ] ; then
-	        eval IGCM_sys_PutBuffer_Out ${file_out} \${R_BUF_${comp}_D}/${file_out}
-              else
-	        eval IGCM_sys_Put_Out       ${file_out} \${R_OUT_${comp}_D}/${file_out}
-              fi
+		eval IGCM_sys_PutBuffer_Out ${file_out} \${R_BUF_${comp}_D}/${file_out}
+	      else
+		eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}_D}/${file_out}
+	      fi
 	      eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_out}" > /dev/null 2>&1
 
@@ -1144,7 +1198,7 @@
 		if [ X${Pack} = Xtrue ] ; then
 		  eval IGCM_sys_PutBuffer_Out ${file} \${R_BUF_${comp}_D}/${PREFIX}_${file}
-                else
-		  eval IGCM_sys_Put_Out       ${file} \${R_OUT_${comp}_D}/${PREFIX}_${file}
-                fi
+		else
+		  eval IGCM_sys_Put_Out ${file} \${R_OUT_${comp}_D}/${PREFIX}_${file}
+		fi
 		eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file}" > /dev/null 2>&1
 
@@ -1160,7 +1214,7 @@
 	    if [ X${Pack} = Xtrue ] ; then
 	      eval IGCM_sys_PutBuffer_Out ${file_in} \${R_BUF_${comp}_D}/${file_out}
-            else
-	      eval IGCM_sys_Put_Out       ${file_in} \${R_OUT_${comp}_D}/${file_out}
-            fi
+	    else
+	      eval IGCM_sys_Put_Out ${file_in} \${R_OUT_${comp}_D}/${file_out}
+	    fi
 	    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
 
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_config/libIGCM_config.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_config/libIGCM_config.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_config/libIGCM_config.ksh	(revision 592)
@@ -61,4 +61,5 @@
 
   #==================================
+  # Read UserChoices section: 
   IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card UserChoices
 
@@ -88,5 +89,21 @@
 
   #==================================
-
+  # Read Post section: 
+  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 default value to keep compatibility with previous card: means before changes due to TGCC 
+  [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency}
+
+  #==================================
+  # Read ListOfComponents section: 
   IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents
   for comp in ${config_ListOfComponents[*]} ; do
@@ -189,8 +206,10 @@
     FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
     R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
+    R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
     R_BUFR=${R_BUF}/${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_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
     R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
@@ -218,21 +237,4 @@
     fi
   fi
-
-  #==================================
-  # Read Post section: 
-  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 default value to keep compatibility with previous card: means before changes due to TGCC 
-  [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency}
 
   #====================================================
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_date/libIGCM_date.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_date/libIGCM_date.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_date/libIGCM_date.ksh	(revision 592)
@@ -944,4 +944,54 @@
 }
 
+#D-#==================================================================
+#D-function IGCM_date_DaysInCurrentPeriod ()
+#D-* Purpose: Give the numbers of days during the Current prd1 period from grg1 date 
+#D-* Usage: IGCM_date_DaysInCurrentPeriod grg1 prd1
+#D-         where grg1 gregorian date is in the form yyyymmdd
+#D-         where prd1 period is in the form N[Yy], N[Mm], N[Dd]. N integer
+#D-
+function IGCM_date_DaysInCurrentPeriod {
+  IGCM_debug_PushStack "IGCM_date_DaysInCurrentPeriod" $@
+  typeset Length Period
+  Period=${2}
+  case ${Period} in
+  *Y|*y) 
+    PeriodLengthInYears=$( echo ${Period} | 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 )) ) )) 
+      (( i=i+1 ))
+    done
+    ;;
+  *M|*m) 
+    PeriodLengthInMonths=$( echo ${Period} | awk -F '[mM]' '{print $1}' )
+    IGCM_date_GetYearMonth ${1} year month
+    year=$( IGCM_date_SupressZeros ${year} )
+    (( year0 = year ))
+    (( 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 ${Period} | sed -e "s/[dD]//" ) ;;
+  *)
+    IGCM_debug_Exit "IGCM_date_DaysInCurrentPeriod " ${Period} " invalid PeriodLength : choose in *Y, *M, *D."
+    IGCM_debug_Verif_Exit_Post ;;
+  esac
+  echo ${Length}
+
+  IGCM_debug_PopStack "IGCM_date_DaysInCurrentPeriod"
+}
 
 #D-#==================================================================
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_post/IGCM_Patch_20091118_mask.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_post/IGCM_Patch_20091118_mask.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_post/IGCM_Patch_20091118_mask.ksh	(revision 592)
@@ -20,5 +20,16 @@
     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 .
+    if [ ! -f ${config_UserChoices_JobName}_mesh_mask.nc ] ; then
+      if [ -f ${R_BUFR}/OCE/Output/${config_UserChoices_JobName}_mesh_mask.nc ] ; then
+	IGCM_sys_GetBuffer ${R_BUFR}/OCE/Output/${config_UserChoices_JobName}_mesh_mask.nc .
+      elif [ -f ${R_SAVE}/OCE/Output/${config_UserChoices_JobName}_mesh_mask.nc ] ; then
+	IGCM_sys_Get ${R_SAVE}/OCE/Output/${config_UserChoices_JobName}_mesh_mask.nc .
+      else
+	IGCM_debug_Exit "mesh_mask can not be found. Stop."
+	IGCM_debug_Exit "neither here ${R_SAVE}/OCE/Output/${config_UserChoices_JobName}_mesh_mask.nc"
+	IGCM_debug_Exit "nor here ${R_BUFR}/OCE/Output/${config_UserChoices_JobName}_mesh_mask.nc"
+	IGCM_debug_Verif_Exit_Post
+      fi
+    fi
 
     filename=${1}
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_post/libIGCM_post.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_post/libIGCM_post.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_post/libIGCM_post.ksh	(revision 592)
@@ -248,5 +248,5 @@
 	  [ $(( ( ${YearEnd} - ${YearBegin} + 1 ) % ${YearsChunckLength} )) = 0 ] && NbYearsChunckLoop=$(( ${NbYearsChunckLoop} - 1 ))
 	  # Starting Year of the current chunck
-	  ChunckTsYearBegin=$(( ${NbYearsChunckLoop} *  ${YearsChunckLength} + ${YearBegin} ))
+	  ChunckTsYearBegin=$(( ${NbYearsChunckLoop} * ${YearsChunckLength} + ${YearBegin} ))
 	  # Starting date of the current chunck
 	  ChunckTsDateBegin=${ChunckTsYearBegin}${MonthBegin}01
@@ -415,4 +415,130 @@
   fi
 
+  #============== PACK PROCESSING FOR RESTART AND DEBUG FILES =============#
+  if [ ${PackFrequency} = true ] ; then
+    IGCM_debug_Print 1 "PACK POST-PROCESSING"
+    echo
+    ## Need to Remember This One
+    SavedDateBegin=${DateBegin}
+    ## Need to Remember This One
+    SavedDateEnd=${DateEnd}
+    #
+    DaysTemp=$(( $( IGCM_date_DaysInPreviousPeriod ${PeriodDateEnd} ${config_Post_PackFrequency} end ) - 1 ))
+    #
+    PackDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} -${DaysTemp} )
+    #
+    script=pack_debug
+    #
+    Script_Post_Output=${script}.${PeriodDateEnd}
+    #
+    listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,DateBegin,DateEnd,PeriodPack,StandAlone"
+    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 DateBegin=${PackDateBegin}
+    export DateEnd=${PeriodDateEnd}
+    export PeriodPack=${config_Post_PackFrequency}
+    export StandAlone=false
+    export listVarEnv=${listVarEnv}
+    export Script_Post_Output=${Script_Post_Output}
+    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit_Post
+    IGCM_sys_QsubPost ${script}
+EOF
+    #
+    script=pack_restart
+    #
+    Script_Post_Output=${script}.${PeriodDateEnd}
+    #
+    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 DateBegin=${PackDateBegin}
+    export DateEnd=${PeriodDateEnd}
+    export PeriodPack=${config_Post_PackFrequency}
+    export StandAlone=false
+    export listVarEnv=${listVarEnv}
+    export Script_Post_Output=${Script_Post_Output}
+    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit_Post
+    IGCM_sys_QsubPost ${script}
+EOF
+    #
+    script=pack_output
+    #
+    Script_Post_Output=${script}.${PeriodDateEnd}
+    #
+    if [ ${RebuildFrequency} = true ] ; then
+      #
+      if [ -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+	#
+#	if [ X${MASTER} = Xtitane ] ; then
+#	  echo "IGCM_sys_RshPost <<-EOF"                     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	fi
+	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 DateBegin=${PackDateBegin}              " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export DateEnd=${PeriodDateEnd}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export PeriodPack=${config_Post_PackFrequency} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export StandAlone=false                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export listVarEnv=${listVarEnv}                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export Script_Post_Output=${Script_Post_Output}" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "export script=${script}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	if [ X${MASTER} = Xtitane ] ; then
+#	  echo ". ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	  echo ". ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh"     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	fi
+	echo "IGCM_sys_MkdirWork ${POST_DIR}                 " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "IGCM_debug_Verif_Exit_Post                     " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	echo "IGCM_sys_QsubPost ${script}                    " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	if [ X${MASTER} = Xtitane ] ; then
+#	  echo "EOF"                                         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+#	fi
+      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 DateBegin=${PackDateBegin}
+    export DateEnd=${PeriodDateEnd}
+    export PeriodPack=${config_Post_PackFrequency}
+    export StandAlone=false
+    export listVarEnv=${listVarEnv}
+    export Script_Post_Output=${Script_Post_Output}
+    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
+    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
+    IGCM_sys_MkdirWork ${POST_DIR}
+    IGCM_debug_Verif_Exit_Post
+    IGCM_sys_QsubPost ${script}
+EOF
+    export DateBegin=${SavedDateBegin}
+    export DateEnd=${SavedDateEnd}
+    fi
+  fi
+
   #============== REBUILD POST-PROCESSING =============#
   if [ X${AsynchronousRebuild} = Xtrue ] ; then
@@ -476,72 +602,4 @@
     IGCM_sys_QsubPost ${script}
 EOF
-  fi
-
-  #============== PACK PROCESSING FOR RESTART AND DEBUG FILES =============#
-  if [ ${PackFrequency} = true ] ; then
-    IGCM_debug_Print 1 "PACK POST-PROCESSING"
-    echo
-    ## Need to Remember This One
-    SavedDateBegin=${DateBegin}
-    ## Need to Remember This One
-    SavedDateEnd=${DateEnd}
-    #
-    DaysTemp=$(( $( IGCM_date_DaysInPreviousPeriod ${PeriodDateEnd} ${config_Post_PackFrequency} end ) - 1 ))
-    #
-    PackDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} -${DaysTemp} )
-    #
-    script=pack_debug
-    #
-    Script_Post_Output=${script}.${PeriodDateEnd}
-    #
-    listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,MASTER,DateBegin,DateEnd,PeriodPack,StandAlone"
-    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 DateBegin=${PackDateBegin}
-    export DateEnd=${PeriodDateEnd}
-    export PeriodPack=${config_Post_PackFrequency}
-    export StandAlone=false
-    export listVarEnv=${listVarEnv}
-    export Script_Post_Output=${Script_Post_Output}
-    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
-    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
-    IGCM_sys_MkdirWork ${POST_DIR}
-    IGCM_debug_Verif_Exit_Post
-    IGCM_sys_QsubPost ${script}
-EOF
-    #
-    script=pack_restart
-    #
-    Script_Post_Output=${script}.${PeriodDateEnd}
-    #
-    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 DateBegin=${PackDateBegin}
-    export DateEnd=${PeriodDateEnd}
-    export PeriodPack=${config_Post_PackFrequency}
-    export StandAlone=false
-    export listVarEnv=${listVarEnv}
-    export Script_Post_Output=${Script_Post_Output}
-    . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
-    . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
-    IGCM_sys_MkdirWork ${POST_DIR}
-    IGCM_debug_Verif_Exit_Post
-    IGCM_sys_QsubPost ${script}
-EOF
-
-    export DateBegin=${SavedDateBegin}
-    export DateEnd=${SavedDateEnd}
   fi
   IGCM_debug_PopStack "IGCM_post_Submit"
@@ -610,5 +668,5 @@
   *M|*m)
     PeriodMasterMonth=$( echo ${MasterFrequency} | sed -e "s/[mM]//" )
-    case ${SlaveFrequency} in		    
+    case ${SlaveFrequency} in
     *Y|*y)
       PeriodSlaveYear=$( echo ${SlaveFrequency} | sed -e "s/[yY]//" )
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_cesium.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 592)
@@ -112,6 +112,11 @@
 
 #====================================================
-#- ARCHIVE
-typeset -r ARCHIVE=${DMFDIR}
+#- ARCHIVE (dedicated to large files)
+typeset -r ARCHIVE=${CCCSTOREDIR}
+
+#- ARCHIVE (dedicated to small/medium files)
+typeset -r STORAGE=${CCCWORKDIR}
+
+#====================================================
 
 #====================================================
@@ -123,4 +128,8 @@
 #- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- R_FIG (hosting figures : monitoring and atlas, and/or small files)
+typeset -r R_FIG=${STORAGE}/IGCM_OUT
 
 #====================================================
@@ -895,5 +904,5 @@
     # USUAL WAY
     # add dmfind/dmget (to demigrate all offline files) :
-    dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
+    #dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
     \cp -r $1 $2 > out_rsync 2>&1
     RET=$?
@@ -1066,5 +1075,6 @@
     if [ -f $2 ] ; then
       IGCM_debug_Print 1 "$2 already exist"
-      dmget $2
+      #dmget $2
+      ccc_hsm get $2
       exist=true
       if [ "X$( diff $1 $2 )" = X ] ; then
@@ -1161,5 +1171,6 @@
     fi
 
-    dmget ${dm_liste[*]} > out_rsync 2>&1
+    #dmget ${dm_liste[*]} > out_rsync 2>&1
+    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     RET=$?
     if [ ${RET} -gt 0 ] ; then
@@ -1174,5 +1185,6 @@
     #	sleep 30
     #	echo "We try another time"
-    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    ##	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     #	RET=$?
     #	if [ ${RET} -gt 0 ] ; then
@@ -1315,10 +1327,12 @@
   RET=0
   if [ $DRYRUN = 0 ]; then
-    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
-      echo "Nothing has been done."
-      return
-    fi
-    dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
+
+#    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
+#      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
+#      echo "Nothing has been done."
+#      return
+#    fi
+
+    /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
     RET=$?
     
@@ -1348,12 +1362,13 @@
   typeset RET
   RET=0
-  if [ $DRYRUN = 0 ]; then
-    if [ ! -d ${R_SAVE}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
-      echo "Nothing has been done."
-      return
-    fi
-    #
-    dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
+
+#  if [ $DRYRUN = 0 ]; then
+#    if [ ! -d ${R_SAVE}/${1} ] ; then
+#      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
+#      echo "Nothing has been done."
+#      return
+#    fi
+
+    /ccc/cont003/home/dsm/p86maf/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
     RET=$?
 
@@ -1382,14 +1397,29 @@
     echo "IGCM_sys_Put_Dods :" $@
   fi
+  typeset RET
   if [ $DRYRUN = 0 ]; then
-    if [ ! -d ${R_SAVE}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+
+    if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then
+      echo "WARNING IGCM_sys_Put_Dods : None of the following directories exist. Exactly one should."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} DOES NOT EXIST."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} DOES NOT EXIST."
       IGCM_debug_PopStack "IGCM_sys_Put_Dods"
       return
     fi
 
-    typeset RET
-	#
-    cd ${R_SAVE}
+    if ( [ -d ${R_SAVE}/${1} ] && [ -d ${R_FIGR}/${1} ] ) ; then
+      echo "WARNING IGCM_sys_Put_Dods : Both of the following directories exist. Exactly one should."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} EXISTS."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} EXISTS."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+      return
+    fi
+    #
+    if [ -d ${R_SAVE}/${1} ] ; then
+      cd ${R_SAVE}
+    elif [ -d ${R_FIGR}/${1} ] ; then
+      cd ${R_FIGR}
+    fi
+
     IGCM_sys_Dods_Rm ${1}
     IGCM_sys_Dods_Cp ${1}
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercure.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 592)
@@ -102,6 +102,9 @@
 
 #====================================================
-#- ARCHIVE
-typeset -r ARCHIVE=${DMFDIR}
+#- ARCHIVE (dedicated to large files)
+typeset -r ARCHIVE=${CCCSTOREDIR}
+
+#- ARCHIVE (dedicated to small/medium files)
+typeset -r STORAGE=${CCCWORKDIR}
 
 #====================================================
@@ -113,4 +116,8 @@
 #- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- R_FIG (hosting figures : monitoring and atlas, and/or small files)
+typeset -r R_FIG=${STORAGE}/IGCM_OUT
 
 #====================================================
@@ -532,5 +539,5 @@
     echo "IGCM_sys_QsubPost :" $@
   fi
-  /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
+  /usr/bin/nqsII/qsub -q scalaire -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
   if [ $? -gt 0 ] ; then
     echo "IGCM_sys_QsubPost : erreur " $@
@@ -833,5 +840,6 @@
     #USUAL WAY
     # add dmget (to demigrate all offline files) to reduce time of this command :
-    dmget $1/*
+    #dmget $1/*
+    ccc_hsm get $1/*
     \cp -r $1 $2 > out_rsync 2>&1
     RET=$?
@@ -1027,5 +1035,6 @@
     if [ -f $2 ] ; then
       IGCM_debug_Print 1 "$2 already exist"
-      dmget $2
+      #dmget $2
+      ccc_hsm get $2
       exist=true
       if [ "X$( diff $1 $2 )" = X ] ; then
@@ -1166,5 +1175,6 @@
     fi
 
-    dmget ${dm_liste[*]} > out_rsync 2>&1
+    #dmget ${dm_liste[*]} > out_rsync 2>&1
+    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     RET=$?
     if [ ${RET} -gt 0 ] ; then
@@ -1180,5 +1190,6 @@
     #	sleep 30
     #	echo "We try another time"
-    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    ##	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     #	RET=$?
     #	if [ ${RET} -gt 0 ] ; then
@@ -1321,10 +1332,12 @@
   RET=0
   if [ $DRYRUN = 0 ]; then
-    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
-      echo "Nothing has been done."
-      return
-    fi
-    dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
+
+#    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
+#      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
+#      echo "Nothing has been done."
+#      return
+#    fi
+
+    /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
     RET=$?
     
@@ -1355,11 +1368,12 @@
   RET=0
   if [ $DRYRUN = 0 ]; then
-    if [ ! -d ${R_SAVE}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
-      echo "Nothing has been done."
-      return
-    fi
-    #
-    dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
+
+#    if [ ! -d ${R_SAVE}/${1} ] ; then
+#      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
+#      echo "Nothing has been done."
+#      return
+#    fi
+
+    /ccc/cont003/home/dsm/p86maf/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
     RET=$?
 
@@ -1388,14 +1402,28 @@
     echo "IGCM_sys_Put_Dods :" $@
   fi
+  typeset RET
   if [ $DRYRUN = 0 ]; then
-    if [ ! -d ${R_SAVE}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+    if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then
+      echo "WARNING IGCM_sys_Put_Dods : None of the following directories exist. Exactly one should."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} DOES NOT EXIST."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} DOES NOT EXIST."
       IGCM_debug_PopStack "IGCM_sys_Put_Dods"
       return
     fi
 
-    typeset RET
-	#
-    cd ${R_SAVE}
+    if ( [ -d ${R_SAVE}/${1} ] && [ -d ${R_FIGR}/${1} ] ) ; then
+      echo "WARNING IGCM_sys_Put_Dods : Both of the following directories exist. Exactly one should."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} EXISTS."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} EXISTS."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+      return
+    fi
+    #
+    if [ -d ${R_SAVE}/${1} ] ; then
+      cd ${R_SAVE}
+    elif [ -d ${R_FIGR}/${1} ] ; then
+      cd ${R_FIGR}
+    fi
+
     IGCM_sys_Dods_Rm ${1}
     IGCM_sys_Dods_Cp ${1}
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex8.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex8.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex8.ksh	(revision 592)
@@ -89,4 +89,34 @@
 #====================================================
 
+# ============ CESIUM START ============ #
+
+#====================================================
+#- Mirror libIGCM from mercure to cesium if needed
+#ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' )
+#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}
+
 #====================================================
 #- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
@@ -98,36 +128,9 @@
 
 #====================================================
-#- 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}
+#- ARCHIVE (dedicated to large files)
+typeset -r ARCHIVE=${CCCSTOREDIR}
+
+#- ARCHIVE (dedicated to small/medium files)
+typeset -r STORAGE=${CCCWORKDIR}
 
 #====================================================
@@ -139,4 +142,8 @@
 #- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- R_FIG (hosting figures : monitoring and atlas, and/or small files)
+typeset -r R_FIG=${STORAGE}/IGCM_OUT
 
 #====================================================
@@ -271,15 +278,4 @@
     status=completed
   fi
-
-  ssh ${MASTER} /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}
-  export status=${status}
-
   cat  << END_MAIL > job_end.mail
   Dear ${LOGIN},
@@ -296,9 +292,7 @@
   elif [ -f ~/.forward ] ; then
     mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
-  fi
-
-  sleep 10
-  rm -f job_end.mail
-EOF
+  else
+    mailx -s "${config_UserChoices_JobName} ${status}" ${LOGIN} < job_end.mail
+  fi
 
   if [ $? -gt 0 ] ; then
@@ -627,10 +621,9 @@
 # ============ FRONTEND START ============ #
 
-  /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
+  /usr/bin/nqsII/qsub -q scalaire -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
 
 # ============ FRONTEND  END  ============ #
 
 # ============ CESIUM START ============ #
-
 #  typeset NB_ESSAI DELAI status i
 #  # number of tentative
@@ -649,5 +642,4 @@
 #    (( i = i + 1 ))
 #  done 
-
 # ============ CESIUM  END  ============ #
 
@@ -956,5 +948,5 @@
     # USUAL WAY
     # add dmfind/dmget (to demigrate all offline files) :
-    dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
+    #dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
     \cp -r $1 $2 > out_rsync 2>&1
     RET=$?
@@ -1233,5 +1225,6 @@
     fi
 
-    dmget ${dm_liste[*]} > out_rsync 2>&1
+    #dmget ${dm_liste[*]} > out_rsync 2>&1
+    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     RET=$?
     if [ ${RET} -gt 0 ] ; then
@@ -1247,5 +1240,6 @@
     #	sleep 30
     #	echo "We try another time"
-    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    ##	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     #	RET=$?
     #	if [ ${RET} -gt 0 ] ; then
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex9.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 592)
@@ -89,4 +89,34 @@
 #====================================================
 
+# ============ CESIUM START ============ #
+
+#====================================================
+#- Mirror libIGCM from mercure to cesium if needed
+#ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' )
+#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}
+
 #====================================================
 #- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
@@ -98,36 +128,9 @@
 
 #====================================================
-#- ARCHIVE
-typeset -r ARCHIVE=${DMFDIR}
-
-# ============ CESIUM START ============ #
-
-#====================================================
-#- Mirror libIGCM from mercure to cesium if needed
-ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' )
-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}
+#- ARCHIVE (dedicated to large files)
+typeset -r ARCHIVE=${CCCSTOREDIR}
+
+#- ARCHIVE (dedicated to small/medium files)
+typeset -r STORAGE=${CCCWORKDIR}
 
 #====================================================
@@ -139,4 +142,8 @@
 #- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- R_FIG (hosting figures : monitoring and atlas, and/or small files)
+typeset -r R_FIG=${STORAGE}/IGCM_OUT
 
 #====================================================
@@ -229,34 +236,34 @@
 # ============ FRONTEND START ============ #
 
-#  /bin/ksh <tmp_IGCM_sys_RshPost_$$
-#  if [ $? -gt 0 ] ; then
-#    echo "IGCM_sys_RshPost : erreur."
-#    IGCM_debug_Exit "IGCM_sys_RshPost"
-#  fi
-#  \rm tmp_IGCM_sys_RshPost_$$
+  /bin/ksh <tmp_IGCM_sys_RshPost_$$
+  if [ $? -gt 0 ] ; then
+    echo "IGCM_sys_RshPost : erreur."
+    IGCM_debug_Exit "IGCM_sys_RshPost"
+  fi
+  \rm tmp_IGCM_sys_RshPost_$$
 
 # ============ FRONTEND  END  ============ #
 
 # ============ CESIUM START ============ #
-  typeset NB_ESSAI DELAI status i
-  # number of tentative
-  NB_ESSAI=10
-  # time delay between tentative
-  DELAI=10
-  (( i = 0 ))
-  while [ $i -lt $NB_ESSAI ] ; do
-    ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
-    status=$?
-    if [ ${status} -gt 0 ]; then
-      IGCM_debug_Print 2 "IGCM_sys_RshPost : ssh failed ${i}/${NB_ESSAI}"
-      IGCM_debug_Print 2 "IGCM_sys_RshPost : sleep ${DELAI} seconds and try again."
-      sleep $DELAI
-    else
-      break
-    fi
-    (( i = i + 1 ))
-  done 
-  # delete temporary file
-  /bin/rm tmp_IGCM_sys_RshPost_$$
+#  typeset NB_ESSAI DELAI status i
+#  # number of tentative
+#  NB_ESSAI=10
+#  # time delay between tentative
+#  DELAI=10
+#  (( i = 0 ))
+#  while [ $i -lt $NB_ESSAI ] ; do
+#    ssh -t mercure01 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
+#    status=$?
+#    if [ ${status} -gt 0 ]; then
+#      IGCM_debug_Print 2 "IGCM_sys_RshPost : ssh failed ${i}/${NB_ESSAI}"
+#      IGCM_debug_Print 2 "IGCM_sys_RshPost : sleep ${DELAI} seconds and try again."
+#      sleep $DELAI
+#    else
+#      break
+#    fi
+#    (( i = i + 1 ))
+#  done 
+#  # delete temporary file
+#  /bin/rm tmp_IGCM_sys_RshPost_$$
 # ============ CESIUM  END  ============ #
 
@@ -623,25 +630,25 @@
 # ============ FRONTEND START ============ #
 
-#  /usr/bin/nqsII/qsub -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
+  /usr/bin/nqsII/qsub -q scalaire -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM}/$1.job -v ${listVarEnv}
 
 # ============ FRONTEND  END  ============ #
 
 # ============ CESIUM START ============ #
-  typeset NB_ESSAI DELAI status i
-  # number of tentative
-  NB_ESSAI=10
-  # time delay between tentative
-  DELAI=10
-  (( i = 0 ))
-  while [ $i -lt $NB_ESSAI ] ; do
-    /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
-    status=$?
-    if [ ${status} -gt 0 ]; then
-      sleep $DELAI
-    else
-      break
-    fi
-    (( i = i + 1 ))
-  done 
+#  typeset NB_ESSAI DELAI status i
+#  # number of tentative
+#  NB_ESSAI=10
+#  # time delay between tentative
+#  DELAI=10
+#  (( i = 0 ))
+#  while [ $i -lt $NB_ESSAI ] ; do
+#    /usr/local/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.e.out -E "-v ${listVarEnv}" ${libIGCM_POST}/$1.job
+#    status=$?
+#    if [ ${status} -gt 0 ]; then
+#      sleep $DELAI
+#    else
+#      break
+#    fi
+#    (( i = i + 1 ))
+#  done 
 # ============ CESIUM  END  ============ #
 
@@ -950,5 +957,5 @@
     # USUAL WAY
     # add dmfind/dmget (to demigrate all offline files) :
-    dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
+    #dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
     \cp -r $1 $2 > out_rsync 2>&1
     RET=$?
@@ -1227,5 +1234,6 @@
     fi
 
-    dmget ${dm_liste[*]} > out_rsync 2>&1
+    #dmget ${dm_liste[*]} > out_rsync 2>&1
+    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     RET=$?
     if [ ${RET} -gt 0 ] ; then
@@ -1241,5 +1249,6 @@
     #	sleep 30
     #	echo "We try another time"
-    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    ##	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     #	RET=$?
     #	if [ ${RET} -gt 0 ] ; then
Index: /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_titane.ksh
===================================================================
--- /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 591)
+++ /branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 592)
@@ -92,5 +92,5 @@
 . /home/cont003/p86ipsl/.atlas_env_titane_ksh
 
-module switch nco/4.0.8 nco/3.9.4_netcdf4
+module switch nco/3.9.4 nco/3.9.4_netcdf4
 
 #====================================================
@@ -102,16 +102,4 @@
 # Host specific DIRECTORIES
 #====================================================
-
-#====================================================
-#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
-typeset -r R_EXE="${MODIPSL}/bin"
-
-#====================================================
-#- SUBMIT_DIR : submission dir
-typeset SUBMIT_DIR=${SUBMIT_DIR:=${LS_SUBCWD}}
-
-#====================================================
-#- ARCHIVE
-typeset -r ARCHIVE=${DMFDIR}
 
 # ============ CESIUM START ============ #
@@ -146,4 +134,19 @@
 
 #====================================================
+#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
+typeset -r R_EXE="${MODIPSL}/bin"
+
+#====================================================
+#- SUBMIT_DIR : submission dir
+typeset SUBMIT_DIR=${SUBMIT_DIR:=${LS_SUBCWD}}
+
+#====================================================
+#- ARCHIVE (dedicated to large files)
+typeset -r ARCHIVE=${CCCSTOREDIR}
+
+#- ARCHIVE (dedicated to small/medium files)
+typeset -r STORAGE=${CCCWORKDIR}
+
+#====================================================
 #- IN
 typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
@@ -153,4 +156,8 @@
 #- R_OUT
 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
+
+#====================================================
+#- R_FIG (hosting figures : monitoring and atlas, and/or small files)
+typeset -r R_FIG=${STORAGE}/IGCM_OUT
 
 #====================================================
@@ -1038,5 +1045,5 @@
     # USUAL WAY
     # add dmfind/dmget (to demigrate all offline files) :
-    dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
+    #dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget
     \cp -r $1 $2 > out_rsync 2>&1
     RET=$?
@@ -1351,5 +1358,6 @@
     fi
 
-    dmget ${dm_liste[*]} > out_rsync 2>&1
+    #dmget ${dm_liste[*]} > out_rsync 2>&1
+    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     RET=$?
     if [ ${RET} -gt 0 ] ; then
@@ -1365,5 +1373,6 @@
     #	sleep 30
     #	echo "We try another time"
-    #	dmget ${dm_liste[*]} > out_rsync 2>&1
+    ##	dmget ${dm_liste[*]} > out_rsync 2>&1
+    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1
     #	RET=$?
     #	if [ ${RET} -gt 0 ] ; then
@@ -1514,10 +1523,12 @@
   RET=0
   if [ $DRYRUN = 0 ]; then
-    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
-      echo "Nothing has been done."
-      return
-    fi
-    dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
+
+#    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then
+#      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ."
+#      echo "Nothing has been done."
+#      return
+#    fi
+
+    /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1
     RET=$?
     
@@ -1548,11 +1559,12 @@
   RET=0
   if [ $DRYRUN = 0 ]; then
-    if [ ! -d ${R_SAVE}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
-      echo "Nothing has been done."
-      return
-    fi
-    #
-    dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
+
+#    if [ ! -d ${R_SAVE}/${1} ] ; then
+#      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ."
+#      echo "Nothing has been done."
+#      return
+#    fi
+
+    /ccc/cont003/home/dsm/p86maf/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1
     RET=$?
 
@@ -1581,14 +1593,29 @@
     echo "IGCM_sys_Put_Dods :" $@
   fi
+  set -vx
+  typeset RET
   if [ $DRYRUN = 0 ]; then
-    if [ ! -d ${R_SAVE}/${1} ] ; then
-      echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
+    if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then
+      echo "WARNING IGCM_sys_Put_Dods : None of the following directories exist. Exactly one should."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} DOES NOT EXIST."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} DOES NOT EXIST."
       IGCM_debug_PopStack "IGCM_sys_Put_Dods"
       return
     fi
 
-    typeset RET
-	#
-    cd ${R_SAVE}
+    if ( [ -d ${R_SAVE}/${1} ] && [ -d ${R_FIGR}/${1} ] ) ; then
+      echo "WARNING IGCM_sys_Put_Dods : Both of the following directories exist. Exactly one should."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} EXISTS."
+      echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} EXISTS."
+      IGCM_debug_PopStack "IGCM_sys_Put_Dods"
+      return
+    fi
+    #
+    if [ -d ${R_SAVE}/${1} ] ; then
+      cd ${R_SAVE}
+    elif [ -d ${R_FIGR}/${1} ] ; then
+      cd ${R_FIGR}
+    fi
+
     IGCM_sys_Dods_Rm ${1}
     IGCM_sys_Dods_Cp ${1}
@@ -2086,5 +2113,5 @@
     echo "IGCM_sys_ncrcat :" $@
   fi
-  ncrcat $@
+  ncrcat --omp_num_threads 2 $@
   if [ $? -gt 0 ] ; then
     echo "IGCM_sys_ncrcat : erreur ${@}."
