source: tags/libIGCM_v2.0_beta3/AA_create_multi_se @ 1137

Last change on this file since 1137 was 681, checked in by mafoipsl, 12 years ago

On curie : Computing job on -q standard ie thin nodes, post-processing jobs on -q large ie large nodes. Stop default echo of commands.

  • Property svn:keywords set to Revision Author Date
File size: 25.2 KB
Line 
1#-Q- cesium #!/bin/ksh
2#-Q- cesium ######################
3#-Q- cesium ## CESIUM   CEA ##
4#-Q- cesium ######################
5#-Q- cesium #MSUB -r MULTISE             # Nom du job               
6#-Q- cesium #MSUB -N 1              # Reservation du noeud
7#-Q- cesium #MSUB -n 1              # Reservation du processus
8#-Q- cesium #MSUB -T 86400          # Limite de temps elapsed du job
9#-Q- cesium #MSUB -E "-j o"
10#-Q- cesium #MSUB -E "-S /bin/ksh"
11#-Q- curie ######################
12#-Q- curie ## CURIE   TGCC/CEA ##
13#-Q- curie ######################
14#-Q- curie #MSUB -r MULTISE        # Nom du job               
15#-Q- curie #MSUB -eo
16#-Q- curie #MSUB -n 1              # Reservation du processus
17#-Q- curie #MSUB -T 86400          # Limite de temps elapsed du job
18#-Q- curie #MSUB -E '--no-requeue'
19#-Q- curie #MSUB -q large
20#-Q- curie set +x
21#-Q- platine #!/usr/bin/ksh
22#-Q- platine ###################
23#-Q- platine ## PLATINE   CEA ##
24#-Q- platine ###################
25#-Q- platine #BSUB -J MULTISE                     # Nom du job
26#-Q- platine #BSUB -N                        # message a la fin du job
27#-Q- platine #BSUB -n 1                      # reservation des processeurs pour le job
28#-Q- platine #BSUB -W 1:00                   # Limite temps
29#-Q- platine #BSUB -q post              # Passage en queue post
30#-Q- platine #BSUB -L /bin/ksh
31#-Q- sx8brodie #!/bin/ksh
32#-Q- sx8brodie #######################
33#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
34#-Q- sx8brodie #######################
35#-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss
36#-Q- sx8brodie # @ wall_clock_limit = 1:00:00
37#-Q- sx8brodie # Nom du travail LoadLeveler
38#-Q- sx8brodie # @ job_name   = MULTISE
39#-Q- sx8brodie # Fichier de sortie standard du travail       
40#-Q- sx8brodie # @ output     = $(job_name).$(jobid)
41#-Q- sx8brodie # Fichier de sortie d'erreur du travail
42#-Q- sx8brodie # @ error      =  $(job_name).$(jobid)
43#-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
44#-Q- sx8brodie # @ notification = error
45#-Q- sx8brodie # @ 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
46#-Q- sx8brodie # @ queue
47#-Q- aix6 #!/bin/ksh
48#-Q- aix6 #######################
49#-Q- aix6 ##   VARGAS   IDRIS  ##
50#-Q- aix6 #######################
51#-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss
52#-Q- aix6 # @ wall_clock_limit = 1:00:00
53#-Q- aix6 # Nom du travail LoadLeveler
54#-Q- aix6 # @ job_name   = MULTISE
55#-Q- aix6 # Fichier de sortie standard du travail       
56#-Q- aix6 # @ output     = $(job_name).$(jobid)
57#-Q- aix6 # Fichier de sortie d'erreur du travail
58#-Q- aix6 # @ error      =  $(job_name).$(jobid)
59#-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
60#-Q- aix6 # @ notification = error
61#-Q- aix6 # @ 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
62#-Q- aix6 # @ queue
63#-Q- ulam #!/bin/ksh
64#-Q- ulam #######################
65#-Q- ulam ##   ULAM   IDRIS  ##
66#-Q- ulam #######################
67#-Q- ulam # Temps Elapsed max. d'une requete hh:mm:ss
68#-Q- ulam # @ wall_clock_limit = 1:00:00
69#-Q- ulam # Nom du travail LoadLeveler
70#-Q- ulam # @ job_name   = MULTISE
71#-Q- ulam # Fichier de sortie standard du travail       
72#-Q- ulam # @ output     = $(job_name).$(jobid)
73#-Q- ulam # Fichier de sortie d'erreur du travail
74#-Q- ulam # @ error      =  $(job_name).$(jobid)
75#-Q- ulam # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
76#-Q- ulam # @ notification = error
77#-Q- ulam # @ 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
78#-Q- ulam # @ queue
79#-Q- sx8mercure #!/bin/ksh
80#-Q- sx8mercure ######################
81#-Q- sx8mercure ## SX8MERCURE   CEA ##
82#-Q- sx8mercure ######################
83#-Q- sx8mercure #PBS -N MULTISE                   # Nom du job
84#-Q- sx8mercure #PBS -j o                    # regroupement des stdout et stderr
85#-Q- sx8mercure #PBS -S /usr/bin/ksh         # shell de soumission
86#-Q- sx8mercure #PBS -l memsz_job=8gb        # Limite memoire a 1 Go
87#-Q- sx8mercure #PBS -l cputim_job=24:00:00   # Limite temps a 1 heures
88#-Q- sx8mercure #PBS -q scalaire
89#-Q- sx8mercure #PBS -r n
90#-Q- sx9mercure #!/bin/ksh
91#-Q- sx9mercure ######################
92#-Q- sx9mercure ## SX9MERCURE  CCRT ##
93#-Q- sx9mercure ######################
94#-Q- sx9mercure #PBS -N MULTISE                   # Nom du job
95#-Q- sx9mercure #PBS -j o                    # regroupement des stdout et stderr
96#-Q- sx9mercure #PBS -S /usr/bin/ksh         # shell de soumission
97#-Q- sx9mercure #PBS -l memsz_job=8gb        # Limite memoire a 1 Go
98#-Q- sx9mercure #PBS -l elapstim_req=24:00:00   # Limite temps a 1 heures
99#-Q- sx9mercure #PBS -q scalaire
100#-Q- sx9mercure #PBS -r n
101#-Q- titane #!/bin/ksh
102#-Q- titane ######################
103#-Q- titane ## TITANE   CEA ##
104#-Q- titane ######################
105#-Q- titane #MSUB -r MULTISE             # Nom du job               
106#-Q- titane #MSUB -eo
107#-Q- titane #MSUB -n 1              # Reservation du processus
108#-Q- titane #MSUB -T 86400          # Limite de temps elapsed du job
109#-Q- titane #MSUB -q mono
110#-Q- titane #MSUB -E '-rn'
111#-Q- lxiv8 ######################
112#-Q- lxiv8 ## OBELIX      LSCE ##
113#-Q- lxiv8 ######################
114#-Q- lxiv8 #PBS -N MULTISE
115#-Q- lxiv8 #PBS -m a
116#-Q- lxiv8 #PBS -j oe
117#-Q- lxiv8 #PBS -q medium
118#-Q- lxiv8 #PBS -o SE.$$
119#-Q- lxiv8 #PBS -S /bin/ksh
120#-Q- default #!/bin/ksh
121#-Q- default ##################
122#-Q- default ## DEFAULT HOST ##
123#-Q- default ##################
124
125#**************************************************************
126# Author: Marie-Alice Foujols
127# Contact: Marie-Alice.Foujols__at__ipsl.jussieu.fr
128# $Revision::                                          $ Revision of last commit
129# $Author::                                            $ Author of last commit
130# $Date::                                              $ Date of last commit
131# IPSL (2006)
132#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
133#
134#**************************************************************
135
136#set -eu
137#set -vx
138
139date
140
141#-Q- sx8brodie export OMP_NUM_THREADS=1
142#-Q- aix6 export OMP_NUM_THREADS=1
143#-Q- ulam export OMP_NUM_THREADS=1
144
145########################################################################
146
147#D- Flag to determine if this job in a standalone mode
148#D- Default : value from AA_job if any
149StandAlone=${StandAlone:=true}
150
151#D- Path to libIGCM
152#D- Default : value from AA_job if any
153# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
154# WARNING you must check MirrorlibIGCM variable in sys library.
155# WARNING If this variable is true, you must use libIGCM_POST path instead
156# WARNING of your running libIGCM directory.
157libIGCM=${libIGCM:=::modipsl::/libIGCM}
158
159#D- Flag to determine atlas job's output directory
160#D- Default : value from libIGCM_post.ksh if any
161POST_DIR=${POST_DIR:=${PBS_O_WORKDIR:=$(pwd)}}
162
163#D- Increased verbosity (1, 2, 3)
164#D- Default : value from AA_job if any
165Verbosity=${Verbosity:=3}
166
167#D- Low level debug : to bypass lib test checks and stack construction
168#D- Default : value from AA_job if any
169DEBUG_debug=${DEBUG_debug:=false}
170
171#D- TEMPORARY Flag to determine atmospheric resolution
172#D- Default : value from atmospheric driver if any
173RESOL_ATM=${RESOL_ATM:=ALL}
174
175#D- Flag to determine surface resolution
176#D- Default : value from surface driver if any
177RESOL_SRF=ALL
178
179#D- Flag to determine surface resolution
180#D- Default : value from surface driver if any
181RESOL_SBG=ALL
182
183#D- TEMPORARY Flag to determine ocean resolution
184#D- Default : value from ocean driver if any
185RESOL_OCE=${RESOL_OCE:=ORCA2}
186
187#D- TEMPORARY Flag to determine ice resolution
188#D- Default : value from ice driver if any
189RESOL_ICE=${RESOL_ICE:=ORCA2}
190
191#D- TEMPORARY Flag to determine marine biogeochemistry resolution
192#D- Default : value from ice driver if any
193RESOL_MBG=${RESOL_MBG:=ORCA2}
194
195########################################################################
196
197. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
198      ( ${DEBUG_debug} ) && IGCM_debug_Check
199. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
200     ( ${DEBUG_debug} ) && IGCM_card_Check
201. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
202     ( ${DEBUG_debug} ) && IGCM_date_Check
203#-------
204. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
205
206########################################################################
207
208#set -vx
209
210IGCM_sys_MkdirWork ${RUN_DIR_PATH}
211IGCM_sys_Cd ${RUN_DIR_PATH}
212
213# ------------------------------------------------------------------
214# Test if all was right before proceeding further
215# ------------------------------------------------------------------
216IGCM_debug_Verif_Exit_Post
217
218if [ ${StandAlone} = true ] ; then
219    CARD_DIR=${SUBMIT_DIR}
220else
221    CARD_DIR=${RUN_DIR_PATH}
222    IGCM_sys_Get_Master ${SUBMIT_DIR}/config.card ${RUN_DIR_PATH}
223    IGCM_sys_Get_Master ${SUBMIT_DIR}/run.card    ${RUN_DIR_PATH}
224    IGCM_sys_Get_Master ${SUBMIT_DIR}/COMP        ${RUN_DIR_PATH}
225    IGCM_sys_Get_Master ${SUBMIT_DIR}/POST        ${RUN_DIR_PATH}
226fi
227
228#
229# First of all
230#
231IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card UserChoices
232typeset option
233for option in ${config_UserChoices[*]} ; do
234    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option}
235done
236
237IGCM_card_DefineArrayFromSection       ${CARD_DIR}/config.card Ensemble
238typeset option
239for option in ${config_Ensemble[*]} ; do
240    IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Ensemble ${option}
241done
242#
243echo
244IGCM_debug_PrintVariables 3 config_UserChoices_TagName
245#IGCM_debug_PrintVariables 3 config_UserChoices_SpaceName
246#IGCM_debug_PrintVariables 3 config_UserChoices_ExperimentName
247IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType
248IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin
249IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd
250IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength
251IGCM_debug_PrintVariables 3 config_Ensemble_EnsembleName
252IGCM_debug_PrintVariables 3 config_Ensemble_EnsembleDate
253echo
254
255#==================================
256#R_SAVE : Job output directory
257#R_BUFR : Job output buffered directory
258if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
259  FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
260  if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
261    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
262    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
263    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
264  else
265    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
266    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
267    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
268  fi
269else
270  if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
271    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
272    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
273    R_DODS=${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
274  else
275    R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
276    R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
277    R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
278  fi
279fi
280#
281IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card ListOfComponents
282
283IGCM_card_DefineArrayFromSection   ${CARD_DIR}/config.card Post
284
285#
286# If option MultiSeasonalFrequency is not found (optionnal) put MultiSeasonalFrequency=50Y
287#
288FoundMultiSeasonal=false
289for option in ${config_Post[*]} ; do
290    if [ ${option} = MultiSeasonalFrequency ] ; then
291        FoundMultiSeasonal=true
292        IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post MultiSeasonalFrequency
293    fi
294done
295if [ ! X${FoundMultiSeasonal} = Xtrue ] ; then
296    config_Post_MultiSeasonalFrequency=50Y
297fi
298#
299IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
300#
301# Determine period for seasonnal average. Default : value from AA_job if any
302#
303DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )}
304#
305PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )}
306#
307IGCM_debug_Print 1 "DefineVariableFromOption : Post "
308IGCM_debug_PrintVariables 3 config_Post_SeasonalFrequency
309IGCM_debug_PrintVariables 3 config_Post_MultiSeasonalFrequency
310echo
311
312#
313freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
314#
315multifreq=$( echo ${config_Post_MultiSeasonalFrequency} |  sed -e "s/[yY]//" )
316#
317DIR_OUT=SE_${multifreq}Y
318#
319an_multi_fin=$(( $( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} ) / 1000 ))
320an_multi_deb=$( IGCM_date_YearDigit $(( an_multi_fin - multifreq + 1 )) )
321an_multi_fin=$( IGCM_date_YearDigit ${an_multi_fin} )
322#
323# For each component selected determine which files need post-processing
324#
325for comp in ${config_ListOfComponents[*]} ; do
326    #
327    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
328    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
329    #
330    card=${CARD_DIR}/COMP/${compname}.card
331    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
332    #
333    ListFilesName=${compname}_OutputFiles_List
334    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
335    #
336    if [ X${FileName0} != X${NULL_STR} ] ; then
337        #
338        # INITIALISATION
339        #
340        eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
341        typeset i=2
342        #
343        until [ $i -gt $NbFiles ]; do
344            #
345            eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
346            #
347            if [ X${flag_post} != XNONE ] ; then
348                #
349                # Check if seasonal is required for this file
350                #
351                IGCM_card_DefineArrayFromSection ${card} ${flag_post}
352                #
353                # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
354                #
355                # variable option allready typeset above
356                for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
357                    if [ ${option} = Seasonal ] ; then
358                        FoundSeasonal=true
359                        IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
360                    fi
361                done
362                #
363                if [ ! X${FoundSeasonal} = Xtrue ] ; then
364                    eval ${compname}_${flag_post}_Seasonal=ON
365                fi
366                #
367                if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
368                    (( i=i+3 ))
369                    continue
370                fi
371                #
372                # CREATE LIST
373                #
374                FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
375                #
376                DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
377                #
378                MULTI_DIRECTORY=${R_SAVE}/${comp}/Analyse/${DIR_OUT}
379                #
380                TestedFile=${config_UserChoices_JobName}_SE_${an_multi_deb}_${an_multi_fin}_${FILE}.nc
381                #
382                IGCM_sys_TestFileArchive ${MULTI_DIRECTORY}/${TestedFile}
383                if [ ! $? = 0 ] ; then
384                    eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE}
385                fi
386            fi
387            (( i=i+3 ))
388        done # until [ $i -eq $NbFiles ]
389    fi
390done         # for comp
391
392for comp in ${config_ListOfComponents[*]} ; do
393    #
394    eval R_OUT_${comp}=${R_SAVE}/${comp}
395    #
396    i=0
397    for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do
398        #
399        RESULT_MULTI_SE=${config_UserChoices_JobName}_SE_${an_multi_deb}_${an_multi_fin}_${file}.nc
400        # Do not redo an existing SE
401        IGCM_sys_TestFileArchive ${R_SAVE}/${comp}/Analyse/${DIR_OUT}/${RESULT_MULTI_SE}
402        if [ $? = 0 ] ; then
403            continue
404        fi
405        #
406        eval file_path=\${R_OUT_${comp}}/Analyse/SE/
407        #
408        (( an = an_multi_deb ))
409        # Initialize array
410        #set -A liste_file_se
411        #set -A liste_file_se_tmp
412        unset liste_file_se
413        unset liste_file_se_tmp
414        while [ ${an} -le ${an_multi_fin} ] ; do
415            #
416            an_deb=$(printf "%04i\n" ${an} )
417            #
418            (( an_fin = an_deb + freq - 1 ))
419            date=${an_deb}_${an_fin}
420            #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc
421            #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc
422            liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_SE_${date}_${file}.nc
423            liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_SE_${date}_${file}.nc
424            (( an = an + freq ))
425        done
426        #
427        IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH}
428        IGCM_debug_Verif_Exit_Post
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        # detect time counter : time or time_counter ie unlimited variable
439        var_unlim=$(ncdump -h ${liste_file_se_tmp[1]}|grep UNLIMITED|awk '{print $1}')
440
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            IGCM_sys_ncra -O -v ${list_var_final_ncra} -d ${var_unlim},${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]}
447        done
448        IGCM_sys_Rm ${liste_file_se_tmp[*]}
449        #
450
451        # Search of common list of variables to be treated
452        nbfile=0
453        for file_common_var in ${OUT_SE[*]} ; do
454           ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncrcat
455           (( nbfile = nbfile + 1 ))
456        done
457        list_var_final_ncrcat=`cat tmpfile_ncrcat | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','`
458        IGCM_sys_Rm tmpfile_ncrcat
459
460        IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_MULTI_SE}
461        #
462        IGCM_sys_Rm ${OUT_SE[*]}
463       
464        # Put correct climatological axis following calendar
465        case ${config_UserChoices_CalendarType} in
466                360d|360_day)
467                        # 360 days
468                        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\"'"
469                        ;;
470                noleap|365_day)
471                        # 365 days
472                        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\"'"
473                        ;;
474                all_leap|366_day)
475                        # 366 days
476                        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\"'"
477                        ;;
478                leap|gregorian|standard)
479                        # 365.2425 days
480                        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\"'"
481                        ;;
482        esac
483        eval IGCM_sys_ncap2 -Oh -s $ncap2cmd ${RESULT_MULTI_SE} tmp.nc
484        IGCM_sys_Rm ${RESULT_MULTI_SE}
485        IGCM_sys_Mv tmp.nc ${RESULT_MULTI_SE}
486        #
487        eval IGCM_sys_Put_Out ${RESULT_MULTI_SE} \${R_OUT_${comp}}/Analyse/${DIR_OUT}/${RESULT_MULTI_SE}
488        IGCM_sys_Rm ${RESULT_MULTI_SE}
489        #
490    done
491done
492
493# DODS copy
494for comp in ${config_ListOfComponents[*]} ; do
495    IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/${DIR_OUT}
496    [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/${DIR_OUT}
497done
498
499YEARS=${an_multi_deb}_${an_multi_fin}
500
501export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone
502export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_MBG ; export RESOL_SRF ; export RESOL_SBG
503export R_SAVE; export config_UserChoices_JobName; export config_UserChoices_TagName; export YEARS; export DIR_OUT
504listVarEnv="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"
505export listVarEnv;
506
507#D-
508# --------------------------------------------------------------------
509#D- Test if all was right before ATLAS
510# --------------------------------------------------------------------
511IGCM_debug_Verif_Exit_Post
512
513if [ ${config_UserChoices_TagName} = "IPSLCM4_v1_OASIS3" ] || \
514   [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ]        || \
515   [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then
516    #
517    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
518    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
519    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
520    IGCM_sys_QsubPost atlas_LMDZ                       ;
521    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
522    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
523    Script_Post_Output=additionnal.${PeriodDateEnd}    ;
524    IGCM_sys_QsubPost additionnal                      ;
525    #
526elif [ ${config_UserChoices_TagName} = "IPSLCM5" ]  || \
527     [ ${config_UserChoices_TagName} = "IPSLCM5A" ] || \
528     [ ${config_UserChoices_TagName} = "IPSLCM5B" ] || \
529     [ ${config_UserChoices_TagName} = "IPSLCM5A-MR" ] ; then
530    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
531    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
532    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
533    IGCM_sys_QsubPost atlas_LMDZ                       ;
534    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
535    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
536    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
537    IGCM_sys_QsubPost atlas_PISCES                     ;
538    #
539elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ]  || \
540     [ ${config_UserChoices_TagName} = "LMDZOR" ]   || \
541     [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then
542    #
543    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
544    IGCM_sys_QsubPost atlas_LMDZ                       ;
545    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
546    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
547    #
548elif [ ${config_UserChoices_TagName} = "LMDZ" ] ; then
549    #
550    Script_Post_Output=atlas_LDMZ.${PeriodDateEnd}     ;
551    IGCM_sys_QsubPost atlas_LMDZ                       ;
552    #
553elif [ ${config_UserChoices_TagName} = "OL" ]      || \
554     [ ${config_UserChoices_TagName} = "OL2" ] ; then
555    #
556    Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ;
557    IGCM_sys_QsubPost atlas_ORCHIDEE                   ;
558    #
559elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ]       ||
560     [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ] ; then
561    #
562    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
563    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
564elif [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ]  ; then
565    #
566    Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ;
567    IGCM_sys_QsubPost atlas_ORCA_LIM                   ;
568    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
569    IGCM_sys_QsubPost atlas_PISCES                     ;
570elif [ ${config_UserChoices_TagName} = "ORCA2_OFF_PISCES" ]  ; then
571    #
572    Script_Post_Output=atlas_PISCES.${PeriodDateEnd}   ;
573    IGCM_sys_QsubPost atlas_PISCES                     ;
574    #
575fi
576
577# Clean RUN_DIR_PATH (necessary for cesium and titane only)
578IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Note: See TracBrowser for help on using the repository browser.