source: trunk/libIGCM/AA_SE_Checker @ 396

Last change on this file since 396 was 396, checked in by sdipsl, 13 years ago
  • More verbosity and interactions between TSC script and users
  • Put back in trunk cesium consolidation
  • cosmetics
  • Property svn:keywords set to Revision Author Date
File size: 7.9 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# Chemin vers libIGCM
21libIGCM=${libIGCM:=::modipsl::/libIGCM}
22# Attention : à changer si la machine de post-traitement n'est pas la frontale du serveur de calcul !
23#             voir précence de la variable MirrorlibIGCM dans votre couche systÚme.
24
25# Name Space of this experience
26SpaceName=${SpaceName:=PROD}
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
88if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
89    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
90    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
91    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
92else
93    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
94    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
95fi
96
97IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
98
99IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
100#
101[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
102
103freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
104
105an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 )) )
106an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
107an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
108
109#
110while [ ${an_fin} -le ${an_fin_all} ] ; do
111
112    countTotal=0
113    countGood=0
114    countBad=0
115   
116    IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
117   
118    for comp in ${config_ListOfComponents[*]} ; do
119        localcountBad=0
120        # Debug Print
121        IGCM_debug_Print 1 ${comp}
122        # Define component
123        IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
124        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
125       
126        # Read libIGCM compatibility version in ${compname}.card
127        card=${CARD_DIR}/COMP/${compname}.card
128       
129        # Read and Build Output File stuff
130        #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
131        IGCM_card_DefineArrayFromOption ${card} OutputFiles List
132        ListFilesName=${compname}_OutputFiles_List
133        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
134        #
135        if [ X${FileName0} != X${NULL_STR} ] ; then
136            #
137            # INITIALISATION
138            #
139            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
140            typeset i=2
141            #
142            until [ $i -gt $NbFiles ]; do
143                #
144                eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
145                #
146                if [ X${flag_post} != XNONE ] ; then
147                    #
148                    # Check if seasonal is required for this file
149                    #
150                    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
151                    #
152                    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
153                    #
154                    # variable option allready typeset above
155                    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
156                        if [ ${option} = Seasonal ] ; then
157                            FoundSeasonal=true
158                            IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
159                        fi
160                    done
161                    #
162                    if [ ! X${FoundSeasonal} = Xtrue ] ; then
163                        eval ${compname}_${flag_post}_Seasonal=ON
164                    fi
165                    #
166                    if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
167                        (( i=i+3 ))
168                        continue
169                    fi
170                    #
171                    # CREATE LIST
172                    #
173                    FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
174                    #
175                    DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
176                    #
177                    TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
178                    #
179                    (( countTotal = countTotal + 1 ))
180                    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
181                    if [ ! $? = 0 ] ; then
182                        eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
183                        (( countBad = countBad + 1 ))
184                        (( localcountBad = localcountBad + 1 ))
185                    else
186                        (( countGood = countGood + 1 ))
187                    fi
188                fi
189                (( i=i+3 )) # to explore file list
190            done            # until [ $i -eq $NbFiles ]
191        fi                  # [ X${FileName0} != X${NULL_STR} ]
192       
193        [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
194    done
195   
196    # create_se submit if files don't exist
197    if [ $countGood != $countTotal ] ; then
198        IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
199       
200        listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG"
201        export libIGCM=${libIGCM}
202        export SUBMIT_DIR=${SUBMIT_DIR}
203        export POST_DIR=${POST_DIR}
204        export DateBegin=${an_deb}
205        export PeriodDateEnd=${an_fin}1231
206        export RebuildFrequency=${RebuildFrequency}
207        export RESOL_ATM=${RESOL_ATM}
208        export RESOL_SRF=${RESOL_SRF}
209        export RESOL_SBG=${RESOL_SBG}
210        export RESOL_OCE=${RESOL_OCE}
211        export RESOL_ICE=${RESOL_ICE}
212        export RESOL_MBG=${RESOL_MBG}
213        export listVarEnv=${listVarEnv}
214        IGCM_sys_MkdirWork ${POST_DIR}
215        IGCM_debug_Verif_Exit
216        Script_Post_Output=create_se.${PeriodDateEnd}
217        IGCM_sys_QsubPost create_se
218
219        echo
220    fi
221
222    (( an_deb = an_deb + freq ))
223    (( an_fin = an_fin + freq ))
224   
225done # while
Note: See TracBrowser for help on using the repository browser.