source: trunk/libIGCM/AA_create_se @ 1206

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