source: trunk/libIGCM/AA_create_se @ 1327

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