source: tags/libIGCM_v2.0_beta2/AA_create_multi_se @ 698

Last change on this file since 698 was 658, checked in by labetoulle, 12 years ago

Add Ensemble functionality to libIGCM - First step :
modify output directories according to an option in section [Ensemble]
in config.card (modification of config.card yet to be done).

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