source: tags/libIGCM_v2.0_beta1/AA_SE_Checker @ 1170

Last change on this file since 1170 was 637, checked in by mafoipsl, 12 years ago

Allow different number of proc on titane, vargas and curie. Add default porject number in SE_Checker.

  • Property svn:keywords set to Revision Author Date
File size: 8.5 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
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
62#==================================
63# First of all
64#
65typeset option
66
67#==================================
68# Read UserChoices section:
69IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
70echo
71IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
72for option in ${config_UserChoices[*]} ; do
73    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
74    eval auxprint=\${config_UserChoices_${option}}
75    IGCM_debug_Print 3 "${option} : ${auxprint}"
76done
77#
78echo
79
80#==================================
81# Read Post section:
82IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Post
83echo
84IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
85
86for option in ${config_Post[*]} ; do
87  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post ${option}
88  eval auxprint=\${config_Post_${option}}
89  IGCM_debug_Print 3 "${option} : ${auxprint}"
90done
91#
92echo
93
94DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
95DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
96
97IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
98IGCM_date_GetYearMonth ${DateEnd}   YearEnd   MonthEnd
99
100IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
101IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
102echo
103
104#====================================================
105#R_SAVE : Job output directory
106#R_BUFR : Job output buffered directory
107if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
108    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
109    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
110    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
111    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
112else
113    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
114    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
115    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
116fi
117
118IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
119
120IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
121#
122[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
123
124freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
125
126an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 )) )
127an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
128an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
129
130#
131while [ ${an_fin} -le ${an_fin_all} ] ; do
132
133    countTotal=0
134    countGood=0
135    countBad=0
136   
137    IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
138   
139    for comp in ${config_ListOfComponents[*]} ; do
140        localcountBad=0
141        # Debug Print
142        IGCM_debug_Print 1 ${comp}
143        # Define component
144        IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
145        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
146       
147        # Read libIGCM compatibility version in ${compname}.card
148        card=${CARD_DIR}/COMP/${compname}.card
149       
150        # Read and Build Output File stuff
151        #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
152        IGCM_card_DefineArrayFromOption ${card} OutputFiles List
153        ListFilesName=${compname}_OutputFiles_List
154        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
155        #
156        if [ X${FileName0} != X${NULL_STR} ] ; then
157            #
158            # INITIALISATION
159            #
160            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
161            typeset i=2
162            #
163            until [ $i -gt $NbFiles ]; do
164                #
165                eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
166                #
167                if [ X${flag_post} != XNONE ] ; then
168                    #
169                    # Check if seasonal is required for this file
170                    #
171                    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
172                    #
173                    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
174                    #
175                    # variable option allready typeset above
176                    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
177                        if [ ${option} = Seasonal ] ; then
178                            FoundSeasonal=true
179                            IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
180                        fi
181                    done
182                    #
183                    if [ ! X${FoundSeasonal} = Xtrue ] ; then
184                        eval ${compname}_${flag_post}_Seasonal=ON
185                    fi
186                    #
187                    if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
188                        (( i=i+3 ))
189                        continue
190                    fi
191                    #
192                    # CREATE LIST
193                    #
194                    FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
195                    #
196                    DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
197                    #
198                    TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
199                    #
200                    (( countTotal = countTotal + 1 ))
201                    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
202                    if [ ! $? = 0 ] ; then
203                        eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
204                        (( countBad = countBad + 1 ))
205                        (( localcountBad = localcountBad + 1 ))
206                    else
207                        (( countGood = countGood + 1 ))
208                    fi
209                fi
210                (( i=i+3 )) # to explore file list
211            done            # until [ $i -eq $NbFiles ]
212        fi                  # [ X${FileName0} != X${NULL_STR} ]
213       
214        [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
215    done
216   
217    # create_se submit if files don't exist
218    if [ $countGood != $countTotal ] ; then
219        IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
220       
221        listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG"
222        export libIGCM=${libIGCM}
223        export SUBMIT_DIR=${CARD_DIR}
224        export POST_DIR=${POST_DIR}
225        export DateBegin=${an_deb}
226        export PeriodDateEnd=${an_fin}1231
227        export RebuildFrequency=${RebuildFrequency}
228        export RESOL_ATM=${RESOL_ATM}
229        export RESOL_SRF=${RESOL_SRF}
230        export RESOL_SBG=${RESOL_SBG}
231        export RESOL_OCE=${RESOL_OCE}
232        export RESOL_ICE=${RESOL_ICE}
233        export RESOL_MBG=${RESOL_MBG}
234        export listVarEnv=${listVarEnv}
235        IGCM_sys_MkdirWork ${POST_DIR}
236        IGCM_debug_Verif_Exit_Post
237        Script_Post_Output=create_se.${PeriodDateEnd}
238        IGCM_sys_QsubPost create_se
239
240        echo
241    fi
242
243    (( an_deb = an_deb + freq ))
244    (( an_fin = an_fin + freq ))
245   
246done # while
Note: See TracBrowser for help on using the repository browser.