Index: /trunk/libIGCM/AA_clean_month
===================================================================
--- /trunk/libIGCM/AA_clean_month	(revision 544)
+++ /trunk/libIGCM/AA_clean_month	(revision 545)
@@ -77,9 +77,12 @@
 #====================================================
 #R_SAVE : Job output 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}
@@ -88,5 +91,5 @@
 if [ ! -f ${SUBMIT_DIR}/run.card ]; then 
     echo "You seem NOT to have a run.card in this directory !!"
-    echo "This script will fail because it doesn't know what to do without run.card avaible."
+    echo "This script will fail because it doesn't know what to do without run.card available."
     exit 1
 else
@@ -104,4 +107,8 @@
     set +A ListFiles -- $( IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" " )
     CountListFiles=${#ListFiles[@]}
+
+    echo "Search files with ${PeriodDateEnd} in ${R_BUFR}"
+    set +A ListFilesBuf -- $( IGCM_sys_RshMaster "find ${R_BUFR} -name \"*${PeriodDateEnd}*\" " )
+    CountListFilesBuf=${#ListFilesBuf[@]}
 
     # If exist, erase REBUILD DIR
@@ -124,7 +131,10 @@
 	    IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m"
 	done
+	for file in ${ListFilesBuf[@]} ; do
+	    IGCM_debug_Print 2 -e "\033[1;31m ${file}\033[m"
+	done
 
-	echo "\033[1;32mDo you REALLY want to erase all those files ?"
-	echo -n " Your answer (y/n) : \033[m"
+	echo -e "\033[1;32mDo you REALLY want to erase all those files ?"
+	echo -n -e " Your answer (y/n) : \033[m"
 	read reponse
 	case ${reponse} in
@@ -133,4 +143,5 @@
 		echo "OK. It will be erased."
 		IGCM_sys_RshArchive "find ${R_SAVE} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;"
+		IGCM_sys_RshMaster  "find ${R_BUFR} -name \"*${PeriodDateEnd}*\" -exec rm -f '{}' \;"
 		echo "done."
 		;;
@@ -147,6 +158,6 @@
 	done
 
-	echo "\033[1;32mDo you REALLY want to erase all those Directories ?"
-	echo -n " Your answer (y/n) : \033[m"
+	echo -e "\033[1;32mDo you REALLY want to erase all those Directories ?"
+	echo -n -e " Your answer (y/n) : \033[m"
 	read reponse
 	case ${reponse} in
Index: /trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh	(revision 544)
+++ /trunk/libIGCM/libIGCM_comp/libIGCM_comp.ksh	(revision 545)
@@ -966,5 +966,5 @@
 	elif [ ${nb_rebuild_file} -gt 1 ] ; then
 	  IGCM_debug_Print 2 "Parallelism detected rebuilding ${file_in} is needed"
-	  if ( [ X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ X${config_Post_RebuildFrequency} = XNONE ] ) ; then
+	  if [ X${AsynchronousRebuild} = Xfalse ] ; then
 	    IGCM_debug_Print 2 "Rebuilding ${file_in} online"
 	    IGCM_sys_rebuild ${file_in} ${generic_file_name}_*.nc
@@ -1016,53 +1016,41 @@
 	if [ ${SaveOnArchive} = true ] ; then
 	  #
+	  # Rebuild has been done online or it was not needed
+	  #
 	  # If we need to apply a patch we use TMP DIRECTORY before ARCHIVING if asynchronous rebuild is on
 	  #
 	  thereisapatch=$( eval echo \${${compname}_${flag_post}_Patches[0]} )
-	  
-	  if ( [ ! X${thereisapatch} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = X ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
-	    if [ -f ${file_in} ] ; then
-              [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
-
-	      IGCM_sys_Mv ${file_in} ${RUN_DIR}/REBUILD_${PeriodDateBegin}
-	      eval FileToBeDeleted[${#FileToBeDeleted[@]}]=REBUILD_${PeriodDateBegin}/${file_in} > /dev/null 2>&1
+	  if ( [ ! X${thereisapatch} = X${NULL_STR} ] && [ X${AsynchronousRebuild} = Xtrue ] && [ -f ${file_in} ] ) ; then
+	    [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+	    IGCM_sys_Mv ${file_in} ${RUN_DIR}/REBUILD_${PeriodDateBegin}
+	    eval FileToBeDeleted[${#FileToBeDeleted[@]}]=REBUILD_${PeriodDateBegin}/${file_in} > /dev/null 2>&1
+	    #
+	    if [ $DRYRUN -le 1 ]; then
+	      if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
+		echo "#!/bin/ksh                                      " >  ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "function IGCM_FlushRebuild                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "{                                               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "echo                                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "echo                                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "export R_SAVE=${R_SAVE}                         " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      fi
+              #
+	      for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
+		echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_${Patch} ${file_in}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+		echo "IGCM_debug_Verif_Exit_Post                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      done
 	      #
-	      if [ $DRYRUN -le 1 ]; then
-		if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
-		  echo "#!/bin/ksh                                      " >  ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "function IGCM_FlushRebuild                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "{                                               " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "echo                                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "echo                                            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "export R_SAVE=${R_SAVE}                         " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		fi
-                #
-		for Patch in $( eval echo \${${compname}_${flag_post}_Patches[*]} ); do
-		  echo ". ${libIGCM_POST}/libIGCM_post/IGCM_${Patch}.ksh" >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "IGCM_${Patch} ${file_in}                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		  echo "IGCM_debug_Verif_Exit_Post                      " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		done
-		#
-		echo "IGCM_sys_Put_Out ${file_in} ${file_out}           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		echo "IGCM_debug_Verif_Exit_Post                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-		#
-	      fi
+	      echo "IGCM_sys_Put_Out ${file_in} ${file_out}           " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      echo "IGCM_debug_Verif_Exit_Post                        " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
+	      #
 	    fi
 	  else
-            [ ! -d ${RUN_DIR}/REBUILD_${PeriodDateBegin} ] && IGCM_sys_Mkdir ${RUN_DIR}/REBUILD_${PeriodDateBegin}
-	    if [ ! -f ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh ] ; then
-	      echo "#!/bin/ksh                                          " >  ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	      echo "function IGCM_FlushRebuild                          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	      echo "{                                                   " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	      echo "IGCM_debug_PushStack \"IGCM_FlushRebuild\"          " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	      echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	      echo "IGCM_debug_Print 1 \"IGCM_FlushRebuild\"            " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	      echo "echo                                                " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	      echo "export R_SAVE=${R_SAVE}                             " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	      echo "export config_UserChoices_JobName=${config_UserChoices_JobName} " >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
-	    fi
-
+	    #
+	    # No Patch, No Asynchronous rebuild, online rebuild has been done or was not needed
+	    #
 	    IGCM_sys_Put_Out ${file_in} ${file_out}
 	    eval FileToBeDeleted[${#FileToBeDeleted[@]}]="${file_in}" > /dev/null 2>&1
Index: /trunk/libIGCM/libIGCM_config/libIGCM_config.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_config/libIGCM_config.ksh	(revision 544)
+++ /trunk/libIGCM/libIGCM_config/libIGCM_config.ksh	(revision 545)
@@ -197,4 +197,5 @@
     IGCM_sys_TestDir        ${R_BUFR}
     [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir ${R_BUFR}"
+
     #Test state of run in run.card
     IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
@@ -340,5 +341,5 @@
   typeset i
 
-  if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] || [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
+  if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
     AsynchronousRebuild=true
     IGCM_debug_Print 1 "Asynchronous rebuild has been activated."
@@ -595,12 +596,12 @@
   listVarEnv="ExeOutDateMax,R_OUT_EXE,PREFIX,SUBMIT_DIR"
   IGCM_sys_RshMaster "\
-       . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh; \
+    . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh; \
     export ExeOutDateMax=${ExeOutDateMax};\
-       export R_OUT_EXE=${R_OUT_EXE};\
-       export PREFIX=${PREFIX};\
-       export SUBMIT_DIR=${SUBMIT_DIR};\
-       export listVarEnv=${listVarEnv};\
-       Script_Output=out_SaveSourceModifications;\
-       IGCM_sys_Qsub ${libIGCM}/SaveSourceModifications.job ${ExeOutDateMax} ${R_OUT_EXE} ${PREFIX} ${SUBMIT_DIR}"
+    export R_OUT_EXE=${R_OUT_EXE};\
+    export PREFIX=${PREFIX};\
+    export SUBMIT_DIR=${SUBMIT_DIR};\
+    export listVarEnv=${listVarEnv};\
+    Script_Output=out_SaveSourceModifications;\
+    IGCM_sys_Qsub ${libIGCM}/SaveSourceModifications.job ${ExeOutDateMax} ${R_OUT_EXE} ${PREFIX} ${SUBMIT_DIR}"
 
   IGCM_debug_PopStack "IGCM_config_SaveSourceModifications"
Index: /trunk/libIGCM/libIGCM_post/libIGCM_post.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_post/libIGCM_post.ksh	(revision 544)
+++ /trunk/libIGCM/libIGCM_post/libIGCM_post.ksh	(revision 545)
@@ -45,5 +45,5 @@
   # Overrule special cases
   if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \
-    [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]        && \
+    [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]           && \
     [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
     TimeSeriesFrequency=true
@@ -51,7 +51,5 @@
   fi
   #
-  if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \
-    [ ! X${config_Post_RebuildFrequency} = XNONE ]        && \
-    [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
+  if ( [ X${AsynchronousRebuild} = Xtrue ] && [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
     RebuildFrequency=true
     POST=true
@@ -95,6 +93,6 @@
   typeset listVarEnv
 
-  POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
-
+  #POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
+  POST_DIR=${R_BUF_KSH}
   if [ ${POST} = true ]; then
     echo
@@ -409,5 +407,5 @@
 
   #============== REBUILD POST-TREATMENT =============#
-  if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
+  if [ X${AsynchronousRebuild} = Xtrue ] ; then
     # -----------------------------------------------------------------------------------
     # Function IGCM_FlushRebuild define in rebuild.ksh has not been closed yet. Do it now
@@ -578,5 +576,5 @@
       fi ;;
     esac ;;
-  NONE|none) 
+  NONE|none)
     ;;
   *)
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 544)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_cesium.ksh	(revision 545)
@@ -117,5 +117,5 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 544)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh	(revision 545)
@@ -107,5 +107,5 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex8.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex8.ksh	(revision 544)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex8.ksh	(revision 545)
@@ -133,5 +133,5 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 544)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex9.ksh	(revision 545)
@@ -133,5 +133,5 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
Index: /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh
===================================================================
--- /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 544)
+++ /trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh	(revision 545)
@@ -92,4 +92,6 @@
 . /home/cont003/p86ipsl/.atlas_env_titane_ksh
 
+module switch nco/4.0.8 nco/3.9.4_netcdf4
+
 #====================================================
 # Specific for ocean additionnal diagnostic
@@ -145,5 +147,5 @@
 #====================================================
 #- IN
-typeset -r R_IN=${R_IN:=/dmnfs/cont003/p86ipsl/IGCM}
+typeset -r R_IN=${R_IN:=/ccc/work/cont003/dsm/p86ipsl/IGCM}
 typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/dmnfs/cont003/p24data}
 
