source: trunk/libIGCM/AA_SE_Checker @ 731

Last change on this file since 731 was 731, checked in by sdipsl, 12 years ago
  • bugfix. Need to source libIGCM_config to have access to IGCM_config_CommonConfiguration
  • Property svn:keywords set to Revision Author Date
File size: 7.3 KB
RevLine 
[385]1#!/bin/ksh
[271]2
3#**************************************************************
4# Author: Sebastien Denvil
[396]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
[271]9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
[712]14#D- Task type (computing or post-processing)
15TaskType=post-processing
16
[387]17# Check that everything went well during seasonal average production
[271]18# Display a short report
19# Launch what's missing
[338]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.
[271]22
[554]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.
[271]29libIGCM=${libIGCM:=::modipsl::/libIGCM}
30
[344]31# Expericence class of the run
32ExperimentName=${ExperimentName:=historical}
33
34# Name of this job
[362]35JobName=${JobName:=v2.historical1}
[271]36
[338]37# répertoire courrant
[271]38CURRENT_DIR=$( pwd )
39
[338]40# Emplacement des cartes
[344]41CARD_DIR=${CARD_DIR:=${CURRENT_DIR}/${ExperimentName}/${JobName}}
[271]42
[344]43# répertoire de stockage des sorties des create_ts
[338]44POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
45
[637]46# project
47export BRIDGE_MSUB_PROJECT=gen2211
48
[271]49if [ ! -d ${CARD_DIR} ]; then
50    echo "No ${CARD_DIR}, we stop here"
51    exit
52fi
53
54########################################################################
55
[731]56. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
57       ( ${DEBUG_debug} ) && IGCM_debug_Check
58. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
59       ( ${DEBUG_debug} ) && IGCM_card_Check
60. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
61       ( ${DEBUG_debug} ) && IGCM_date_Check
62#-------
63. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
64. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
[271]65
66########################################################################
67
[362]68#set -vx
69
[616]70#==================================
[271]71# First of all
[616]72#
[727]73# Read libIGCM compatibility version in config.card
74# Read UserChoices section
75# Read Ensemble section
76# Read Post section
77# Define all netcdf output directories
[616]78#==================================
[727]79IGCM_config_CommonConfiguration ${CARD_DIR}/config.card
[271]80
[616]81#==================================
[727]82# Read ListOfComponents section:
83IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
[658]84
85#==================================
[727]86# Read SeasonalFrequency:
87IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
[338]88
[616]89#
[385]90DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
[362]91DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
[338]92
[362]93IGCM_date_GetYearMonth ${DateBegin} YearBegin MonthBegin
[338]94IGCM_date_GetYearMonth ${DateEnd}   YearEnd   MonthEnd
[362]95
[385]96IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
97IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
[362]98echo
[385]99#
100[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
[271]101
[385]102freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
[271]103
[385]104an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 )) )
105an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
106an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
107
108#
109while [ ${an_fin} -le ${an_fin_all} ] ; do
110
111    countTotal=0
112    countGood=0
113    countBad=0
114   
115    IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
116   
117    for comp in ${config_ListOfComponents[*]} ; do
118        localcountBad=0
119        # Debug Print
120        IGCM_debug_Print 1 ${comp}
121        # Define component
122        IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
123        eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
124       
125        # Read libIGCM compatibility version in ${compname}.card
126        card=${CARD_DIR}/COMP/${compname}.card
127       
128        # Read and Build Output File stuff
129        #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
130        IGCM_card_DefineArrayFromOption ${card} OutputFiles List
131        ListFilesName=${compname}_OutputFiles_List
132        eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
[271]133        #
[385]134        if [ X${FileName0} != X${NULL_STR} ] ; then
[271]135            #
[385]136            # INITIALISATION
[271]137            #
[385]138            eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
139            typeset i=2
140            #
141            until [ $i -gt $NbFiles ]; do
[271]142                #
[385]143                eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
[271]144                #
[385]145                if [ X${flag_post} != XNONE ] ; then
146                    #
147                    # Check if seasonal is required for this file
148                    #
149                    IGCM_card_DefineArrayFromSection ${card} ${flag_post}
150                    #
151                    # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
152                    #
153                    # variable option allready typeset above
154                    for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
155                        if [ ${option} = Seasonal ] ; then
156                            FoundSeasonal=true
157                            IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
[271]158                        fi
159                    done
[385]160                    #
161                    if [ ! X${FoundSeasonal} = Xtrue ] ; then
162                        eval ${compname}_${flag_post}_Seasonal=ON
163                    fi
164                    #
165                    if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
166                        (( i=i+3 ))
167                        continue
168                    fi
169                    #
170                    # CREATE LIST
171                    #
172                    FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
173                    #
174                    DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
175                    #
176                    TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
177                    #
178                    (( countTotal = countTotal + 1 ))
179                    IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
180                    if [ ! $? = 0 ] ; then
181                        eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
182                        (( countBad = countBad + 1 ))
183                        (( localcountBad = localcountBad + 1 ))
184                    else
185                        (( countGood = countGood + 1 ))
186                    fi
[271]187                fi
[385]188                (( i=i+3 )) # to explore file list
[387]189            done            # until [ $i -eq $NbFiles ]
190        fi                  # [ X${FileName0} != X${NULL_STR} ]
[385]191       
192        [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
193    done
194   
195    # create_se submit if files don't exist
196    if [ $countGood != $countTotal ] ; then
197        IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
198       
199        listVarEnv="libIGCM,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG"
200        export libIGCM=${libIGCM}
[411]201        export SUBMIT_DIR=${CARD_DIR}
[385]202        export POST_DIR=${POST_DIR}
203        export DateBegin=${an_deb}
204        export PeriodDateEnd=${an_fin}1231
205        export RebuildFrequency=${RebuildFrequency}
206        export RESOL_ATM=${RESOL_ATM}
207        export RESOL_SRF=${RESOL_SRF}
208        export RESOL_SBG=${RESOL_SBG}
209        export RESOL_OCE=${RESOL_OCE}
210        export RESOL_ICE=${RESOL_ICE}
211        export RESOL_MBG=${RESOL_MBG}
212        export listVarEnv=${listVarEnv}
213        IGCM_sys_MkdirWork ${POST_DIR}
[436]214        IGCM_debug_Verif_Exit_Post
[387]215        Script_Post_Output=create_se.${PeriodDateEnd}
[385]216        IGCM_sys_QsubPost create_se
217
218        echo
[271]219    fi
220
[385]221    (( an_deb = an_deb + freq ))
222    (( an_fin = an_fin + freq ))
223   
224done # while
Note: See TracBrowser for help on using the repository browser.