source: branches/libIGCM_MPI_OpenMP/AA_SE_Checker

Last change on this file was 602, checked in by mafoipsl, 12 years ago

Use AA_TimeSeroes_Checker as a model for AA_SE_Checker.

  • Property svn:keywords set to Revision Author Date
File size: 8.4 KB
RevLine 
[385]1#!/bin/ksh
[271]2
3#**************************************************************
4# Author: Sebastien Denvil
[396]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
[271]9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
[387]14# Check that everything went well during seasonal average production
[271]15# Display a short report
16# Launch what's missing
[338]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.
[271]19
[571]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.
[271]26libIGCM=${libIGCM:=::modipsl::/libIGCM}
27
[344]28# Expericence class of the run
29ExperimentName=${ExperimentName:=historical}
30
31# Name of this job
[362]32JobName=${JobName:=v2.historical1}
[271]33
[338]34# répertoire courrant
[271]35CURRENT_DIR=$( pwd )
36
[338]37# Emplacement des cartes
[344]38CARD_DIR=${CARD_DIR:=${CURRENT_DIR}/${ExperimentName}/${JobName}}
[271]39
[344]40# répertoire de stockage des sorties des create_ts
[338]41POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
42
[271]43if [ ! -d ${CARD_DIR} ]; then
44    echo "No ${CARD_DIR}, we stop here"
45    exit
46fi
47
48########################################################################
49
50. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
51. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     #; IGCM_debug_Check
52. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   #; IGCM_card_Check
53. ${libIGCM}/libIGCM_date/libIGCM_date.ksh   #; IGCM_date_Check
54
55########################################################################
56
[362]57#set -vx
58
[602]59#==================================
[271]60# First of all
[602]61#
62typeset option
63
64#==================================
65# Read UserChoices section:
[271]66IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
[602]67echo
68IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
[271]69for option in ${config_UserChoices[*]} ; do
70    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
[602]71    eval auxprint=\${config_UserChoices_${option}}
72    IGCM_debug_Print 3 "${option} : ${auxprint}"
[271]73done
[602]74#
75echo
[271]76
[602]77#==================================
78# Read Post section:
79IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Post
[271]80echo
[602]81IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
[338]82
[602]83for option in ${config_Post[*]} ; do
84  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post ${option}
85  eval auxprint=\${config_Post_${option}}
86  IGCM_debug_Print 3 "${option} : ${auxprint}"
87done
88#
89echo
90
[385]91DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
[362]92DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
[338]93
[362]94IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
[338]95IGCM_date_GetYearMonth ${DateEnd}   YearEnd   MonthEnd
[362]96
[385]97IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
98IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
[362]99echo
[271]100
101#====================================================
102#R_SAVE : Job output directory
[571]103#R_BUFR : Job output buffered directory
[271]104if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
105    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
106    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
[571]107    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
[271]108    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
109else
110    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
[571]111    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
[271]112    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
113fi
114
115IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
116
[385]117IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
118#
119[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
[271]120
[385]121freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
[271]122
[385]123an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 )) )
124an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
125an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
126
127#
128while [ ${an_fin} -le ${an_fin_all} ] ; do
129
130    countTotal=0
131    countGood=0
132    countBad=0
133   
134    IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
135   
136    for comp in ${config_ListOfComponents[*]} ; do
137        localcountBad=0
138        # Debug Print
139        IGCM_debug_Print 1 ${comp}
140        # Define component
141        IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
142        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
143       
144        # Read libIGCM compatibility version in ${compname}.card
145        card=${CARD_DIR}/COMP/${compname}.card
146       
147        # Read and Build Output File stuff
148        #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
149        IGCM_card_DefineArrayFromOption ${card} OutputFiles List
150        ListFilesName=${compname}_OutputFiles_List
151        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
[271]152        #
[385]153        if [ X${FileName0} != X${NULL_STR} ] ; then
[271]154            #
[385]155            # INITIALISATION
[271]156            #
[385]157            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
158            typeset i=2
159            #
160            until [ $i -gt $NbFiles ]; do
[271]161                #
[385]162                eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
[271]163                #
[385]164                if [ X${flag_post} != XNONE ] ; then
165                    #
166                    # Check if seasonal is required for this file
167                    #
168                    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
169                    #
170                    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
171                    #
172                    # variable option allready typeset above
173                    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
174                        if [ ${option} = Seasonal ] ; then
175                            FoundSeasonal=true
176                            IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
[271]177                        fi
178                    done
[385]179                    #
180                    if [ ! X${FoundSeasonal} = Xtrue ] ; then
181                        eval ${compname}_${flag_post}_Seasonal=ON
182                    fi
183                    #
184                    if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
185                        (( i=i+3 ))
186                        continue
187                    fi
188                    #
189                    # CREATE LIST
190                    #
191                    FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
192                    #
193                    DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
194                    #
195                    TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
196                    #
197                    (( countTotal = countTotal + 1 ))
198                    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
199                    if [ ! $? = 0 ] ; then
200                        eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
201                        (( countBad = countBad + 1 ))
202                        (( localcountBad = localcountBad + 1 ))
203                    else
204                        (( countGood = countGood + 1 ))
205                    fi
[271]206                fi
[385]207                (( i=i+3 )) # to explore file list
[387]208            done            # until [ $i -eq $NbFiles ]
209        fi                  # [ X${FileName0} != X${NULL_STR} ]
[385]210       
211        [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
212    done
213   
214    # create_se submit if files don't exist
215    if [ $countGood != $countTotal ] ; then
216        IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
217       
218        listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG"
219        export libIGCM=${libIGCM}
[411]220        export SUBMIT_DIR=${CARD_DIR}
[385]221        export POST_DIR=${POST_DIR}
222        export DateBegin=${an_deb}
223        export PeriodDateEnd=${an_fin}1231
224        export RebuildFrequency=${RebuildFrequency}
225        export RESOL_ATM=${RESOL_ATM}
226        export RESOL_SRF=${RESOL_SRF}
227        export RESOL_SBG=${RESOL_SBG}
228        export RESOL_OCE=${RESOL_OCE}
229        export RESOL_ICE=${RESOL_ICE}
230        export RESOL_MBG=${RESOL_MBG}
231        export listVarEnv=${listVarEnv}
232        IGCM_sys_MkdirWork ${POST_DIR}
[436]233        IGCM_debug_Verif_Exit_Post
[387]234        Script_Post_Output=create_se.${PeriodDateEnd}
[385]235        IGCM_sys_QsubPost create_se
236
237        echo
[271]238    fi
239
[385]240    (( an_deb = an_deb + freq ))
241    (( an_fin = an_fin + freq ))
242   
243done # while
Note: See TracBrowser for help on using the repository browser.