source: trunk/libIGCM/AA_create_se @ 302

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

Use mercure (scalaire) new front end for SX8 post-processing.

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