source: branches/libIGCM_CESMEP/AA_create_se

Last change on this file was 1585, checked in by ssenesi, 12 months ago

merge branch libIGCM_CESMEP with trunk that handles RedHat8 on Irene

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