source: trunk/libIGCM/AA_create_se @ 831

Last change on this file since 831 was 785, checked in by labetoulle, 11 years ago

Cosmetics :

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