source: trunk/libIGCM/AA_create_se @ 1517

Last change on this file since 1517 was 1494, checked in by cetlod, 4 years ago

Use prepost partition to manage Pots-processing

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