source: trunk/libIGCM/AA_SE_Checker @ 1112

Last change on this file since 1112 was 1112, checked in by sdipsl, 10 years ago
  • clean up environment variable list flowing through jobs
  • Some addons to this list to be able to save stack files in /Out
  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Revision Author Date
File size: 7.6 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 when a simulation has been completed PeriodState=Completed
20
21#D- Path to libIGCM
22#D- Default : value from AA_job if any
23# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
24# WARNING you must check MirrorlibIGCM variable in sys library.
25# WARNING If this variable is true, you must use libIGCM_POST path instead
26# WARNING of your running libIGCM directory.
27libIGCM=${libIGCM:=::modipsl::/libIGCM}
28
29# Expericence class of the run
30ExperimentName=${ExperimentName:=historical}
31
32# Name of this job
33JobName=${JobName:=v2.historical1}
34
35# répertoire courrant
36CURRENT_DIR=$( pwd )
37
38# Emplacement des cartes
39CARD_DIR=${CARD_DIR:=${CURRENT_DIR}/${ExperimentName}/${JobName}}
40
41# répertoire de stockage des sorties des create_ts
42POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
43
44if [ ! -d ${CARD_DIR} ]; then
45  echo "No ${CARD_DIR}, we stop here"
46  exit
47fi
48
49########################################################################
50
51. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
52. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
53. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
54#-------
55. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
56. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
57#-------
58( ${DEBUG_debug} ) && IGCM_debug_Check
59( ${DEBUG_debug} ) && IGCM_card_Check
60( ${DEBUG_debug} ) && IGCM_date_Check
61
62########################################################################
63
64#set -vx
65
66#==================================
67# First of all
68#
69# Read libIGCM compatibility version in config.card
70# Read UserChoices section
71# Read Ensemble section
72# Read Post section
73# Define all netcdf output directories
74#==================================
75IGCM_config_CommonConfiguration ${CARD_DIR}/config.card
76
77#==================================
78# Read ListOfComponents section:
79IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
80
81#==================================
82# Read SeasonalFrequency:
83IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
84
85#
86DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
87DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
88
89#
90if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
91  PeriodOffset=0
92else
93  PeriodOffset=${config_Post_SeasonalFrequencyOffset}
94fi
95
96IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
97IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
98IGCM_debug_Print 1 "Offset    for SE_Checker : "${PeriodOffset}
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 + PeriodOffset )) )
106an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
107an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
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,Script_Post_Output,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    export Script_Post_Output=create_se.${PeriodDateEnd}
215
216    IGCM_sys_MkdirWork ${POST_DIR}
217    IGCM_debug_Verif_Exit_Post
218    IGCM_sys_QsubPost create_se
219
220    echo
221  fi
222
223  (( an_deb = an_deb + freq ))
224  (( an_fin = an_fin + freq ))
225
226done # while
Note: See TracBrowser for help on using the repository browser.