source: trunk/libIGCM/AA_SE_Checker @ 721

Last change on this file since 721 was 712, checked in by aclsce, 12 years ago
  • Added TaskType? variable in jobs to specify the type of the job (computing or post-processing).
  • Added the use of TaskType? variable in Curie libsys to source the appropriate .atlas_env* configuration file.
  • Property svn:keywords set to Revision Author Date
File size: 10.1 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#D- Task type (computing or post-processing)
15TaskType=post-processing
16
17# Check that everything went well during seasonal average production
18# Display a short report
19# Launch what's missing
20# For use during a run (not on the end : PeriodState=Completed), it will complete
21# all TS to last PeriodDateEnd value, give by run.card->Configuration->OldPrefix string.
22
23#D- Path to libIGCM
24#D- Default : value from AA_job if any
25# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
26# WARNING you must check MirrorlibIGCM variable in sys library.
27# WARNING If this variable is true, you must use libIGCM_POST path instead
28# WARNING of your running libIGCM directory.
29libIGCM=${libIGCM:=::modipsl::/libIGCM}
30
31# Expericence class of the run
32ExperimentName=${ExperimentName:=historical}
33
34# Name of this job
35JobName=${JobName:=v2.historical1}
36
37# répertoire courrant
38CURRENT_DIR=$( pwd )
39
40# Emplacement des cartes
41CARD_DIR=${CARD_DIR:=${CURRENT_DIR}/${ExperimentName}/${JobName}}
42
43# répertoire de stockage des sorties des create_ts
44POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
45
46# project
47export BRIDGE_MSUB_PROJECT=gen2211
48
49if [ ! -d ${CARD_DIR} ]; then
50    echo "No ${CARD_DIR}, we stop here"
51    exit
52fi
53
54########################################################################
55
56. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ;
57. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh     #; IGCM_debug_Check
58. ${libIGCM}/libIGCM_card/libIGCM_card.ksh   #; IGCM_card_Check
59. ${libIGCM}/libIGCM_date/libIGCM_date.ksh   #; IGCM_date_Check
60
61########################################################################
62
63#set -vx
64
65#==================================
66# First of all
67#
68typeset option
69
70#==================================
71# Read UserChoices section:
72IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
73echo
74IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
75for option in ${config_UserChoices[*]} ; do
76    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
77    eval auxprint=\${config_UserChoices_${option}}
78    IGCM_debug_Print 3 "${option} : ${auxprint}"
79done
80#
81echo
82
83#==================================
84# Read Ensemble section:
85IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card Ensemble
86echo
87
88for option in ${config_Ensemble[*]} ; do
89    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Ensemble ${option}
90    eval auxprint=\${config_Ensemble_${option}}
91    IGCM_debug_Print 3 "${option} : ${auxprint}"
92done
93#
94echo
95
96#==================================
97# Read Post section:
98IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Post
99echo
100IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
101
102for option in ${config_Post[*]} ; do
103  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post ${option}
104  eval auxprint=\${config_Post_${option}}
105  IGCM_debug_Print 3 "${option} : ${auxprint}"
106done
107#
108echo
109
110DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
111DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
112
113IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
114IGCM_date_GetYearMonth ${DateEnd}   YearEnd   MonthEnd
115
116IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
117IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
118echo
119
120#====================================================
121#R_SAVE : Job output directory
122#R_BUFR : Job output buffered directory
123if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
124  FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
125  if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
126    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
127    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
128    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
129  else
130    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
131    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
132    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
133  fi
134else
135  if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
136    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
137    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
138    R_DODS=${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
139  else
140    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
141    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
142    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
143  fi
144fi
145
146IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
147
148IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
149#
150[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
151
152freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
153
154an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 )) )
155an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
156an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
157
158#
159while [ ${an_fin} -le ${an_fin_all} ] ; do
160
161    countTotal=0
162    countGood=0
163    countBad=0
164   
165    IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
166   
167    for comp in ${config_ListOfComponents[*]} ; do
168        localcountBad=0
169        # Debug Print
170        IGCM_debug_Print 1 ${comp}
171        # Define component
172        IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
173        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
174       
175        # Read libIGCM compatibility version in ${compname}.card
176        card=${CARD_DIR}/COMP/${compname}.card
177       
178        # Read and Build Output File stuff
179        #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
180        IGCM_card_DefineArrayFromOption ${card} OutputFiles List
181        ListFilesName=${compname}_OutputFiles_List
182        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
183        #
184        if [ X${FileName0} != X${NULL_STR} ] ; then
185            #
186            # INITIALISATION
187            #
188            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
189            typeset i=2
190            #
191            until [ $i -gt $NbFiles ]; do
192                #
193                eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
194                #
195                if [ X${flag_post} != XNONE ] ; then
196                    #
197                    # Check if seasonal is required for this file
198                    #
199                    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
200                    #
201                    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
202                    #
203                    # variable option allready typeset above
204                    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
205                        if [ ${option} = Seasonal ] ; then
206                            FoundSeasonal=true
207                            IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
208                        fi
209                    done
210                    #
211                    if [ ! X${FoundSeasonal} = Xtrue ] ; then
212                        eval ${compname}_${flag_post}_Seasonal=ON
213                    fi
214                    #
215                    if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
216                        (( i=i+3 ))
217                        continue
218                    fi
219                    #
220                    # CREATE LIST
221                    #
222                    FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
223                    #
224                    DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
225                    #
226                    TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
227                    #
228                    (( countTotal = countTotal + 1 ))
229                    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
230                    if [ ! $? = 0 ] ; then
231                        eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
232                        (( countBad = countBad + 1 ))
233                        (( localcountBad = localcountBad + 1 ))
234                    else
235                        (( countGood = countGood + 1 ))
236                    fi
237                fi
238                (( i=i+3 )) # to explore file list
239            done            # until [ $i -eq $NbFiles ]
240        fi                  # [ X${FileName0} != X${NULL_STR} ]
241       
242        [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
243    done
244   
245    # create_se submit if files don't exist
246    if [ $countGood != $countTotal ] ; then
247        IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
248       
249        listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG"
250        export libIGCM=${libIGCM}
251        export SUBMIT_DIR=${CARD_DIR}
252        export POST_DIR=${POST_DIR}
253        export DateBegin=${an_deb}
254        export PeriodDateEnd=${an_fin}1231
255        export RebuildFrequency=${RebuildFrequency}
256        export RESOL_ATM=${RESOL_ATM}
257        export RESOL_SRF=${RESOL_SRF}
258        export RESOL_SBG=${RESOL_SBG}
259        export RESOL_OCE=${RESOL_OCE}
260        export RESOL_ICE=${RESOL_ICE}
261        export RESOL_MBG=${RESOL_MBG}
262        export listVarEnv=${listVarEnv}
263        IGCM_sys_MkdirWork ${POST_DIR}
264        IGCM_debug_Verif_Exit_Post
265        Script_Post_Output=create_se.${PeriodDateEnd}
266        IGCM_sys_QsubPost create_se
267
268        echo
269    fi
270
271    (( an_deb = an_deb + freq ))
272    (( an_fin = an_fin + freq ))
273   
274done # while
Note: See TracBrowser for help on using the repository browser.