source: trunk/libIGCM/AA_create_se @ 706

Last change on this file since 706 was 704, checked in by jgipsl, 12 years ago

=> Added "#MSUB -Q normal" in headings for jobs at curie : When submitting a job in test queue (#MSUB -Q test) all sub jobs will also be subbmitted in test queue if nothingelse is specified.

=> Changed in AA_job : use /bin/ksh at curie due to specific usage in SPINUP configuration.

=> Correct directory in libIGCM_sys_obelix.

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