source: trunk/libIGCM/AA_create_se @ 835

Last change on this file since 835 was 832, checked in by sdipsl, 11 years ago
  • Trivial changes to accomodate new_libIGCM function defined here /ccc/cont003/home/dsm/p86mart/.bash_alias (ksh-->bash)

She transforms every cp and rm by IGCM_sys_Cp and IGCM_sys_Rm within IGCM_debug_Check. So we need to source sys before calling it.

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

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

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

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

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

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

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

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