source: trunk/libIGCM/AA_create_se @ 637

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