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
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 seasonal average 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
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
57#set -vx
58
59#==================================
60# First of all
61#
62typeset option
63
64#==================================
65# Read UserChoices section:
66IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
67echo
68IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
69for option in ${config_UserChoices[*]} ; do
70    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
71    eval auxprint=\${config_UserChoices_${option}}
72    IGCM_debug_Print 3 "${option} : ${auxprint}"
73done
74#
75echo
76
77#==================================
78# Read Post section:
79IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Post
80echo
81IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
82
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
91DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
92DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
93
94IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
95IGCM_date_GetYearMonth ${DateEnd}   YearEnd   MonthEnd
96
97IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
98IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
99echo
100
101#====================================================
102#R_SAVE : Job output directory
103#R_BUFR : Job output buffered directory
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}
107    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
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}
111    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
112    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
113fi
114
115IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
116
117IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
118#
119[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
120
121freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
122
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
152        #
153        if [ X${FileName0} != X${NULL_STR} ] ; then
154            #
155            # INITIALISATION
156            #
157            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
158            typeset i=2
159            #
160            until [ $i -gt $NbFiles ]; do
161                #
162                eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
163                #
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
177                        fi
178                    done
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
206                fi
207                (( i=i+3 )) # to explore file list
208            done            # until [ $i -eq $NbFiles ]
209        fi                  # [ X${FileName0} != X${NULL_STR} ]
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}
220        export SUBMIT_DIR=${CARD_DIR}
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}
233        IGCM_debug_Verif_Exit_Post
234        Script_Post_Output=create_se.${PeriodDateEnd}
235        IGCM_sys_QsubPost create_se
236
237        echo
238    fi
239
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.