source: tags/libIGCM_v2.0_beta4/AA_TimeSeries_Checker @ 1170

Last change on this file since 1170 was 658, checked in by labetoulle, 12 years ago

Add Ensemble functionality to libIGCM - First step :
modify output directories according to an option in section [Ensemble]
in config.card (modification of config.card yet to be done).

  • Property svn:keywords set to Revision Author Date
File size: 24.0 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil
5# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
6# $Revision::                                          $ Revision of last commit
7# $Author::                                            $ Author of last commit
8# $Date::                                              $ Date of last commit
9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
14# Check that everything went well during time series production
15# Display a short report
16# Launch what's missing
17# For use during a run (not on the end : PeriodState=Completed), it will complete
18# all TS to last PeriodDateEnd value, give by run.card->Configuration->OldPrefix string.
19
20#D- Path to libIGCM
21#D- Default : value from AA_job if any
22# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
23# WARNING you must check MirrorlibIGCM variable in sys library.
24# WARNING If this variable is true, you must use libIGCM_POST path instead
25# WARNING of your running libIGCM directory.
26libIGCM=${libIGCM:=::modipsl::/libIGCM}
27
28# Expericence class of the run
29ExperimentName=${ExperimentName:=historical}
30
31# Name of this job
32JobName=${JobName:=v2.historical1}
33
34# répertoire courrant
35CURRENT_DIR=$( pwd )
36
37# Emplacement des cartes
38CARD_DIR=${CARD_DIR:=${CURRENT_DIR}/${ExperimentName}/${JobName}}
39
40# répertoire de stockage des sorties des create_ts
41POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
42
43# project
44export BRIDGE_MSUB_PROJECT=gen2211
45
46if [ ! -d ${CARD_DIR} ]; then
47  echo "No ${CARD_DIR}, we stop here"
48  exit
49fi
50
51########################################################################
52
53. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
54. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     #; IGCM_debug_Check
55. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   #; IGCM_card_Check
56. ${libIGCM}/libIGCM_date/libIGCM_date.ksh   #; IGCM_date_Check
57
58########################################################################
59
60#set -vx
61
62echo "Hi I'm here to help you complete the time series production you planned according to your *.card."
63echo "This action can potentially submit numbers of jobs (up to 50)"
64echo "This action can potentially remove unnecessary files but I will ALWAYS ask permission to do so"
65echo -e "\033[1;31mDo you want me to run in dryrun mode just telling what I would submit?\033[m"
66echo -e "\033[1;31mOr do you want me to submit job for real? Answer yes in this case.\033[m"
67echo -n " Run for real (y/n) :"
68read ActionAnswer
69
70case ${ActionAnswer} in
71oui|OUI|o|y|yes|YES)
72  echo "OK. I will submit jobs but ask permissions before removing files"
73  action=true
74  ;;
75non|NON|n|no|NO)
76  echo "OK. I won't submit jobs and only print out files I could remove"
77  action=false
78  ;;
79*)
80  echo "I did not recognize your answer. I will stop here."
81  echo "Please respond: oui|OUI|o|y|yes|YES"
82  echo "Or please respond: non|NON|n|no|NO"
83  exit
84  ;;
85esac
86
87#==================================
88# First of all
89#
90typeset option
91
92#==================================
93# Read UserChoices section:
94IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
95echo
96IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
97for option in ${config_UserChoices[*]} ; do
98    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
99    eval auxprint=\${config_UserChoices_${option}}
100    IGCM_debug_Print 3 "${option} : ${auxprint}"
101done
102#
103echo
104
105#==================================
106# Read Ensemble section:
107IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card Ensemble
108echo
109
110for option in ${config_Ensemble[*]} ; do
111    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Ensemble ${option}
112    eval auxprint=\${config_Ensemble_${option}}
113    IGCM_debug_Print 3 "${option} : ${auxprint}"
114done
115#
116echo
117
118#==================================
119# Read Post section:
120IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Post
121echo
122IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
123
124for option in ${config_Post[*]} ; do
125  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post ${option}
126  eval auxprint=\${config_Post_${option}}
127  IGCM_debug_Print 3 "${option} : ${auxprint}"
128done
129#
130echo
131
132if [ -f ${CARD_DIR}/run.card ] ; then
133  IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration OldPrefix
134  IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration PeriodState
135  IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card PostProcessing TimeSeriesCompleted
136  IGCM_debug_Print 1 "DefineVariableFromOption  : run_Configuration"
137  IGCM_debug_PrintVariables 3 run_Configuration_OldPrefix
138  IGCM_debug_PrintVariables 3 run_Configuration_PeriodState
139  IGCM_debug_Print 1 "DefineVariableFromOption  : run_PostProcessing"
140  IGCM_debug_PrintVariables 3 run_PostProcessing_TimeSeriesCompleted
141  if [ X${run_Configuration_PeriodState} != X"Completed" ] ; then
142    DateEnd=$( IGCM_date_ConvertFormatToGregorian $( echo ${run_Configuration_OldPrefix} | awk -F'_' '{print $2}' ) )
143  else
144    DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
145  fi
146  CompletedFlag=${run_PostProcessing_TimeSeriesCompleted}
147else
148  DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
149  CompletedFlag=""
150fi
151SavedCompletedFlag=${CompletedFlag}
152DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
153
154IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
155IGCM_date_GetYearMonth ${DateEnd}   YearEnd   MonthEnd
156
157echo
158IGCM_debug_Print 1 "DateBegin for TimeSeries_Checker : "${DateBegin}
159IGCM_debug_Print 1 "DateEnd   for TimeSeries_Checker : "${DateEnd}
160IGCM_debug_Print 1 "CompletedFlag = "${CompletedFlag}
161echo
162
163#====================================================
164#R_SAVE : Job output directory
165#R_BUFR : Job output buffered directory
166if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
167  FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
168  if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
169    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
170    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
171    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
172  else
173    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
174    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
175    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
176  fi
177else
178  if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
179    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
180    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
181    R_DODS=${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
182  else
183    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
184    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
185    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
186  fi
187fi
188
189IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
190
191for comp in ${config_ListOfComponents[*]} ; do
192  # Debug Print
193  IGCM_debug_Print 1 ${comp}
194  # Define component
195  IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
196  eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
197  eval comptagname=\${config_ListOfComponents_${comp}[1]} > /dev/null 2>&1
198
199  # Read libIGCM compatibility version in ${compname}.card
200  card=${CARD_DIR}/COMP/${compname}.card
201
202  # Read and Build Output File stuff
203  #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
204  IGCM_card_DefineArrayFromOption ${card} OutputFiles List
205  ListFilesName=${compname}_OutputFiles_List
206  eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
207  #
208  if [ X${FileName0} != X${NULL_STR} ] ; then
209    #
210    #IGCM_debug_Print 1 "Component      : ${compname}"
211    #
212    # INITIALISATION
213    #
214    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
215    i=2
216    #
217    until [ $i -ge $NbFiles ]; do
218      #
219      eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
220      #
221      if [ X${flag_post} != XNONE ] ; then
222        #
223        # First of all
224        #
225        IGCM_card_DefineArrayFromSection ${card} ${flag_post}
226        #
227        IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars
228        IGCM_card_DefineArrayFromOption ${card} ${flag_post} Patches
229        if [ X"$( eval echo \${${compname}_${flag_post}_TimeSeriesVars[*]} )" = X"Option not" ] ; then
230          # New TimeSeriesVar description, with 2D, 3D and associate ChunckJob.
231          unset ListDimension
232          ListDimension[0]=2D
233          ListDimension[1]=3D
234          TimeSeries=false
235          TimeSeries2D=false
236          TimeSeries3D=false
237          chunck=false
238          iLoop=${#ListDimension[*]}
239          j=0
240          until [ $j -ge ${iLoop} ]; do
241            Dimension=${ListDimension[${j}]}
242            IGCM_card_DefineArrayFromOption ${card} ${flag_post} TimeSeriesVars${Dimension}
243            IGCM_card_DefineVariableFromOption ${card} ${flag_post} ChunckJob${Dimension}
244            #
245            # Time series WITHOUT chunk
246            #
247            if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
248              if [ $( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} ) = NONE ] ; then
249                IGCM_debug_Print 2 "${Dimension} time series activated for ${flag_post}"
250                eval TimeSeries${Dimension}=true
251                chunck=false
252              fi
253            fi
254            #
255            # Time series WITH chunk
256            #
257            if [ ! $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then
258              chunck_size=$( eval echo \${${compname}_${flag_post}_ChunckJob${Dimension}} )
259              if [ ! ${chunck_size} = NONE ] &&  [ ! ${chunck_size} = OFF ] ; then
260                IGCM_debug_Print 2 "${Dimension} time series activated with ${chunck_size} chunck for ${flag_post}"
261                eval TimeSeriesChunck${Dimension}=true
262                chunck=true
263              fi
264            fi
265            (( j=j+1 ))
266            #
267            # If TimeSeriesVars list is empty or OFF we skip
268            #
269            if ( [ $( eval echo \${${compname}_${flag_post}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] || \
270              [ ${chunck_size} = OFF ] ) ; then
271              #IGCM_debug_Print 2 "Empty TS : ${compname}_Post_${FILE}_TimeSeriesVars${Dimension}"
272              #(( i=i+3 ))
273              continue
274            fi
275            #
276            #  ICI ON TESTE QUE LES FICHIERS TS SONT LA!
277            #
278            FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
279            IGCM_card_DefineArrayFromOption ${card}    Post_${FILE} TimeSeriesVars${Dimension}
280            IGCM_card_DefineVariableFromOption ${card} Post_${FILE} ChunckJob${Dimension}
281            #
282            FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' )
283            case ${FlagDir} in
284            *Y)  TS_Dir=TS_YE  ;;
285            *M)  TS_Dir=TS_MO  ;;
286            *D)  TS_Dir=TS_DA  ;;
287            3H|HF)  TS_Dir=TS_HF  ;;
288            INS) TS_Dir=TS_INS ;;
289            esac
290            #
291            # We need LIST of variables not allready produced (useful for standalone mode)
292            #
293            DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
294            IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
295
296            # Si on n'a pas de chunck, dans ce cas chunck_size=la durée de la simulation en années
297            YearsChunckLength=$( echo ${chunck_size} | sed -e "s/[yY]//" )
298            [ ${chunck} = false ] && YearsChunckLength=$(( YearEnd - YearBegin + 1 ))
299
300            NbYearsChunckLoop=$(( ( YearEnd - YearBegin + 1 ) / YearsChunckLength ))
301            Reste=$(( ( YearEnd - YearBegin + 1 ) % YearsChunckLength ))
302
303            if [ ${Reste} -ne 0 ] ; then
304              NbYearsChunckLoop=$(( NbYearsChunckLoop + 1 ))
305            fi
306
307            if [ ${NbYearsChunckLoop} -eq 1 ] ; then
308              PeriodDateEnd=${DateEnd}
309            else
310              DaysInYear=$( IGCM_date_DaysInYear ${YearBegin} )
311              PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( YearsChunckLength * DaysInYear - 1 )) )
312            fi
313            #
314            DIRECTORY=${R_SAVE}/${comp}/Analyse/${TS_Dir}
315            YearsChunckLoop=1
316            ChunckDebut=${DateBegin}
317            ChunckFin=${PeriodDateEnd}
318            while [ ${YearsChunckLoop} -le ${NbYearsChunckLoop} ] ; do
319              countTotal=0
320              countGood=0
321              countBad=0
322              unset RemoveList
323              unset PotentialCompletedFlag
324              for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do
325                TestedFile=${config_UserChoices_JobName}_${ChunckDebut}_${ChunckFin}_${FlagDir}_${var}.nc
326                #
327                if [ -d ${DIRECTORY} ] ; then
328                  Candidat=$( find ${DIRECTORY} -name "${config_UserChoices_JobName}_${ChunckDebut}_*_${FlagDir}_${var}.nc" )
329                else
330                  Candidat=""
331                fi
332                #
333                BestCandidat=${ChunckDebut}
334                #
335                FoundCandidat=false
336                if [ ! "X${Candidat}" = "X" ] ; then
337                  for candid in ${Candidat} ; do
338                    #IGCM_debug_Print 1 -e "\033[1;32m[CompletedFlag CANDIDAT MATCH FOUND]\033[m $( basename ${candid} )"
339                    CandidatEnd=$( echo ${candid}   | awk -F${config_UserChoices_JobName} '{print $3}' | awk -F_ '{print $3}' )
340                    if [ ${CandidatEnd} -gt ${ChunckFin} ] ; then
341                      #IGCM_debug_Print 3 -e "File $( basename ${candid} ) should be suppress"
342                      set +A RemoveList ${RemoveList[*]} ${candid}
343                    elif [ ${CandidatEnd} -lt ${ChunckFin} ] ; then
344                      #IGCM_debug_Print 3 -e "File $( basename ${candid} ) should be suppress or used as a CompletedFlag baseline"
345                      # We keep the best candidat and remove the others
346                      if [ ${BestCandidat} -lt ${CandidatEnd} ] ; then
347                        if [ ${FoundCandidat} = true ] ; then
348                          set +A RemoveList ${RemoveList[*]} ${DIRECTORY}/${config_UserChoices_JobName}_${ChunckDebut}_${BestCandidat}_${FlagDir}_${var}.nc
349                        else
350                          FoundCandidat=true
351                        fi
352                        BestCandidat=${CandidatEnd}
353                      else
354                        set +A RemoveList ${RemoveList[*]} ${candid}
355                      fi
356                    fi
357                  done
358                else
359                  # No CompletedFlag candidat found
360                  CandidatCompletedFlag=""
361                fi
362                #
363                if [ ! -f ${DIRECTORY}/${TestedFile} ] ; then
364                  (( countBad = countBad + 1 ))
365                  [ ${countBad} = 1 ] && IGCM_debug_Print 3 "Missing time series from ${FILE} :"
366                  IGCM_debug_Print 3 ${DIRECTORY}/${TestedFile}
367                  # Then we keep a track of the Best Candidat
368                  if [ ${FoundCandidat} = true ] ; then
369                    if [ ${chunck} = true ] ; then
370                      set +A PotentialCompletedFlag ${PotentialCompletedFlag[*]} ${BestCandidat}
371                    else
372                      eval set +A PotentialCompletedFlag${Dimension} \${PotentialCompletedFlag${Dimension}[*]} \${BestCandidat}
373                    fi
374                  fi
375                else
376                  (( countGood = countGood + 1 ))
377                  # Then we do not need the best candidat if any
378                  [ ${FoundCandidat} = true ] && set +A RemoveList ${RemoveList[*]} ${DIRECTORY}/${config_UserChoices_JobName}_${ChunckDebut}_${BestCandidat}_${FlagDir}_${var}.nc
379                fi
380                (( countTotal = countTotal + 1 ))
381              done
382
383              SuccessRate=$(( countGood * 100 / countTotal ))
384              if [ ${SuccessRate} -ne 100 ] ; then
385                IGCM_debug_Print 2 -e "\033[1;31m${SuccessRate}% files OK.\033[m for period ${ChunckDebut}-${ChunckFin}"
386              else
387                IGCM_debug_Print 2 -e "\033[1;32m${SuccessRate}% files OK.\033[m for period ${ChunckDebut}-${ChunckFin}"
388              fi
389              echo
390
391              # Remove what's in the RemoveList
392              if [ ${RemoveList} ] ; then
393                IGCM_debug_Print 2 "File(s) that will be removed ${RemoveList[*]}"
394                if [ ${action} = true ] ; then
395                  echo -e "\033[1;32mDo you want to remove them?\033[m"
396                  echo -n " Your answer (y/n) : "
397                  read RemoveAnswer
398                  case ${RemoveAnswer} in
399                  oui|OUI|o|y|yes|YES)
400                    echo "OK. I will erase them"
401                    IGCM_sys_Rm -f ${RemoveList[*]}
402                    ;;
403                  non|NON|n|no|NO)
404                    echo "OK. I won't erase them"
405                    ;;
406                  *)
407                    echo "I did not recognize your answer."
408                    echo "Please respond: oui|OUI|o|y|yes|YES"
409                    echo "Or please respond: non|NON|n|no|NO"
410                    exit
411                    ;;
412                  esac
413                fi
414              fi
415              #[ ${FoundCandidat} = true ] && IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag[*]}"
416              #
417              # TO REWRITE BEGIN
418              #
419              if ( [ ${chunck} = true ] && [ ${SuccessRate} -ne 100 ] ) ; then
420                NbCandidats=${#PotentialCompletedFlag[@]}
421                countCandid=1
422                if [ ${NbCandidats} -eq 0 ] ; then
423                  ChunckCompletedFlag=""
424                  IGCM_debug_Print 2 -e "\033[1;31mNO CompletedFlag\033[m"
425                elif [ ${NbCandidats} -eq 1 ] ; then
426                  ChunckCompletedFlag=${PotentialCompletedFlag[0]}
427                  IGCM_debug_Print 2 -e "\033[1;32mCompletedFlag=${ChunckCompletedFlag}\033[m"
428                elif [ ${NbCandidats} -gt 1 ] ; then
429                  k=1
430                  until [ $k -ge ${NbCandidats} ]; do
431                    ((k_m1=k-1))
432                    if [ ${PotentialCompletedFlag[${k_m1}]} = ${PotentialCompletedFlag[${k}]} ] ; then
433                      ((countCandid=countCandid+1))
434                    fi
435                    ((k=k+1))
436                  done
437                  if [ ${NbCandidats} -eq ${countCandid} ] ; then
438                    ChunckCompletedFlag=${PotentialCompletedFlag[0]}
439                    IGCM_debug_Print 2 -e "\033[1;32mCompletedFlag=${ChunckCompletedFlag}\033[m"
440                  else
441                    ChunckCompletedFlag=${PotentialCompletedFlag[0]}
442                    IGCM_debug_Print 2 -e "\033[1;31mToo Many Potential CompletedFlag\033[m Let start with first CompletedPeriod"
443                    IGCM_debug_Print 2 -e "\033[1;31mYou will have to redo TimeSeries_Checker\033[m for other period."
444                  fi
445                fi
446                #
447                # TO REWRITE END
448                #
449                if [ ${action} = true ] ; then
450                  IGCM_debug_Print 2 -e "\033[1;31mSubmit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin} and CompletedFlag=${ChunckCompletedFlag}"
451                  listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask,CompToRead,FlagToRead"
452                  export libIGCM=${libIGCM}
453                  export SUBMIT_DIR=${CARD_DIR}
454                  export POST_DIR=${POST_DIR}
455                  export DateBegin=${ChunckDebut}
456                  export PeriodDateEnd=${ChunckFin}
457                  export CompletedFlag=${ChunckCompletedFlag}
458                  export TsTask=Chunck${Dimension}
459                  export CompToRead=${comp}
460                  export FlagToRead=${i}
461                  export NameToRead=${flag_post}
462                  export listVarEnv=${listVarEnv}
463                  IGCM_sys_MkdirWork ${POST_DIR}
464                  IGCM_debug_Verif_Exit_Post
465                  Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}.${CompToRead}.${NameToRead}
466                  IGCM_sys_QsubPost create_ts
467                  echo
468                else
469                  IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit ${FILE} chunck ${Dimension}\033[m period ${ChunckDebut}-${ChunckFin} and CompletedFlag=${ChunckCompletedFlag}"
470                fi
471              fi
472
473              if ( [ ${chunck} = false ] && [ ${SuccessRate} -ne 100 ] ) ; then
474                eval Launch${Dimension}=true
475              fi
476
477              # Date update
478              ChunckDebut=$( IGCM_date_AddDaysToGregorianDate ${ChunckFin} 1 )
479
480              (( YearsChunckLoop = YearsChunckLoop + 1 ))
481
482              if [ ${YearsChunckLoop} -eq ${NbYearsChunckLoop} ] ; then
483                ChunckFin=${DateEnd}
484              else
485                ChunckFin=$( IGCM_date_AddDaysToGregorianDate ${ChunckDebut} $(( YearsChunckLength * DaysInYear - 1 )) )
486              fi
487            done
488          done
489        else
490          ListDimension[0]=""
491          TimeSeries=true
492          TimeSeries2D=false
493          TimeSeries3D=false
494          TimeSeriesChunck2D=false
495          TimeSeriesChunck3D=false
496        fi
497      fi
498      (( i=i+3 ))
499    done
500  fi
501done # comp loop
502
503echo
504
505DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
506IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
507CompletedFlag=${SavedCompletedFlag}
508
509unset CompToRead
510unset FlagToRead
511
512if [ X${Launch2D} = Xtrue ] ; then
513  if [ ${action} = true ] ; then
514    #IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag2D[*]}"
515    IGCM_debug_Print 2 -e "\033[1;31mSubmit 2D\033[m without chunck period ${DateBegin}-${DateEnd}"
516    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask"
517    export libIGCM=${libIGCM}
518    export SUBMIT_DIR=${CARD_DIR}
519    export POST_DIR=${POST_DIR}
520    export DateBegin=${DateBegin}
521    export PeriodDateEnd=${DateEnd}
522    export CompletedFlag=${CompletedFlag}
523    export TsTask=2D
524    export listVarEnv=${listVarEnv}
525    IGCM_sys_MkdirWork ${POST_DIR}
526    IGCM_debug_Verif_Exit_Post
527    Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}
528    IGCM_sys_QsubPost create_ts
529    echo
530  else
531    IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit 2D without chunck\033[m period ${DateBegin}-${DateEnd}"
532  fi
533fi
534
535if [ X${Launch3D} = Xtrue ] ; then
536  if [ ${action} = true ] ; then
537    #IGCM_debug_Print 2 "Potentials CompletedFlag: ${PotentialCompletedFlag3D[*]}"
538    IGCM_debug_Print 2 -e "\033[1;31mSubmit 3D\033[m without chunck period ${DateBegin}-${DateEnd}"
539    listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,CompletedFlag,TsTask"
540    export libIGCM=${libIGCM}
541    export SUBMIT_DIR=${CARD_DIR}
542    export POST_DIR=${POST_DIR}
543    export DateBegin=${DateBegin}
544    export PeriodDateEnd=${DateEnd}
545    export CompletedFlag=${CompletedFlag}
546    export TsTask=3D
547    export listVarEnv=${listVarEnv}
548    IGCM_sys_MkdirWork ${POST_DIR}
549    IGCM_debug_Verif_Exit_Post
550    Script_Post_Output=create_ts.${PeriodDateEnd}.${TsTask}
551    IGCM_sys_QsubPost create_ts
552    echo
553  else
554    IGCM_debug_Print 2 -e "\033[1;31mI should NOW submit 3D without chunck\033[m  period ${DateBegin}-${DateEnd}"
555  fi
556fi
Note: See TracBrowser for help on using the repository browser.