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

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