source: trunk/libIGCM/AA_create_se @ 1336

Last change on this file since 1336 was 1336, checked in by mafoipsl, 8 years ago

On adapp at IDRIS, large memory (30 Gb) is also required for create_se job.

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

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