source: trunk/libIGCM/AA_create_se @ 1456

Last change on this file since 1456 was 1448, checked in by jgipsl, 6 years ago

Change in headers at irene : temporary remove option -m and use a workaround given by the TGCC. This change is done to avoid problems with resubmitting from job when submitting the main job from workdir.

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