source: trunk/libIGCM/AA_SE_Checker @ 835

Last change on this file since 835 was 832, checked in by sdipsl, 11 years ago
  • Trivial changes to accomodate new_libIGCM function defined here /ccc/cont003/home/dsm/p86mart/.bash_alias (ksh-->bash)

She transforms every cp and rm by IGCM_sys_Cp and IGCM_sys_Rm within IGCM_debug_Check. So we need to source sys before calling it.

  • Property svn:keywords set to Revision Author Date
File size: 7.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#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_card/libIGCM_card.ksh
58. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
59#-------
60. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
61. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
62#-------
63( ${DEBUG_debug} ) && IGCM_debug_Check
64( ${DEBUG_debug} ) && IGCM_card_Check
65( ${DEBUG_debug} ) && IGCM_date_Check
66
67########################################################################
68
69#set -vx
70
71#==================================
72# First of all
73#
74# Read libIGCM compatibility version in config.card
75# Read UserChoices section
76# Read Ensemble section
77# Read Post section
78# Define all netcdf output directories
79#==================================
80IGCM_config_CommonConfiguration ${CARD_DIR}/config.card
81
82#==================================
83# Read ListOfComponents section:
84IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
85
86#==================================
87# Read SeasonalFrequency:
88IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
89
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[ 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=${CARD_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_Post
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.