source: trunk/libIGCM/AA_SE_Checker @ 1443

Last change on this file since 1443 was 1437, checked in by jgipsl, 6 years ago

For Irene:

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