source: trunk/libIGCM/AA_create_se @ 1439

Last change on this file since 1439 was 1437, checked in by jgipsl, 6 years ago

For Irene:

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