source: trunk/libIGCM/AA_SE_Checker @ 1206

Last change on this file since 1206 was 1206, checked in by sdipsl, 9 years ago
  • Remove IGCM_debug_Verif_Exit_Post. Only IGCM_debug_Verif_Exit will manage exit cases.
  • 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.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#D- Task type (computing or post-processing)
15TaskType=checking
16
17#D- Low level debug : to perform lib test checks, stack construction and IO functions instrumentation
18DEBUG_debug=false
19
20#D- Messaging : all activities and call stacks will be sent to ipsl servers
21BigBrother=false
22
23# Check that everything went well during seasonal average production
24# Display a short report
25# Launch what's missing when a simulation has been completed PeriodState=Completed
26
27#D- Path to libIGCM
28#D- Default : value from AA_job if any
29# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
30# WARNING you must check MirrorlibIGCM variable in sys library.
31# WARNING If this variable is true, you must use libIGCM_POST path instead
32# WARNING of your running libIGCM directory.
33libIGCM=${libIGCM:=::modipsl::/libIGCM}
34
35# Expericence class of the run
36ExperimentName=${ExperimentName:=historical}
37
38# Name of this job
39JobName=${JobName:=v2.historical1}
40
41# répertoire courrant
42CURRENT_DIR=$( pwd )
43
44# Emplacement des cartes
45CARD_DIR=${CARD_DIR:=${CURRENT_DIR}/${ExperimentName}/${JobName}}
46
47# répertoire de stockage des sorties des create_ts
48POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
49
50if [ ! -d ${CARD_DIR} ]; then
51  echo "No ${CARD_DIR}, we stop here"
52  exit
53fi
54
55########################################################################
56
57. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
58. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
59. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
60#-------
61. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
62. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
63#-------
64( ${DEBUG_debug} ) && IGCM_debug_Check
65( ${DEBUG_debug} ) && IGCM_card_Check
66( ${DEBUG_debug} ) && IGCM_date_Check
67
68########################################################################
69
70#set -vx
71
72#==================================
73# First of all
74#
75# Read libIGCM compatibility version in config.card
76# Read UserChoices section
77# Read Ensemble section
78# Read Post section
79# Define all netcdf output directories
80#==================================
81IGCM_config_CommonConfiguration ${CARD_DIR}/config.card
82
83#==================================
84# Read ListOfComponents section:
85IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
86
87#==================================
88# Read SeasonalFrequency:
89IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
90
91#
92DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
93DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
94
95#
96if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
97  PeriodOffset=0
98else
99  PeriodOffset=${config_Post_SeasonalFrequencyOffset}
100fi
101
102IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
103IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
104IGCM_debug_Print 1 "Offset    for SE_Checker : "${PeriodOffset}
105echo
106#
107[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
108
109freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
110
111an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 + PeriodOffset )) )
112an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
113an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
114
115#
116while [ ${an_fin} -le ${an_fin_all} ] ; do
117
118  countTotal=0
119  countGood=0
120  countBad=0
121
122  IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
123
124  for comp in ${config_ListOfComponents[*]} ; do
125    localcountBad=0
126    # Debug Print
127    IGCM_debug_Print 1 ${comp}
128    # Define component
129    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
130    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
131
132    # Read libIGCM compatibility version in ${compname}.card
133    card=${CARD_DIR}/COMP/${compname}.card
134
135    # Read and Build Output File stuff
136    #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
137    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
138    ListFilesName=${compname}_OutputFiles_List
139    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
140    #
141    if [ X${FileName0} != X${NULL_STR} ] ; then
142      #
143      # INITIALISATION
144      #
145      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
146      typeset i=2
147      #
148      until [ $i -gt $NbFiles ]; do
149        #
150        eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
151        #
152        if [ X${flag_post} != XNONE ] ; then
153          #
154          # Check if seasonal is required for this file
155          #
156          IGCM_card_DefineArrayFromSection ${card} ${flag_post}
157          #
158          # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
159          #
160          # variable option allready typeset above
161          for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
162            if [ ${option} = Seasonal ] ; then
163              FoundSeasonal=true
164              IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
165            fi
166          done
167          #
168          if [ ! X${FoundSeasonal} = Xtrue ] ; then
169            eval ${compname}_${flag_post}_Seasonal=ON
170          fi
171          #
172          if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
173            (( i=i+3 ))
174            continue
175          fi
176          #
177          # CREATE LIST
178          #
179          FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
180          #
181          DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
182          #
183          TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
184          #
185          (( countTotal = countTotal + 1 ))
186          IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
187          if [ ! $? = 0 ] ; then
188            eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
189            (( countBad = countBad + 1 ))
190            (( localcountBad = localcountBad + 1 ))
191          else
192            (( countGood = countGood + 1 ))
193          fi
194        fi
195        (( i=i+3 )) # to explore file list
196      done            # until [ $i -eq $NbFiles ]
197    fi                  # [ X${FileName0} != X${NULL_STR} ]
198
199    [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
200  done
201
202  # create_se submit if files don't exist
203  if [ $countGood != $countTotal ] ; then
204    IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
205
206    listVarEnv="DEBUG_debug,BigBrother,libIGCM,SUBMIT_DIR,POST_DIR,Script_Post_Output,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG"
207    export DEBUG_debug=${DEBUG_debug}
208    export BigBrother=${BigBrother}
209    export libIGCM=${libIGCM}
210    export SUBMIT_DIR=${CARD_DIR}
211    export POST_DIR=${POST_DIR}
212    export DateBegin=${an_deb}
213    export PeriodDateEnd=${an_fin}1231
214    export RebuildFrequency=${RebuildFrequency}
215    export RESOL_ATM=${RESOL_ATM}
216    export RESOL_SRF=${RESOL_SRF}
217    export RESOL_SBG=${RESOL_SBG}
218    export RESOL_OCE=${RESOL_OCE}
219    export RESOL_ICE=${RESOL_ICE}
220    export RESOL_MBG=${RESOL_MBG}
221    export listVarEnv=${listVarEnv}
222    export Script_Post_Output=create_se.${PeriodDateEnd}
223
224    IGCM_sys_MkdirWork ${POST_DIR}
225    IGCM_debug_Verif_Exit
226    IGCM_sys_QsubPost create_se
227
228    echo
229  fi
230
231  (( an_deb = an_deb + freq ))
232  (( an_fin = an_fin + freq ))
233
234done # while
Note: See TracBrowser for help on using the repository browser.