source: trunk/libIGCM/AA_SE_Checker @ 1234

Last change on this file since 1234 was 1233, checked in by sdipsl, 9 years ago
  • Enhance SE_Checker behaviour during a simulation by picking up DateEnd? from run.card instead of config.card
  • 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: 8.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=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#===================================#
92# Read updated run.card :
93IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration PeriodDateEnd
94
95#
96DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
97DateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} )
98
99#
100if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
101  PeriodOffset=0
102else
103  PeriodOffset=${config_Post_SeasonalFrequencyOffset}
104fi
105
106IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
107IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
108IGCM_debug_Print 1 "Offset    for SE_Checker : "${PeriodOffset}
109echo
110#
111[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
112
113freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
114
115an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 + PeriodOffset )) )
116an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
117an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
118
119#
120while [ ${an_fin} -le ${an_fin_all} ] ; do
121
122  countTotal=0
123  countGood=0
124  countBad=0
125
126  IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
127
128  for comp in ${config_ListOfComponents[*]} ; do
129    localcountBad=0
130    # Debug Print
131    IGCM_debug_Print 1 ${comp}
132    # Define component
133    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
134    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
135
136    # Read libIGCM compatibility version in ${compname}.card
137    card=${CARD_DIR}/COMP/${compname}.card
138
139    # Read and Build Output File stuff
140    #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
141    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
142    ListFilesName=${compname}_OutputFiles_List
143    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
144    #
145    if [ X${FileName0} != X${NULL_STR} ] ; then
146      #
147      # INITIALISATION
148      #
149      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
150      typeset i=2
151      #
152      until [ $i -gt $NbFiles ]; do
153        #
154        eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
155        #
156        if [ X${flag_post} != XNONE ] ; then
157          #
158          # Check if seasonal is required for this file
159          #
160          IGCM_card_DefineArrayFromSection ${card} ${flag_post}
161          #
162          # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
163          #
164          # variable option allready typeset above
165          for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
166            if [ ${option} = Seasonal ] ; then
167              FoundSeasonal=true
168              IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
169            fi
170          done
171          #
172          if [ ! X${FoundSeasonal} = Xtrue ] ; then
173            eval ${compname}_${flag_post}_Seasonal=ON
174          fi
175          #
176          if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
177            (( i=i+3 ))
178            continue
179          fi
180          #
181          # CREATE LIST
182          #
183          FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
184          #
185          DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
186          #
187          TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
188          #
189          (( countTotal = countTotal + 1 ))
190          IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
191          if [ ! $? = 0 ] ; then
192            eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
193            (( countBad = countBad + 1 ))
194            (( localcountBad = localcountBad + 1 ))
195          else
196            (( countGood = countGood + 1 ))
197          fi
198        fi
199        (( i=i+3 )) # to explore file list
200      done            # until [ $i -eq $NbFiles ]
201    fi                  # [ X${FileName0} != X${NULL_STR} ]
202
203    [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
204  done
205
206  # create_se submit if files don't exist
207  if [ $countGood != $countTotal ] ; then
208    IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
209
210    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"
211    export DEBUG_debug=${DEBUG_debug}
212    export BigBrother=${BigBrother}
213    export libIGCM=${libIGCM}
214    export SUBMIT_DIR=${CARD_DIR}
215    export POST_DIR=${POST_DIR}
216    export DateBegin=${an_deb}
217    export PeriodDateEnd=${an_fin}1231
218    export RebuildFrequency=${RebuildFrequency}
219    export RESOL_ATM=${RESOL_ATM}
220    export RESOL_SRF=${RESOL_SRF}
221    export RESOL_SBG=${RESOL_SBG}
222    export RESOL_OCE=${RESOL_OCE}
223    export RESOL_ICE=${RESOL_ICE}
224    export RESOL_MBG=${RESOL_MBG}
225    export listVarEnv=${listVarEnv}
226    export Script_Post_Output=create_se.${PeriodDateEnd}
227
228    IGCM_sys_MkdirWork ${POST_DIR}
229    IGCM_debug_Verif_Exit
230    IGCM_sys_QsubPost create_se
231
232    echo
233  fi
234
235  (( an_deb = an_deb + freq ))
236  (( an_fin = an_fin + freq ))
237
238done # while
Note: See TracBrowser for help on using the repository browser.