source: branches/libIGCM_MPI_OpenMP/AA_SE_Checker @ 593

Last change on this file since 593 was 571, checked in by mafoipsl, 12 years ago

First try to merge libIGCM_MPI_OpenMP branch with libIGCM trunk revision 569. Tested on vargas with PackFrequency?=NONE included into config.card.

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