source: trunk/libIGCM/AA_create_se @ 838

Last change on this file since 838 was 837, checked in by labetoulle, 11 years ago

On Curie, ins_job sets up project ID. See #98.

Add

#-Q- curie #MSUB -A ::default_project::

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