source: trunk/libIGCM/AA_create_se @ 236

Last change on this file since 236 was 236, checked in by sdipsl, 14 years ago
  • Slight modification in the way we read and interpret card for post-processing. Actual card will not work with this revision

List=(histmth.nc, ${R_OUT_ATM_O_M}/${PREFIX}_1M_histmth.nc, Post_1M_histmth), \

(histday.nc, ${R_OUT_ATM_O_D}/${PREFIX}_1D_histday.nc, Post_1D_histday), \
(histhf.nc, ${R_OUT_ATM_O_H}/${PREFIX}_HF_histhf.nc, Post_HF_histhf)

  • ChunckJob2D, ChunckJob3d have control over TS, with the folliwing keywords :

OFF (TimeSeries? not active), NONE (TimeSeries? active but without chunck), 10Y (TimeSeries? active, but produce as many as needed 10 years lenght time series)

  • Seasonnal (ON/OFF), have control over SE files production.
  • Patch can be applied systematicaly even if no Time Series or Seasonal post-proceesing are required
  • A first step towards the merge between rebuildFromArchive and rebuildFrowWorkdir jobs
  • We may change rebuildFromArchive job name as it is not that meaningful in this context
  • We may change ChunckJob2D/ChunckJob3D as it is not that meaningful in this context
  • Some bugfix and optimisation
  • For testing purpose only (still try to have backward compatibility)

Exemple :

[Post_1D_histday]
Patches= (Patch_20091030_histcom_time_axis)
GatherWithInternal? = (lon, lat, presnivs, time_counter)
TimeSeriesVars2D = (bils, cldh, ...)
ChunckJob2D = 50Y
TimeSeriesVars3D = (temp, theta, ovap, ovapinit, geop, ...)
ChunckJob3D = OFF
Seasonal=OFF

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