source: trunk/libIGCM/AA_create_se @ 263

Last change on this file since 263 was 263, checked in by mafoipsl, 14 years ago

Adapt libIGCM and jobs to new output Names : ${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName?} if SpaceName? and ExperimentName? are set into config.card. Still working with old types : ${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}.
More information here : IPSLCM5A?
Add IPSLCM5A into atlas.

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