source: trunk/libIGCM/AA_create_se @ 1197

Last change on this file since 1197 was 1192, checked in by sdipsl, 9 years ago

Bugfix caused by r1189 side effect. On Curie job begins their execution in the directory they have submitted under (this directory is very likely to have been removed). Change directory before doing anything to avoid stale file handle error.

  • 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: 25.7 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
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_Post
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# Define default value to keep compatibility with previous card: means before changes due to TGCC
174if [ X${PackDefault} = Xtrue ] ; then
175  [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency}
176else
177  config_Post_PackFrequency=NONE
178fi
179
180#==================================
181# If pack is active then PackFrequency overule the config_UserChoices_PeriodLength
182if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then
183  config_UserChoices_PeriodLength=${config_Post_PackFrequency}
184fi
185
186#==================================
187# Read ListOfComponents section:
188IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card ListOfComponents
189
190#==================================
191# Read SeasonalFrequency:
192IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
193
194#
195# Determine period for seasonnal average. Default : value from AA_job if any
196#
197DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
198#
199PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
200#
201freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
202#
203an_fin=$(( $( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) / 1000 ))
204an_deb=$( IGCM_date_YearDigit $(( an_fin - freq + 1 )) )
205an_fin=$( IGCM_date_YearDigit ${an_fin} )
206#
207# For each component selected determine which files need post-processing
208#
209for comp in ${config_ListOfComponents[*]} ; do
210  #
211  IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
212  eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
213  #
214  card=${CARD_DIR}/COMP/${compname}.card
215  IGCM_card_DefineArrayFromOption ${card} OutputFiles List
216  #
217  ListFilesName=${compname}_OutputFiles_List
218  eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
219  #
220  if [ X${FileName0} != X${NULL_STR} ] ; then
221    #
222    # INITIALISATION
223    #
224    eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
225    typeset i=2
226    #
227    until [ $i -gt $NbFiles ]; do
228      #
229      eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
230      #
231      if [ X${flag_post} != XNONE ] ; then
232        #
233        # Check if seasonal is required for this file
234        #
235        IGCM_card_DefineArrayFromSection ${card} ${flag_post}
236        #
237        # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
238        #
239        # variable option allready typeset above
240        for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
241          if [ ${option} = Seasonal ] ; then
242            FoundSeasonal=true
243            IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
244          fi
245        done
246        #
247        if [ ! X${FoundSeasonal} = Xtrue ] ; then
248            eval ${compname}_${flag_post}_Seasonal=ON
249        fi
250        #
251        if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
252          (( i=i+3 ))
253          continue
254        fi
255        #
256        # CREATE LIST
257        #
258        FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
259        #
260        DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
261        #
262        TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
263        #
264        IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile}
265        if [ ! $? = 0 ] ; then
266          eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE}
267          if [ ! ${RebuildFrequency} = true ] ; then
268            IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches
269            eval set +A LISTE_PATCHES_${FILE} \$\{${compname}_Post_${FILE}_Patches[*]}
270            if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) !=  X${NULL_STR} ]; then
271              for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do
272                if [ Xload${Patch} != X ] ; then
273                  . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh
274                  eval load${Patch}=loaded
275                fi
276              done
277            fi
278          fi
279        fi
280      fi
281      (( i=i+3 ))
282    done # until [ $i -eq $NbFiles ]
283  fi
284done         # for comp
285
286for comp in ${config_ListOfComponents[*]} ; do
287  #
288  eval R_OUT_${comp}=${R_SAVE}/${comp}
289  #
290  i=0
291  for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
292    #
293    # Determine in which output can we find file
294    # IE : Output/MO or Output/DA or ...
295    #
296    FlagDir=$( echo ${file} | awk -F "_" '{print $1}' )
297    case ${FlagDir} in
298      1Y)    FreqDir=YE  ;;
299      1M)    FreqDir=MO  ;;
300      5D|1D) FreqDir=DA  ;;
301      HF)    FreqDir=HF  ;;
302      3H)    FreqDir=HF  ;;
303      INS)   FreqDir=INS ;;
304    esac
305    #
306    RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc
307    # Do not redoo an existing SE
308    IGCM_sys_TestFileArchive ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE}
309    if [ $? = 0 ] ; then
310      continue
311    fi
312    #
313    eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/
314    #
315    case ${config_UserChoices_PeriodLength} in
316      # For Yearly simulation :
317      *Y|*y)
318        PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' )
319        (( an = an_deb ))
320        # Initialize array
321        unset liste_file_se
322        unset liste_file_se_tmp
323        while [ ${an} -le ${an_fin} ] ; do
324          #
325          an4=$(printf "%04i\n" ${an} )
326          #
327          diy=$( IGCM_date_DaysInCurrentPeriod ${an4}0101 ${config_UserChoices_PeriodLength} )
328          afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) )
329          #
330          date=${an4}0101_${afin}
331          #
332          liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
333          liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
334          (( an = an + ${PeriodLengthInYears} ))
335        done
336        #
337        IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
338        IGCM_debug_Verif_Exit_Post
339
340        # Apply IGCM_Patch if needed
341        if [ ! ${RebuildFrequency} = true ] ; then
342          if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
343            for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
344              for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
345                IGCM_${Patch} ${file_t}
346              done
347            done
348          fi
349        fi
350
351        # Search of common list of variables to be treated
352        nbfile=0
353        for file_common_var in ${liste_file_se_tmp[*]} ; do
354          ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
355          (( nbfile = nbfile + 1 ))
356        done
357        list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
358        IGCM_sys_Rm tmpfile_ncra
359
360        # detect time counter : time or time_counter ie unlimited variable
361        var_unlim=$(ncdump -h ${liste_file_se_tmp[0]}|grep UNLIMITED|awk '{print $1}')
362
363        for mois in  01 02 03 04 05 06 07 08 09 10 11 12 ; do
364          #
365          (( nb = ${mois} - 1 ))
366          #
367          OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
368          IGCM_sys_ncra -O -v ${list_var_final_ncra} -d ${var_unlim},${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
369        done
370        IGCM_sys_Rm ${liste_file_se_tmp[*]}
371        ;;
372      # For Monthly simulation :
373      1M|1m)
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          #
380          (( an = an_deb ))
381          # Initialize array
382          unset liste_file_se
383          unset liste_file_se_tmp
384          while [ ${an} -le ${an_fin} ] ; do
385            moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
386            #
387            an4=$(printf "%04i\n" ${an} )
388            #
389            date=${an4}${mois}01_${an4}${mois}${moisL}
390            #
391            liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
392            liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
393
394            (( an = an + 1 ))
395          done
396          #
397          IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
398          IGCM_debug_Verif_Exit_Post
399
400          # Apply IGCM_Patch if needed
401          if [ ! ${RebuildFrequency} = true ] ; then
402            if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
403              for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
404                for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
405                  IGCM_${Patch} ${file_t}
406                done
407              done
408            fi
409          fi
410
411          # Search of common list of variables to be treated
412          nbfile=0
413          for file_common_var in ${liste_file_se_tmp[*]} ; do
414            ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
415            (( nbfile = nbfile + 1 ))
416          done
417            list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
418          IGCM_sys_Rm tmpfile_ncra
419
420          IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
421
422          IGCM_sys_Rm ${liste_file_se_tmp[*]}
423        done
424        ;;
425      *D|*d)
426        for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do
427          #
428          (( nb = ${mois} - 1 ))
429          #
430          OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
431          #
432          (( an = an_deb ))
433          # Initialize array
434          unset liste_file_se
435          unset liste_file_se_tmp
436          while [ ${an} -le ${an_fin} ] ; do
437            moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
438            #
439            an4=$(printf "%04i\n" ${an} )
440              #
441            length_d=$(( ${config_UserChoices_PeriodLength} - 1 ))
442            # for one day
443            if [ ${length_d} -eq 1 ] ; then
444              (( length_d = 0 ))
445            fi
446            (( day  = 1 ))
447            while [ ${day} -le ${moisL} ] ; do
448              day2=$(printf "%02i\n" ${day} )
449              day_beg=${an4}${mois}${day2}
450              day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} )
451              date=${an4}${mois}${day_beg}_${an4}${mois}${day_end}
452              #
453              liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
454              liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
455              (( day = day + 1 ))
456            done
457            (( an = an + 1 ))
458          done
459          #
460          IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
461          IGCM_debug_Verif_Exit_Post
462
463          # Apply IGCM_Patch if needed
464          if [ ! ${RebuildFrequency} = true ] ; then
465            if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
466              for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
467                for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
468                  IGCM_${Patch} ${file_t}
469                done
470              done
471            fi
472          fi
473
474          # Search of common list of variables to be treated
475          nbfile=0
476          for file_common_var in ${liste_file_se_tmp[*]} ; do
477            ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
478            (( nbfile = nbfile + 1 ))
479          done
480            list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
481          IGCM_sys_Rm tmpfile_ncra
482
483          IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
484          IGCM_sys_Rm ${liste_file_se_tmp[*]}
485        done
486        ;;
487      esac
488      #
489
490      # Search of common list of variables to be treated
491      nbfile=0
492      for file_common_var in ${OUT_SE[*]} ; do
493        ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncrcat
494        (( nbfile = nbfile + 1 ))
495      done
496      list_var_final_ncrcat=`cat tmpfile_ncrcat | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
497      IGCM_sys_Rm tmpfile_ncrcat
498
499    IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE}
500    #
501    IGCM_sys_Rm ${OUT_SE[*]}
502    #
503    # detect time counter : time or time_counter ie unlimited variable
504    var_unlim=$(ncdump -h ${RESULT_SE}|grep UNLIMITED| cut -d ' ' -f 1)
505
506    # Put correct climatological axis following calendar
507    case ${config_UserChoices_CalendarType} in
508      360d|360_day)
509      # 360 days
510        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\"'"
511        ;;
512      noleap|365_day)
513      # 365 days
514        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\"'"
515        ;;
516      all_leap|366_day)
517      # 366 days
518        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\"'"
519        ;;
520      leap|gregorian|standard)
521      # 365.2425 days
522        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\"'"
523        ;;
524    esac
525    eval IGCM_sys_ncap2 -Oh -s $ncap2cmd ${RESULT_SE} tmp.nc
526    IGCM_sys_Rm ${RESULT_SE}
527    IGCM_sys_Mv tmp.nc ${RESULT_SE}
528    #
529    eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE}
530    [ -f ${RESULT_SE} ] && IGCM_sys_Rm ${RESULT_SE}
531    #
532  done
533done
534
535# DODS copy
536if [ X${config_Post_DodsCopy} = XTRUE ]  ; then
537  for comp in ${config_ListOfComponents[*]} ; do
538    IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/SE
539    [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/SE
540  done
541fi
542
543# Temporal coverage id for atlas
544YEARS=${an_deb}_${an_fin}
545DIR_OUT=SE
546
547export DEBUG_debug; export BigBrother ; export libIGCM; export SUBMIT_DIR; export POST_DIR; export Script_Output ;
548export StandAlone ; export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_MBG ; export RESOL_SRF ;
549export RESOL_SBG ; export YEARS; export DIR_OUT
550listVarEnv="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"
551export listVarEnv;
552
553#D-
554# --------------------------------------------------------------------
555#D- Test if all was right before ATLAS
556# --------------------------------------------------------------------
557IGCM_debug_Verif_Exit_Post
558
559if [ ${config_UserChoices_TagName} = "IPSLCM4_v1_OASIS3" ] || \
560   [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ]        || \
561   [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then
562  #
563  export Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
564  IGCM_sys_QsubPost atlas_ORCHIDEE                          ;
565  export Script_Post_Output=atlas_LMDZ.${PeriodDateEnd}     ;
566  IGCM_sys_QsubPost atlas_LMDZ                              ;
567  export Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
568  IGCM_sys_QsubPost atlas_ORCA_LIM                          ;
569  export Script_Post_Output=additionnal.${PeriodDateEnd}    ;
570  IGCM_sys_QsubPost additionnal                             ;
571  #
572elif [ ${config_UserChoices_TagName} = "IPSLCM5" ]         || \
573     [ ${config_UserChoices_TagName} = "IPSLCM5A" ]        || \
574     [ ${config_UserChoices_TagName} = "IPSLCM5B" ]        || \
575     [ ${config_UserChoices_TagName} = "IPSLCM5A-MR" ]     || \
576     [ ${config_UserChoices_TagName} = "IPSLCM6" ] ; then
577  export Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
578  IGCM_sys_QsubPost atlas_ORCHIDEE                          ;
579  export Script_Post_Output=atlas_LMDZ.${PeriodDateEnd}     ;
580  IGCM_sys_QsubPost atlas_LMDZ                              ;
581  #export Script_Post_Output=metrics_LMDZ.${PeriodDateEnd}     ;
582  #IGCM_sys_QsubPost metrics_LMDZ                              ;
583  export Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
584  IGCM_sys_QsubPost atlas_ORCA_LIM                          ;
585  export Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
586  IGCM_sys_QsubPost atlas_PISCES                            ;
587  #
588elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ]         || \
589     [ ${config_UserChoices_TagName} = "LMDZOR" ]          || \
590     [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then
591  #
592  export Script_Post_Output=atlas_LMDZ.${PeriodDateEnd}     ;
593  IGCM_sys_QsubPost atlas_LMDZ                              ;
594  #export Script_Post_Output=metrics_LMDZ.${PeriodDateEnd}     ;
595  #IGCM_sys_QsubPost metrics_LMDZ                              ;
596  export Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
597  IGCM_sys_QsubPost atlas_ORCHIDEE                          ;
598  #
599elif [ ${config_UserChoices_TagName} = "LMDZ" ] ; then
600  #
601  #export Script_Post_Output=metrics_LMDZ.${PeriodDateEnd}     ;
602  #IGCM_sys_QsubPost metrics_LMDZ                              ;
603  export Script_Post_Output=atlas_LMDZ.${PeriodDateEnd}     ;
604  IGCM_sys_QsubPost atlas_LMDZ                              ;
605  #
606elif [ ${config_UserChoices_TagName} = "OL" ]              || \
607     [ ${config_UserChoices_TagName} = "OL2" ] ; then
608  #
609  export Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
610  IGCM_sys_QsubPost atlas_ORCHIDEE                          ;
611  #
612elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ]       || \
613     [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ]      || \
614     [ ${config_UserChoices_TagName} = "ORCA2_LIM3" ] ; then
615  #
616  export Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
617  IGCM_sys_QsubPost atlas_ORCA_LIM                          ;
618  #
619elif [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ] || \
620     [ ${config_UserChoices_TagName} = "ORCA2_LIM3_PISCES" ] ; then
621  #
622  export Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
623  IGCM_sys_QsubPost atlas_ORCA_LIM                          ;
624  export Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
625  IGCM_sys_QsubPost atlas_PISCES                            ;
626  #
627elif [ ${config_UserChoices_TagName} = "ORCA2_OFF_PISCES" ] ; then
628  #
629  export Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
630  IGCM_sys_QsubPost atlas_PISCES                            ;
631  #
632fi
633
634# Clean RUN_DIR_PATH (necessary for cesium and titane only)
635IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Note: See TracBrowser for help on using the repository browser.