source: tags/libIGCM_v2.0/AA_create_se @ 1137

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