source: trunk/libIGCM/AA_create_se @ 907

Last change on this file since 907 was 905, checked in by sdipsl, 11 years ago

-cleanup

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

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

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

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

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

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

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

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Revision Author Date
File size: 25.6 KB
Line 
1#-Q- curie ######################
2#-Q- curie ## CURIE   TGCC/CEA ##
3#-Q- curie ######################
4#-Q- curie #MSUB -r SE             # Nom du job
5#-Q- curie #MSUB -eo
6#-Q- curie #MSUB -n 1              # Reservation du processus
7#-Q- curie #MSUB -T 36000          # Limite de temps elapsed du job
8#-Q- curie #MSUB -q 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      *Y|*y)
331        PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' )
332        (( an = an_deb ))
333        # Initialize array
334        unset liste_file_se
335        unset liste_file_se_tmp
336        while [ ${an} -le ${an_fin} ] ; do
337          #
338          an4=$(printf "%04i\n" ${an} )
339          #
340          diy=$( IGCM_date_DaysInCurrentPeriod ${an4}0101 ${config_UserChoices_PeriodLength} )
341          afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) )
342          #
343          date=${an4}0101_${afin}
344          #
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 + ${PeriodLengthInYears} ))
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          unset liste_file_se
396          unset liste_file_se_tmp
397          while [ ${an} -le ${an_fin} ] ; do
398            moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
399            #
400            an4=$(printf "%04i\n" ${an} )
401            #
402            date=${an4}${mois}01_${an4}${mois}${moisL}
403            #
404            liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
405            liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
406
407            (( an = an + 1 ))
408          done
409          #
410          IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
411          IGCM_debug_Verif_Exit_Post
412
413          # Apply IGCM_Patch if needed
414          if [ ! ${RebuildFrequency} = true ] ; then
415            if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
416              for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
417                for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
418                  IGCM_${Patch} ${file_t}
419                done
420              done
421            fi
422          fi
423
424          # Search of common list of variables to be treated
425          nbfile=0
426          for file_common_var in ${liste_file_se_tmp[*]} ; do
427            ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
428            (( nbfile = nbfile + 1 ))
429          done
430            list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
431          IGCM_sys_Rm tmpfile_ncra
432
433          IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
434
435          IGCM_sys_Rm ${liste_file_se_tmp[*]}
436        done
437        ;;
438      *D|*d)
439        for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do
440          #
441          (( nb = ${mois} - 1 ))
442          #
443          OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc
444          #
445          (( an = an_deb ))
446          # Initialize array
447          unset liste_file_se
448          unset liste_file_se_tmp
449          while [ ${an} -le ${an_fin} ] ; do
450            moisL=$( IGCM_date_DaysInMonth ${an} ${mois} )
451            #
452            an4=$(printf "%04i\n" ${an} )
453              #
454            length_d=$(( ${config_UserChoices_PeriodLength} - 1 ))
455            # for one day
456            if [ ${length_d} -eq 1 ] ; then
457              (( length_d = 0 ))
458            fi
459            (( day  = 1 ))
460            while [ ${day} -le ${moisL} ] ; do
461              day2=$(printf "%02i\n" ${day} )
462              day_beg=${an4}${mois}${day2}
463              day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} )
464              date=${an4}${mois}${day_beg}_${an4}${mois}${day_end}
465              #
466              liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
467              liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc
468              (( day = day + 1 ))
469            done
470            (( an = an + 1 ))
471          done
472          #
473          IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
474          IGCM_debug_Verif_Exit_Post
475
476          # Apply IGCM_Patch if needed
477          if [ ! ${RebuildFrequency} = true ] ; then
478            if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) !=  X${NULL_STR} ]; then
479              for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do
480                for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do
481                  IGCM_${Patch} ${file_t}
482                done
483              done
484            fi
485          fi
486
487          # Search of common list of variables to be treated
488          nbfile=0
489          for file_common_var in ${liste_file_se_tmp[*]} ; do
490            ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra
491            (( nbfile = nbfile + 1 ))
492          done
493            list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
494          IGCM_sys_Rm tmpfile_ncra
495
496          IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
497          IGCM_sys_Rm ${liste_file_se_tmp[*]}
498        done
499        ;;
500      esac
501      #
502
503      # Search of common list of variables to be treated
504      nbfile=0
505      for file_common_var in ${OUT_SE[*]} ; do
506        ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncrcat
507        (( nbfile = nbfile + 1 ))
508      done
509      list_var_final_ncrcat=`cat tmpfile_ncrcat | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
510      IGCM_sys_Rm tmpfile_ncrcat
511
512    IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE}
513    #
514    IGCM_sys_Rm ${OUT_SE[*]}
515    #
516    # detect time counter : time or time_counter ie unlimited variable
517    var_unlim=$(ncdump -h ${RESULT_SE}|grep UNLIMITED| cut -d ' ' -f 1)
518
519    # Put correct climatological axis following calendar
520    case ${config_UserChoices_CalendarType} in
521      360d|360_day)
522      # 360 days
523        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\"'"
524        ;;
525      noleap|365_day)
526      # 365 days
527        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\"'"
528        ;;
529      all_leap|366_day)
530      # 366 days
531        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\"'"
532        ;;
533      leap|gregorian|standard)
534      # 365.2425 days
535        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\"'"
536        ;;
537    esac
538    eval IGCM_sys_ncap2 -Oh -s $ncap2cmd ${RESULT_SE} tmp.nc
539    IGCM_sys_Rm ${RESULT_SE}
540    IGCM_sys_Mv tmp.nc ${RESULT_SE}
541    #
542    eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE}
543    IGCM_sys_Rm ${RESULT_SE}
544    #
545  done
546done
547
548# DODS copy
549if [ X${config_Post_DodsCopy} = XTRUE ]  ; then
550  for comp in ${config_ListOfComponents[*]} ; do
551    IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/SE
552    [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/SE
553  done
554fi
555
556# Temporal coverage id for atlas
557YEARS=${an_deb}_${an_fin}
558DIR_OUT=SE
559
560export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone
561export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_MBG ; export RESOL_SRF ; export RESOL_SBG
562export R_SAVE; export config_UserChoices_JobName; export config_UserChoices_TagName; export YEARS; export DIR_OUT
563listVarEnv="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"
564export listVarEnv;
565
566#D-
567# --------------------------------------------------------------------
568#D- Test if all was right before ATLAS
569# --------------------------------------------------------------------
570IGCM_debug_Verif_Exit_Post
571
572if [ ${config_UserChoices_TagName} = "IPSLCM4_v1_OASIS3" ] || \
573   [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ]        || \
574   [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then
575  #
576  Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
577  IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
578  Script_Post_Output=atlas_LMDZ.${PeriodDateEnd}     ;
579  IGCM_sys_QsubPost atlas_LMDZ                       ;
580  Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
581  IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
582  Script_Post_Output=additionnal.${PeriodDateEnd}    ;
583  IGCM_sys_QsubPost additionnal                      ;
584  #
585elif [ ${config_UserChoices_TagName} = "IPSLCM5" ]  || \
586     [ ${config_UserChoices_TagName} = "IPSLCM5A" ] || \
587     [ ${config_UserChoices_TagName} = "IPSLCM5B" ] || \
588     [ ${config_UserChoices_TagName} = "IPSLCM5A-MR" ] ; then
589  Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
590  IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
591  Script_Post_Output=atlas_LMDZ.${PeriodDateEnd}     ;
592  IGCM_sys_QsubPost atlas_LMDZ                       ;
593  Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
594  IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
595  Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
596  IGCM_sys_QsubPost atlas_PISCES                     ;
597  #
598elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ]  || \
599     [ ${config_UserChoices_TagName} = "LMDZOR" ]   || \
600     [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then
601  #
602  Script_Post_Output=atlas_LMDZ.${PeriodDateEnd}     ;
603  IGCM_sys_QsubPost atlas_LMDZ                       ;
604  Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
605  IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
606  #
607elif [ ${config_UserChoices_TagName} = "LMDZ" ] ; then
608  #
609  Script_Post_Output=atlas_LMDZ.${PeriodDateEnd}     ;
610  IGCM_sys_QsubPost atlas_LMDZ                       ;
611  #
612elif [ ${config_UserChoices_TagName} = "OL" ]      || \
613     [ ${config_UserChoices_TagName} = "OL2" ] ; then
614  #
615  Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
616  IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
617  #
618elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ]       ||
619     [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ] ; then
620  #
621  Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
622  IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
623elif [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ]  ; then
624  #
625  Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
626  IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
627  Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
628  IGCM_sys_QsubPost atlas_PISCES                     ;
629elif [ ${config_UserChoices_TagName} = "ORCA2_OFF_PISCES" ]  ; then
630  #
631  Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
632  IGCM_sys_QsubPost atlas_PISCES                     ;
633  #
634fi
635
636# Clean RUN_DIR_PATH (necessary for cesium and titane only)
637IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Note: See TracBrowser for help on using the repository browser.