source: branches/libIGCM_MPI_OpenMP/AA_create_se @ 494

Last change on this file since 494 was 461, checked in by mafoipsl, 13 years ago

Add IPSLCM5B configuration for atlas submission.

  • 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.7 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
210# ------------------------------------------------------------------
211# Test if all was right before proceeding further
212# ------------------------------------------------------------------
213IGCM_debug_Verif_Exit_Post
214
215if [ ${StandAlone} = true ] ; then
216    CARD_DIR=${SUBMIT_DIR}
217else
218    CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} )
219    IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH}
220fi
221
222#
223# First of all
224#
225IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card UserChoices
226typeset option
227for option in ${config_UserChoices[*]} ; do
228    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
229done
230#
231echo
232IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
233IGCM_debug_PrintVariables 3 config_UserChoices_JobName
234IGCM_debug_PrintVariables 3 config_UserChoices_LongName
235IGCM_debug_PrintVariables 3 config_UserChoices_TagName
236IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
237IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
238IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
239IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
240IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
241IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
242echo
243
244#==================================
245#R_SAVE : Job output directory
246if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
247    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
248    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
249    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
250else
251    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
252    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
253fi
254#
255IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card ListOfComponents
256#
257IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
258#
259# Determine period for seasonnal average. Default : value from AA_job if any
260#
261DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
262#
263PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
264#
265freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
266#
267an_fin=$(( $( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) / 1000 ))
268an_deb=$( IGCM_date_YearDigit $(( an_fin - freq + 1 )) )
269an_fin=$( IGCM_date_YearDigit ${an_fin} )
270#
271# For each component selected determine which files need post-processing
272#
273for comp in ${config_ListOfComponents[*]} ; do
274    #
275    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
276    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
277    #
278    card=${CARD_DIR}/COMP/${compname}.card
279    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
280    #
281    ListFilesName=${compname}_OutputFiles_List
282    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
283    #
284    if [ X${FileName0} != X${NULL_STR} ] ; then
285        #
286        # INITIALISATION
287        #
288        eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
289        typeset i=2
290        #
291        until [ $i -gt $NbFiles ]; do
292            #
293            eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
294            #
295            if [ X${flag_post} != XNONE ] ; then
296                #
297                # Check if seasonal is required for this file
298                #
299                IGCM_card_DefineArrayFromSection ${card} ${flag_post}
300                #
301                # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
302                #
303                # variable option allready typeset above
304                for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
305                    if [ ${option} = Seasonal ] ; then
306                        FoundSeasonal=true
307                        IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
308                    fi
309                done
310                #
311                if [ ! X${FoundSeasonal} = Xtrue ] ; then
312                    eval ${compname}_${flag_post}_Seasonal=ON
313                fi
314                #
315                if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
316                    (( i=i+3 ))
317                    continue
318                fi
319                #
320                # CREATE LIST
321                #
322                FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
323                #
324                DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
325                #
326                TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
327                #
328                IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile}
329                if [ ! $? = 0 ] ; then
330                    eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE}
331                    if [ ! ${RebuildFrequency} = true ] ; then
332                        IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
333                        eval set +A LISTE_PATCHES_${FILE} \$\{${compname}_Post_${FILE}_Patches[*]}
334                        if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) !=  X${NULL_STR} ]; then
335                            for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do
336                                if [ Xload${Patch} != X ] ; then
337                                    . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh
338                                    eval load${Patch}=loaded
339                                fi
340                            done
341                        fi
342                    fi
343                fi
344            fi
345            (( i=i+3 ))
346        done # until [ $i -eq $NbFiles ]
347    fi
348done         # for comp
349
350for comp in ${config_ListOfComponents[*]} ; do
351    #
352    eval R_OUT_${comp}=${R_SAVE}/${comp}
353    #
354    i=0
355    for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
356        #
357        # Determine in which output can we find file
358        # IE : Output/MO or Output/DA or ...
359        #
360        FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
361        case ${FlagDir} in
362            1Y)    FreqDir=YE  ;;
363            1M)    FreqDir=MO  ;;
364            5D|1D) FreqDir=DA  ;;
365            HF)    FreqDir=HF  ;;
366            3H)    FreqDir=HF  ;;
367            INS)   FreqDir=INS ;;
368        esac
369        #
370        RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc
371        # Do not redoo an existing SE
372        IGCM_sys_TestFileArchive ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE}
373        if [ $? = 0 ] ; then
374            continue
375        fi
376        #
377        eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/
378        #
379        case ${config_UserChoices_PeriodLength} in
380        # For Yearly simulation :
381        1Y|1y)
382          (( an = an_deb ))
383          # Initialize array
384          #set -A liste_file_se
385          #set -A liste_file_se_tmp
386          unset liste_file_se
387          unset liste_file_se_tmp
388          while [ ${an} -le ${an_fin} ] ; do
389              moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
390              #
391              an4=$(printf "%04i\n" ${an} )
392              #
393              diy=$( IGCM_date_DaysInYear $an4 )
394              afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) )
395              date=${an4}0101_${afin}
396              #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
397              #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
398              liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
399              liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
400              (( an = an + 1 ))
401          done
402          #
403          IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
404          IGCM_debug_Verif_Exit_Post
405         
406          # Apply IGCM_Patch if needed
407          if [ ! ${RebuildFrequency} = true ] ; then
408              if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
409                  for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
410                      for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
411                          IGCM_${Patch} ${file_t}
412                      done
413                  done
414              fi
415          fi
416                     
417          # Search of common list of variables to be treated
418          nbfile=0
419          for file_common_var in ${liste_file_se_tmp[*]} ; do
420              ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
421              (( nbfile = nbfile + 1 ))
422          done
423          list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
424          IGCM_sys_Rm tmpfile_ncra
425
426          # detect time counter : time or time_counter ie unlimited variable
427          var_unlim=$(ncdump -h ${liste_file_se_tmp[1]}|grep UNLIMITED| cut -d ' ' -f 1)
428
429          for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
430          #
431              (( nb = ${mois} - 1 ))
432          #
433              OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
434              IGCM_sys_ncra -O -v ${list_var_final_ncra} -d ${var_unlim},${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
435          done
436          IGCM_sys_Rm ${liste_file_se_tmp[*]}
437          ;;
438        # For Monthly simulation :
439        1M|1m)
440          for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
441              #
442              (( nb = ${mois} - 1 ))
443              #
444              OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
445              #
446              (( an = an_deb ))
447              # Initialize array
448              #set -A liste_file_se
449              #set -A liste_file_se_tmp
450              unset liste_file_se
451              unset liste_file_se_tmp
452              while [ ${an} -le ${an_fin} ] ; do
453                  moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
454                  #
455                  an4=$(printf "%04i\n" ${an} )
456                  #
457                  date=${an4}${mois}01_${an4}${mois}${moisL}
458                  #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
459                  #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
460                  liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
461                  liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
462
463                  (( an = an + 1 ))
464              done
465              #
466              IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
467              IGCM_debug_Verif_Exit_Post
468             
469              # Apply IGCM_Patch if needed
470              if [ ! ${RebuildFrequency} = true ] ; then
471                  if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
472                      for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
473                          for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
474                              IGCM_${Patch} ${file_t}
475                          done
476                      done
477                  fi
478              fi
479             
480              # Search of common list of variables to be treated
481              nbfile=0
482              for file_common_var in ${liste_file_se_tmp[*]} ; do
483                  ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
484                  (( nbfile = nbfile + 1 ))
485              done
486              list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
487              IGCM_sys_Rm tmpfile_ncra
488
489              IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
490
491              IGCM_sys_Rm ${liste_file_se_tmp[*]}
492          done
493          ;;
494        *D|*d)
495          for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
496              #
497              (( nb = ${mois} - 1 ))
498              #
499              OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
500              #
501              (( an = an_deb ))
502              # Initialize array
503              #set -A liste_file_se
504              #set -A liste_file_se_tmp
505              unset liste_file_se
506              unset liste_file_se_tmp
507              while [ ${an} -le ${an_fin} ] ; do
508                  moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
509                  #
510                  an4=$(printf "%04i\n" ${an} )
511                  #
512                  length_d=$(( ${config_UserChoices_PeriodLength} - 1 ))
513                  # for one day
514                  if [ ${length_d} -eq 1 ] ; then
515                      (( length_d = 0 ))
516                  fi
517                  (( day  = 1 ))
518                  while [ ${day} -le ${moisL} ] ; do
519                      day2=$(printf "%02i\n" ${day} )
520                      day_beg=${an4}${mois}${day2}
521                      day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} )
522                      date=${an4}${mois}${day_beg}_${an4}${mois}${day_end}
523                      #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
524                      #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
525                      liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
526                      liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
527                      (( day = day + 1 ))
528                  done
529                  (( an = an + 1 ))
530              done
531              #
532              IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
533              IGCM_debug_Verif_Exit_Post
534             
535              # Apply IGCM_Patch if needed
536              if [ ! ${RebuildFrequency} = true ] ; then
537                  if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
538                      for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
539                          for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
540                              IGCM_${Patch} ${file_t}
541                          done
542                      done
543                  fi
544              fi
545
546              # Search of common list of variables to be treated
547              nbfile=0
548              for file_common_var in ${liste_file_se_tmp[*]} ; do
549                  ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
550                  (( nbfile = nbfile + 1 ))
551              done
552              list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
553              IGCM_sys_Rm tmpfile_ncra
554
555              IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
556              IGCM_sys_Rm ${liste_file_se_tmp[*]}
557          done
558          ;;
559        esac
560        #
561
562        # Search of common list of variables to be treated
563        nbfile=0
564        for file_common_var in ${OUT_SE[*]} ; do
565           ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncrcat
566           (( nbfile = nbfile + 1 ))
567        done
568        list_var_final_ncrcat=`cat tmpfile_ncrcat | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
569        IGCM_sys_Rm tmpfile_ncrcat
570
571        IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE}
572        #
573        IGCM_sys_Rm ${OUT_SE[*]}
574        #
575        # detect time counter : time or time_counter ie unlimited variable
576        var_unlim=$(ncdump -h ${RESULT_SE}|grep UNLIMITED| cut -d ' ' -f 1)
577
578        # Put correct climatological axis following calendar
579        case ${config_UserChoices_CalendarType} in
580                360d|360_day)
581                        # 360 days
582                        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\"'"
583                        ;;
584                noleap|365_day)
585                        # 365 days
586                        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\"'"
587                        ;;
588                all_leap|366_day)
589                        # 366 days
590                        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\"'"
591                        ;;
592                leap|gregorian|standard)
593                        # 365.2425 days
594                        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\"'"
595                        ;;
596        esac
597        eval IGCM_sys_ncap2 -Oh -s $ncap2cmd ${RESULT_SE} tmp.nc
598        IGCM_sys_Rm ${RESULT_SE}
599        IGCM_sys_Mv tmp.nc ${RESULT_SE}
600        #
601        eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE}
602        IGCM_sys_Rm ${RESULT_SE}
603        #
604    done
605done
606
607# DODS copy
608for comp in ${config_ListOfComponents[*]} ; do
609    IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/SE
610    [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/SE
611done
612
613YEARS=${an_deb}_${an_fin}
614DIR_OUT=SE
615
616export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone
617export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_MBG ; export RESOL_SRF ; export RESOL_SBG
618export R_SAVE; export config_UserChoices_JobName; export config_UserChoices_TagName; export YEARS; export DIR_OUT
619listVarEnv="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"
620export listVarEnv;
621
622#D-
623# --------------------------------------------------------------------
624#D- Test if all was right before ATLAS
625# --------------------------------------------------------------------
626IGCM_debug_Verif_Exit_Post
627
628if [ ${config_UserChoices_TagName} = "IPSLCM4_v1_OASIS3" ] || \
629   [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ]        || \
630   [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then
631    #
632    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
633    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
634    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
635    IGCM_sys_QsubPost atlas_LMDZ                       ;
636    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
637    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
638    Script_Post_Output=additionnal.${PeriodDateEnd}    ;
639    IGCM_sys_QsubPost additionnal                      ;
640    #
641elif [ ${config_UserChoices_TagName} = "IPSLCM5" ]  || \
642     [ ${config_UserChoices_TagName} = "IPSLCM5A" ] || \
643     [ ${config_UserChoices_TagName} = "IPSLCM5B" ] || \
644     [ ${config_UserChoices_TagName} = "IPSLCM5A-MR" ] ; then
645    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
646    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
647    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
648    IGCM_sys_QsubPost atlas_LMDZ                       ;
649    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
650    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
651    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
652    IGCM_sys_QsubPost atlas_PISCES                     ;
653    #
654elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ]  || \
655     [ ${config_UserChoices_TagName} = "LMDZOR" ]   || \
656     [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then
657    #
658    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
659    IGCM_sys_QsubPost atlas_LMDZ                       ;
660    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
661    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
662    #
663elif [ ${config_UserChoices_TagName} = "LMDZ" ] ; then
664    #
665    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
666    IGCM_sys_QsubPost atlas_LMDZ                       ;
667    #
668elif [ ${config_UserChoices_TagName} = "OL" ]      || \
669     [ ${config_UserChoices_TagName} = "OL2" ] ; then
670    #
671    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
672    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
673    #
674elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ]       ||
675     [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ] ; then
676    #
677    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
678    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
679elif [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ]  ; then
680    #
681    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
682    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
683    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
684    IGCM_sys_QsubPost atlas_PISCES                     ;
685elif [ ${config_UserChoices_TagName} = "ORCA2_OFF_PISCES" ]  ; then
686    #
687    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
688    IGCM_sys_QsubPost atlas_PISCES                     ;
689    #
690fi
691
692# Clean RUN_DIR_PATH (necessary for cesium)
693IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Note: See TracBrowser for help on using the repository browser.