Index: trunk/libIGCM/AA_pack_restart
===================================================================
--- trunk/libIGCM/AA_pack_restart	(revision 547)
+++ trunk/libIGCM/AA_pack_restart	(revision 554)
@@ -33,5 +33,5 @@
 #-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 ; $PeriodDateBegin ; $PeriodDateEnd ; $StandAlone ; $MASTER
+#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
 #-Q- sx8brodie # @ queue
 #-Q- aix6 #!/bin/ksh
@@ -49,5 +49,5 @@
 #-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 ; $PeriodDateBegin ; $PeriodDateEnd ; $StandAlone ; $MASTER
+#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
 #-Q- aix6 # @ queue
 #-Q- ulam #!/bin/ksh
@@ -65,5 +65,5 @@
 #-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 ; $PeriodDateBegin ; $PeriodDateEnd ; $StandAlone ; $MASTER
+#-Q- ulam # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER
 #-Q- ulam # @ queue
 #-Q- sx8mercure #!/bin/ksh
@@ -132,39 +132,41 @@
 StandAlone=${StandAlone:=true}
 
-#D- Flag to determine begin date for restart pack
-#D- Default : value from AA_job if any
-DateBegin=20000101
-
-#D- Flag to determine end date for restart pack
-#D- Default : value from AA_job if any
-DateEnd=20691231
-
-#D- Flag to determine pack period
-#D- Default : value from AA_job if any
-period_pack=${period_pack:=10Y}
-
-SUBMIT_DIR=${PWD}
-
-RUN_DIR_PATH=/scratch/cont003/p86denv/Pack_Test
+#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
-libIGCM=${libIGCM:=/work/cont003/p86denv/PARA_XEON_CM5_IPSLCM5A.16122011_39L/modipsl/libIGCM}
-
-# WARNING for StandAlone use : To run this script on some machine,
-# you must check MirrorlibIGCM variable in sys library.
-# If this variable is true, you must use libIGCM_POST path instead
-# of your running libIGCM directory.
-
-#D- Increased verbosity (1, 2, 3)
-#D- Default : value from AA_job if any
-Verbosity=${Verbosity:=3}
-
-#D- Low level debug : to bypass lib test checks and stack construction
-#D- Default : value from AA_job if any
 DEBUG_debug=${DEBUG_debug:=false}
+
+#D- Keep following comments for now. Will be remove.
 
 #on veut archiver les fichiers restart
@@ -187,5 +189,5 @@
 # $1= PATH/config_card d'une simulation avec 
 # TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd/PATH_SIMUL
-# $2=period_pack en M/m ou Y/y
+# $2=PeriodPack en M/m ou Y/y
 
 ########################################################################
@@ -264,17 +266,12 @@
 #### Preparation de l'environnement
 # repertoire dans lequel seront crees les archives
-#STORE_RESTART=${R_SAVE}/RESTART
-#IGCM_sys_MkdirArchive ${STORE_RESTART}
-
-STORE_RESTART=/scratch/cont003/p86denv/Pack_Test/RESTART
-mkdir -p ${STORE_RESTART}
-
-#### 0- lecture de config.card 
-#### on veut les renseignements suivants : 
-#### JobName, PATH_SIMUL, DateBegin et DateEnd
-
+STORE_RESTART=${R_SAVE}/RESTART
+IGCM_sys_MkdirArchive ${STORE_RESTART}
+
+#STORE_RESTART=/scratch/cont003/p86denv/Pack_Test/RESTART
+#mkdir -p ${STORE_RESTART}
+
+# Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure)
 JobName=${config_UserChoices_JobName}
-#DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
-#DateEnd=$(   IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd}   )
 PATH_SIMUL=${R_BUFR}
 echo $JobName $PATH_SIMUL $DateBegin $DateEnd
@@ -305,8 +302,8 @@
 
 ### 2- creer les listes de fichiers par periode ####
-###Â 2.1- dechiffrer period_pack et le separer en year et month ###
-case ${period_pack} in
+###Â 2.1- dechiffrer PeriodPack et le separer en year et month ###
+case ${PeriodPack} in
 *Y|*y) 
-  periodpackinyear=$( echo ${period_pack} | sed -e 's/[yY]//' ) 
+  periodpackinyear=$( echo ${PeriodPack} | sed -e 's/[yY]//' ) 
   periodpackinmonth=0
   ;;
@@ -314,9 +311,9 @@
 *M|*m) 
   periodpackinyear=0
-  periodpackinmonth=$( echo ${period_pack} | sed -e 's/[mM]//' ) 
+  periodpackinmonth=$( echo ${PeriodPack} | sed -e 's/[mM]//' ) 
   ;;
 
 *)
-  echo "period_pack doit etre en mois ou annees"
+  echo "PeriodPack doit etre en mois ou annees"
   IGCM_debug_Exit "period pack unit"
   ;;
@@ -368,4 +365,5 @@
     if [ ${date_file} -lt ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 
         echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${number_pack}.txt
+#    Will not work. Need to find a better ordering.
 #    elif [ ${date_file} -ge ${date_end_pack} ] ; then
 #      break
@@ -377,5 +375,6 @@
   date_begin_pack=${year_begin_pack}$( printf "%02i\n" ${month_begin_pack} )01
 
-  tar -cvf ${STORE_RESTART}/restart_pack_${number_pack}.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt
+  # Here we create tar files directly in $STORE. Avoid to create then to copy.
+  tar -cvf ${STORE_RESTART}/${JobName}_${year_begin_pack}_${year_end_pack}_restart.tar --dereference --files-from ${RUN_DIR}/liste_pack_${number_pack}.txt
   cat  ${RUN_DIR}/liste_pack_${number_pack}.txt | xargs rm 
   mv ${RUN_DIR}/liste_pack_${number_pack}.txt ${STORE_RESTART}
