source: tags/libIGCM_v2.0_beta1/AA_create_se @ 1456

Last change on this file since 1456 was 647, checked in by aclsce, 12 years ago

Modified CARD_DIR variable to take into account modifications about the use of Get_Master function to get files (instead of directory).

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