source: tags/libIGCM_v2.0_beta3/AA_create_se @ 1137

Last change on this file since 1137 was 681, checked in by mafoipsl, 12 years ago

On curie : Computing job on -q standard ie thin nodes, post-processing jobs on -q large ie large nodes. Stop default echo of commands.

  • 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: 31.7 KB
Line 
1#-Q- cesium #!/bin/ksh
2#-Q- cesium ######################
3#-Q- cesium ## CESIUM   CEA ##
4#-Q- cesium ######################
5#-Q- cesium #MSUB -r SE             # Nom du job               
6#-Q- cesium #MSUB -N 1              # Reservation du noeud
7#-Q- cesium #MSUB -n 1              # Reservation du processus
8#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
9#-Q- cesium #MSUB -E "-j o"
10#-Q- cesium #MSUB -E "-S /bin/ksh"
11#-Q- curie ######################
12#-Q- curie ## CURIE   TGCC/CEA ##
13#-Q- curie ######################
14#-Q- curie #MSUB -r SE             # Nom du job               
15#-Q- curie #MSUB -eo
16#-Q- curie #MSUB -n 1              # Reservation du processus
17#-Q- curie #MSUB -T 86400          # Limite de temps elapsed du job
18#-Q- curie #MSUB -E '--no-requeue'
19#-Q- curie #MSUB -q large
20#-Q- curie set +x
21#-Q- platine #!/usr/bin/ksh
22#-Q- platine ###################
23#-Q- platine ## PLATINE   CEA ##
24#-Q- platine ###################
25#-Q- platine #BSUB -J SE                     # Nom du job
26#-Q- platine #BSUB -N                        # message a la fin du job
27#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
28#-Q- platine #BSUB -W 1:00                   # Limite temps
29#-Q- platine #BSUB -q post              # Passage en queue post
30#-Q- platine #BSUB -L /bin/ksh
31#-Q- sx8brodie #!/bin/ksh
32#-Q- sx8brodie #######################
33#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
34#-Q- sx8brodie #######################
35#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
36#-Q- sx8brodie # @ wall_clock_limit = 10:00:00
37#-Q- sx8brodie # Nom du travail LoadLeveler
38#-Q- sx8brodie # @ job_name   = SE
39#-Q- sx8brodie # Fichier de sortie standard du travail       
40#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
41#-Q- sx8brodie # Fichier de sortie d'erreur du travail
42#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
43#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
44#-Q- sx8brodie # @ notification = error
45#-Q- sx8brodie # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
46#-Q- sx8brodie # @ queue
47#-Q- aix6 #!/bin/ksh
48#-Q- aix6 #######################
49#-Q- aix6 ##   VARGAS   IDRIS  ##
50#-Q- aix6 #######################
51#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
52#-Q- aix6 # @ wall_clock_limit = 10:00:00
53#-Q- aix6 # Nom du travail LoadLeveler
54#-Q- aix6 # @ job_name   = SE
55#-Q- aix6 # Fichier de sortie standard du travail       
56#-Q- aix6 # @ output     = $(job_name).$(jobid)
57#-Q- aix6 # Fichier de sortie d'erreur du travail
58#-Q- aix6 # @ error      =  $(job_name).$(jobid)
59#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
60#-Q- aix6 # @ notification = error
61#-Q- aix6 # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
62#-Q- aix6 # @ queue
63#-Q- ulam #!/bin/ksh
64#-Q- ulam #######################
65#-Q- ulam ##   ULAM   IDRIS  ##
66#-Q- ulam #######################
67#-Q- ulam # Temps Elapsed max. d'une requete hh:mm:ss
68#-Q- ulam # @ wall_clock_limit = 10:00:00
69#-Q- ulam # Nom du travail LoadLeveler
70#-Q- ulam # @ job_name   = SE
71#-Q- ulam # Fichier de sortie standard du travail       
72#-Q- ulam # @ output     = $(job_name).$(jobid)
73#-Q- ulam # Fichier de sortie d'erreur du travail
74#-Q- ulam # @ error      =  $(job_name).$(jobid)
75#-Q- ulam # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
76#-Q- ulam # @ notification = error
77#-Q- ulam # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
78#-Q- ulam # @ queue
79#-Q- sx8mercure #!/bin/ksh
80#-Q- sx8mercure ######################
81#-Q- sx8mercure ## SX8MERCURE   CEA ##
82#-Q- sx8mercure ######################
83#-Q- sx8mercure #PBS -N SE                   # Nom du job
84#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
85#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
86#-Q- sx8mercure #PBS -l memsz_job=8gb        # Limite memoire a 1 Go
87#-Q- sx8mercure #PBS -l cputim_job=24:00:00   # Limite temps a 1 heures
88#-Q- sx8mercure #PBS -q scalaire
89#-Q- sx8mercure #PBS -r n
90#-Q- sx9mercure #!/bin/ksh
91#-Q- sx9mercure ######################
92#-Q- sx9mercure ## SX9MERCURE  CCRT ##
93#-Q- sx9mercure ######################
94#-Q- sx9mercure #PBS -N SE                   # Nom du job
95#-Q- sx9mercure #PBS -j o                    # regroupement des stdout et stderr
96#-Q- sx9mercure #PBS -S /usr/bin/ksh         # shell de soumission
97#-Q- sx9mercure #PBS -l memsz_job=8gb        # Limite memoire a 1 Go
98#-Q- sx9mercure #PBS -l elapstim_req=24:00:00   # Limite temps a 1 heures
99#-Q- sx9mercure #PBS -q scalaire
100#-Q- sx9mercure #PBS -r n
101#-Q- titane #!/bin/ksh
102#-Q- titane ######################
103#-Q- titane ## TITANE   CEA ##
104#-Q- titane ######################
105#-Q- titane #MSUB -r SE             # Nom du job               
106#-Q- titane #MSUB -eo
107#-Q- titane #MSUB -n 1              # Reservation du processus
108#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
109#-Q- titane #MSUB -q mono
110#-Q- titane #MSUB -E '-rn'
111#-Q- lxiv8 ######################
112#-Q- lxiv8 ## OBELIX      LSCE ##
113#-Q- lxiv8 ######################
114#-Q- lxiv8 #PBS -N SE
115#-Q- lxiv8 #PBS -m a
116#-Q- lxiv8 #PBS -j oe
117#-Q- lxiv8 #PBS -q medium
118#-Q- lxiv8 #PBS -o SE.$$
119#-Q- lxiv8 #PBS -S /bin/ksh
120#-Q- default #!/bin/ksh
121#-Q- default ##################
122#-Q- default ## DEFAULT HOST ##
123#-Q- default ##################
124
125#**************************************************************
126# Author: Sebastien Denvil
127# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
128# $Revision::                                          $ Revision of last commit
129# $Author::                                            $ Author of last commit
130# $Date::                                              $ Date of last commit
131# IPSL (2006)
132#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
133#
134#**************************************************************
135
136#set -eu
137#set -vx
138
139date
140
141#-Q- sx8brodie export OMP_NUM_THREADS=1
142#-Q- aix6 export OMP_NUM_THREADS=1
143#-Q- ulam export OMP_NUM_THREADS=1
144
145########################################################################
146
147#D- Flag to determine if this job in a standalone mode
148#D- Default : value from AA_job if any
149StandAlone=${StandAlone:=true}
150
151#D- Path to libIGCM
152#D- Default : value from AA_job if any
153# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
154# WARNING you must check MirrorlibIGCM variable in sys library.
155# WARNING If this variable is true, you must use libIGCM_POST path instead
156# WARNING of your running libIGCM directory.
157libIGCM=${libIGCM:=::modipsl::/libIGCM}
158
159#D- Flag to determine if rebuild process has been performed asynchronously
160#D- Possible value true or false.
161#D- If true raw files has allready been patched by rebuild job
162#D- If false create_ts will patch the raw files
163#D- Default : Value from AA_job if any. Usefull in StandAlone case.
164RebuildFrequency=${RebuildFrequency:=true}
165
166#D- Flag to determine atlas job's output directory
167#D- Default : value from libIGCM_post.ksh if any
168POST_DIR=${POST_DIR:=${PBS_O_WORKDIR:=$(pwd)}}
169
170#D- Increased verbosity (1, 2, 3)
171#D- Default : value from AA_job if any
172Verbosity=${Verbosity:=3}
173
174#D- Low level debug : to bypass lib test checks and stack construction
175#D- Default : value from AA_job if any
176DEBUG_debug=${DEBUG_debug:=false}
177
178#D- TEMPORARY Flag to determine atmospheric resolution
179#D- Default : value from atmospheric driver if any
180RESOL_ATM=${RESOL_ATM:=ALL}
181
182#D- Flag to determine surface resolution
183#D- Default : value from surface driver if any
184RESOL_SRF=ALL
185
186#D- Flag to determine surface resolution
187#D- Default : value from surface driver if any
188RESOL_SBG=ALL
189
190#D- TEMPORARY Flag to determine ocean resolution
191#D- Default : value from ocean driver if any
192RESOL_OCE=${RESOL_OCE:=ORCA2}
193
194#D- TEMPORARY Flag to determine ice resolution
195#D- Default : value from ice driver if any
196RESOL_ICE=${RESOL_ICE:=ORCA2}
197
198#D- TEMPORARY Flag to determine marine biogeochemistry resolution
199#D- Default : value from ice driver if any
200RESOL_MBG=${RESOL_MBG:=ORCA2}
201
202########################################################################
203
204. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
205      ( ${DEBUG_debug} ) && IGCM_debug_Check
206. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
207     ( ${DEBUG_debug} ) && IGCM_card_Check
208. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
209     ( ${DEBUG_debug} ) && IGCM_date_Check
210#-------
211. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
212
213########################################################################
214
215#set -vx
216
217IGCM_sys_MkdirWork ${RUN_DIR_PATH}
218IGCM_sys_Cd ${RUN_DIR_PATH}
219
220# ------------------------------------------------------------------
221# Test if all was right before proceeding further
222# ------------------------------------------------------------------
223IGCM_debug_Verif_Exit_Post
224
225if [ ${StandAlone} = true ] ; then
226    CARD_DIR=${SUBMIT_DIR}
227else
228    CARD_DIR=${RUN_DIR_PATH}
229    IGCM_sys_Get_Master ${SUBMIT_DIR}/config.card ${RUN_DIR_PATH}
230    IGCM_sys_Get_Master ${SUBMIT_DIR}/run.card    ${RUN_DIR_PATH}
231    IGCM_sys_Get_Master ${SUBMIT_DIR}/COMP        ${RUN_DIR_PATH}
232    IGCM_sys_Get_Master ${SUBMIT_DIR}/POST        ${RUN_DIR_PATH}
233fi
234
235#==================================
236# First of all
237#
238typeset option
239
240#==================================
241# Read UserChoices section:
242IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card UserChoices
243echo
244IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
245for option in ${config_UserChoices[*]} ; do
246    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
247    eval auxprint=\${config_UserChoices_${option}}
248    IGCM_debug_Print 3 "${option} : ${auxprint}"
249done
250#
251echo
252
253#==================================
254# Read Ensemble section:
255IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card Ensemble
256echo
257IGCM_debug_Print 1 "DefineArrayFromOption  : config_Ensemble"
258for option in ${config_Ensemble[*]} ; do
259    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Ensemble ${option}
260    eval auxprint=\${config_Ensemble_${option}}
261    IGCM_debug_Print 3 "${option} : ${auxprint}"
262done
263#
264echo
265
266#==================================
267# Read Post section:
268IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card Post
269echo
270IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
271for option in ${config_Post[*]} ; do
272  IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post ${option}
273  eval auxprint=\${config_Post_${option}}
274  IGCM_debug_Print 3 "${option} : ${auxprint}"
275done
276#
277echo
278
279#==================================
280# Define default value to keep compatibility with previous card: means before changes due to TGCC
281if [ X${PackDefault} = Xtrue ] ; then
282  [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency}
283else
284  config_Post_PackFrequency=NONE
285fi
286
287#==================================
288# If pack is active then PackFrequency overule the config_UserChoices_PeriodLength
289if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then
290  config_UserChoices_PeriodLength=${config_Post_PackFrequency}
291fi
292
293#==================================
294#R_SAVE : Job output directory
295#R_BUFR : Job output buffered directory
296if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
297  FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
298  if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
299    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
300    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
301    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
302  else
303    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
304    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
305    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
306  fi
307else
308  if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
309    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
310    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
311    R_DODS=${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
312  else
313    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
314    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
315    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
316  fi
317fi
318#
319IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card ListOfComponents
320#
321IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
322#
323# Determine period for seasonnal average. Default : value from AA_job if any
324#
325DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
326#
327PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
328#
329freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
330#
331an_fin=$(( $( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) / 1000 ))
332an_deb=$( IGCM_date_YearDigit $(( an_fin - freq + 1 )) )
333an_fin=$( IGCM_date_YearDigit ${an_fin} )
334#
335# For each component selected determine which files need post-processing
336#
337for comp in ${config_ListOfComponents[*]} ; do
338    #
339    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
340    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
341    #
342    card=${CARD_DIR}/COMP/${compname}.card
343    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
344    #
345    ListFilesName=${compname}_OutputFiles_List
346    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
347    #
348    if [ X${FileName0} != X${NULL_STR} ] ; then
349        #
350        # INITIALISATION
351        #
352        eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
353        typeset i=2
354        #
355        until [ $i -gt $NbFiles ]; do
356            #
357            eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
358            #
359            if [ X${flag_post} != XNONE ] ; then
360                #
361                # Check if seasonal is required for this file
362                #
363                IGCM_card_DefineArrayFromSection ${card} ${flag_post}
364                #
365                # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
366                #
367                # variable option allready typeset above
368                for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
369                    if [ ${option} = Seasonal ] ; then
370                        FoundSeasonal=true
371                        IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
372                    fi
373                done
374                #
375                if [ ! X${FoundSeasonal} = Xtrue ] ; then
376                    eval ${compname}_${flag_post}_Seasonal=ON
377                fi
378                #
379                if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
380                    (( i=i+3 ))
381                    continue
382                fi
383                #
384                # CREATE LIST
385                #
386                FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
387                #
388                DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
389                #
390                TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
391                #
392                IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile}
393                if [ ! $? = 0 ] ; then
394                    eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE}
395                    if [ ! ${RebuildFrequency} = true ] ; then
396                        IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
397                        eval set +A LISTE_PATCHES_${FILE} \$\{${compname}_Post_${FILE}_Patches[*]}
398                        if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) !=  X${NULL_STR} ]; then
399                            for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do
400                                if [ Xload${Patch} != X ] ; then
401                                    . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh
402                                    eval load${Patch}=loaded
403                                fi
404                            done
405                        fi
406                    fi
407                fi
408            fi
409            (( i=i+3 ))
410        done # until [ $i -eq $NbFiles ]
411    fi
412done         # for comp
413
414for comp in ${config_ListOfComponents[*]} ; do
415    #
416    eval R_OUT_${comp}=${R_SAVE}/${comp}
417    #
418    i=0
419    for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
420        #
421        # Determine in which output can we find file
422        # IE : Output/MO or Output/DA or ...
423        #
424        FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
425        case ${FlagDir} in
426            1Y)    FreqDir=YE  ;;
427            1M)    FreqDir=MO  ;;
428            5D|1D) FreqDir=DA  ;;
429            HF)    FreqDir=HF  ;;
430            3H)    FreqDir=HF  ;;
431            INS)   FreqDir=INS ;;
432        esac
433        #
434        RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc
435        # Do not redoo an existing SE
436        IGCM_sys_TestFileArchive ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE}
437        if [ $? = 0 ] ; then
438            continue
439        fi
440        #
441        eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/
442        #
443        case ${config_UserChoices_PeriodLength} in
444        # For Yearly simulation :
445        1Y|1y)
446          (( an = an_deb ))
447          # Initialize array
448          #set -A liste_file_se
449          #set -A liste_file_se_tmp
450          unset liste_file_se
451          unset liste_file_se_tmp
452          while [ ${an} -le ${an_fin} ] ; do
453              moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
454              #
455              an4=$(printf "%04i\n" ${an} )
456              #
457              diy=$( IGCM_date_DaysInYear $an4 )
458              afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) )
459              date=${an4}0101_${afin}
460              #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
461              #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
462              liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
463              liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
464              (( an = an + 1 ))
465          done
466          #
467          IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
468          IGCM_debug_Verif_Exit_Post
469         
470          # Apply IGCM_Patch if needed
471          if [ ! ${RebuildFrequency} = true ] ; then
472              if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
473                  for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
474                      for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
475                          IGCM_${Patch} ${file_t}
476                      done
477                  done
478              fi
479          fi
480                     
481          # Search of common list of variables to be treated
482          nbfile=0
483          for file_common_var in ${liste_file_se_tmp[*]} ; do
484              ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
485              (( nbfile = nbfile + 1 ))
486          done
487          list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
488          IGCM_sys_Rm tmpfile_ncra
489
490          # detect time counter : time or time_counter ie unlimited variable
491          var_unlim=$(ncdump -h ${liste_file_se_tmp[1]}|grep UNLIMITED|awk '{print $1}')
492
493          for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
494          #
495              (( nb = ${mois} - 1 ))
496          #
497              OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
498              IGCM_sys_ncra -O -v ${list_var_final_ncra} -d ${var_unlim},${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
499          done
500          IGCM_sys_Rm ${liste_file_se_tmp[*]}
501          ;;
502        # For Monthly simulation :
503        1M|1m)
504          for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
505              #
506              (( nb = ${mois} - 1 ))
507              #
508              OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
509              #
510              (( an = an_deb ))
511              # Initialize array
512              #set -A liste_file_se
513              #set -A liste_file_se_tmp
514              unset liste_file_se
515              unset liste_file_se_tmp
516              while [ ${an} -le ${an_fin} ] ; do
517                  moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
518                  #
519                  an4=$(printf "%04i\n" ${an} )
520                  #
521                  date=${an4}${mois}01_${an4}${mois}${moisL}
522                  #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
523                  #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
524                  liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
525                  liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
526
527                  (( an = an + 1 ))
528              done
529              #
530              IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
531              IGCM_debug_Verif_Exit_Post
532             
533              # Apply IGCM_Patch if needed
534              if [ ! ${RebuildFrequency} = true ] ; then
535                  if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
536                      for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
537                          for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
538                              IGCM_${Patch} ${file_t}
539                          done
540                      done
541                  fi
542              fi
543             
544              # Search of common list of variables to be treated
545              nbfile=0
546              for file_common_var in ${liste_file_se_tmp[*]} ; do
547                  ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
548                  (( nbfile = nbfile + 1 ))
549              done
550              list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
551              IGCM_sys_Rm tmpfile_ncra
552
553              IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
554
555              IGCM_sys_Rm ${liste_file_se_tmp[*]}
556          done
557          ;;
558        *D|*d)
559          for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
560              #
561              (( nb = ${mois} - 1 ))
562              #
563              OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
564              #
565              (( an = an_deb ))
566              # Initialize array
567              #set -A liste_file_se
568              #set -A liste_file_se_tmp
569              unset liste_file_se
570              unset liste_file_se_tmp
571              while [ ${an} -le ${an_fin} ] ; do
572                  moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
573                  #
574                  an4=$(printf "%04i\n" ${an} )
575                  #
576                  length_d=$(( ${config_UserChoices_PeriodLength} - 1 ))
577                  # for one day
578                  if [ ${length_d} -eq 1 ] ; then
579                      (( length_d = 0 ))
580                  fi
581                  (( day  = 1 ))
582                  while [ ${day} -le ${moisL} ] ; do
583                      day2=$(printf "%02i\n" ${day} )
584                      day_beg=${an4}${mois}${day2}
585                      day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} )
586                      date=${an4}${mois}${day_beg}_${an4}${mois}${day_end}
587                      #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
588                      #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
589                      liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
590                      liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
591                      (( day = day + 1 ))
592                  done
593                  (( an = an + 1 ))
594              done
595              #
596              IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
597              IGCM_debug_Verif_Exit_Post
598             
599              # Apply IGCM_Patch if needed
600              if [ ! ${RebuildFrequency} = true ] ; then
601                  if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
602                      for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
603                          for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
604                              IGCM_${Patch} ${file_t}
605                          done
606                      done
607                  fi
608              fi
609
610              # Search of common list of variables to be treated
611              nbfile=0
612              for file_common_var in ${liste_file_se_tmp[*]} ; do
613                  ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
614                  (( nbfile = nbfile + 1 ))
615              done
616              list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
617              IGCM_sys_Rm tmpfile_ncra
618
619              IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
620              IGCM_sys_Rm ${liste_file_se_tmp[*]}
621          done
622          ;;
623        esac
624        #
625
626        # Search of common list of variables to be treated
627        nbfile=0
628        for file_common_var in ${OUT_SE[*]} ; do
629           ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncrcat
630           (( nbfile = nbfile + 1 ))
631        done
632        list_var_final_ncrcat=`cat tmpfile_ncrcat | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
633        IGCM_sys_Rm tmpfile_ncrcat
634
635        IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE}
636        #
637        IGCM_sys_Rm ${OUT_SE[*]}
638        #
639        # detect time counter : time or time_counter ie unlimited variable
640        var_unlim=$(ncdump -h ${RESULT_SE}|grep UNLIMITED| cut -d ' ' -f 1)
641
642        # Put correct climatological axis following calendar
643        case ${config_UserChoices_CalendarType} in
644                360d|360_day)
645                        # 360 days
646                        ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345.} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 30, 30, 60, 60, 90, 90, 120, 120, 150, 150, 180, 180, 210, 210, 240, 240, 270, 270, 300, 300, 330, 330, 360.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"360_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'"
647                        ;;
648                noleap|365_day)
649                        # 365 days
650                        ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45, 74.5, 105, 135.5, 166, 196.5, 227.5, 258, 288.5, 319, 349.5} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 59, 59, 90, 90, 120, 120, 151, 151, 181, 181, 212, 212, 243, 243, 273, 273, 304, 304, 334, 334, 365.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"365_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'"
651                        ;;
652                all_leap|366_day)
653                        # 366 days
654                        ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45.5, 75.5, 106, 136.5, 167, 197.5, 228.5, 259, 289.5, 320, 350.5} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 60, 60, 91, 91, 121, 121, 152, 152, 182, 182, 213, 213, 244, 244, 274, 274, 305, 305, 335, 335, 366.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"366_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'"
655                        ;;
656                leap|gregorian|standard)
657                        # 365.2425 days
658                        ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45.12125, 74.7425, 105.2425, 135.7425, 166.2425, 196.7425, 227.7425, 258.2425, 288.7425, 319.2425, 349.7425} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 59.2425, 59.2425, 90.2425, 90.2425, 120.2425, 120.2425, 151.2425, 151.2425, 181.2425, 181.2425, 212.2425, 212.2425, 243.2425, 243.2425, 273.2425, 273.2425, 304.2425, 304.2425, 334.2425, 334.2425, 365.2425} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"gregorian\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'"
659                        ;;
660        esac
661        eval IGCM_sys_ncap2 -Oh -s $ncap2cmd ${RESULT_SE} tmp.nc
662        IGCM_sys_Rm ${RESULT_SE}
663        IGCM_sys_Mv tmp.nc ${RESULT_SE}
664        #
665        eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE}
666        IGCM_sys_Rm ${RESULT_SE}
667        #
668    done
669done
670
671# DODS copy
672for comp in ${config_ListOfComponents[*]} ; do
673    IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/SE
674    [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/SE
675done
676
677YEARS=${an_deb}_${an_fin}
678DIR_OUT=SE
679
680export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone
681export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_MBG ; export RESOL_SRF ; export RESOL_SBG
682export R_SAVE; export config_UserChoices_JobName; export config_UserChoices_TagName; export YEARS; export DIR_OUT
683listVarEnv="POST_DIR,SUBMIT_DIR,libIGCM,R_INIT,R_BC,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_SBG,R_SAVE,config_UserChoices_JobName,config_UserChoices_TagName,YEARS,DIR_OUT"
684export listVarEnv;
685
686#D-
687# --------------------------------------------------------------------
688#D- Test if all was right before ATLAS
689# --------------------------------------------------------------------
690IGCM_debug_Verif_Exit_Post
691
692if [ ${config_UserChoices_TagName} = "IPSLCM4_v1_OASIS3" ] || \
693   [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ]        || \
694   [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then
695    #
696    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
697    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
698    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
699    IGCM_sys_QsubPost atlas_LMDZ                       ;
700    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
701    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
702    Script_Post_Output=additionnal.${PeriodDateEnd}    ;
703    IGCM_sys_QsubPost additionnal                      ;
704    #
705elif [ ${config_UserChoices_TagName} = "IPSLCM5" ]  || \
706     [ ${config_UserChoices_TagName} = "IPSLCM5A" ] || \
707     [ ${config_UserChoices_TagName} = "IPSLCM5B" ] || \
708     [ ${config_UserChoices_TagName} = "IPSLCM5A-MR" ] ; then
709    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
710    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
711    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
712    IGCM_sys_QsubPost atlas_LMDZ                       ;
713    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
714    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
715    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
716    IGCM_sys_QsubPost atlas_PISCES                     ;
717    #
718elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ]  || \
719     [ ${config_UserChoices_TagName} = "LMDZOR" ]   || \
720     [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then
721    #
722    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
723    IGCM_sys_QsubPost atlas_LMDZ                       ;
724    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
725    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
726    #
727elif [ ${config_UserChoices_TagName} = "LMDZ" ] ; then
728    #
729    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
730    IGCM_sys_QsubPost atlas_LMDZ                       ;
731    #
732elif [ ${config_UserChoices_TagName} = "OL" ]      || \
733     [ ${config_UserChoices_TagName} = "OL2" ] ; then
734    #
735    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
736    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
737    #
738elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ]       ||
739     [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ] ; then
740    #
741    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
742    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
743elif [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ]  ; then
744    #
745    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
746    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
747    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
748    IGCM_sys_QsubPost atlas_PISCES                     ;
749elif [ ${config_UserChoices_TagName} = "ORCA2_OFF_PISCES" ]  ; then
750    #
751    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
752    IGCM_sys_QsubPost atlas_PISCES                     ;
753    #
754fi
755
756# Clean RUN_DIR_PATH (necessary for cesium and titane only)
757IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Note: See TracBrowser for help on using the repository browser.