source: trunk/libIGCM/AA_create_se @ 426

Last change on this file since 426 was 426, checked in by mmaipsl, 13 years ago

Add login shell path for platine jobs.

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