source: trunk/libIGCM/libIGCM_post/libIGCM_post.ksh @ 135

Last change on this file since 135 was 126, checked in by sdipsl, 15 years ago

Bugfix : useless sed with config_Post_SeasonalFrequencyOffset

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Date Author Revision
File size: 26.3 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil
5# Contact: Sebastien.Denvil@ipsl.jussieu.fr
6# $Date$
7# $Author$
8# $Revision$
9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11# History:
12# Modification:
13#
14#**************************************************************
15
16#=======================================================================
17
18function IGCM_post_Configure
19{
20    IGCM_debug_PushStack "IGCM_post_Configure"
21
22    # Debug Print :
23    echo
24    IGCM_debug_Print 1 "IGCM_post_Configure :"
25    echo
26
27    typeset NbDays PeriodEndJul PostEndJul PeriodPost
28    RebuildFrequency=false
29
30    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
31
32        IGCM_debug_Print 1 "Asynchronous rebuild has been activated."
33        echo
34
35        case ${config_Post_RebuildFrequency} in
36            *y|*Y)
37                PeriodYear=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[yY]//" )
38                case ${config_UserChoices_PeriodLength} in
39                    *Y|*y)
40                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" )
41                        if [ ${PeriodPost} -le ${PeriodYear} ] ; then
42                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodYear}  ) -eq 0 ] ;  then
43                                RebuildFrequency=true
44                                NbRebuildDir=$( expr ${PeriodYear} / ${PeriodPost} )
45                            fi
46                        else
47                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
48                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
49                        fi ;;
50                    *M|*m)
51                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
52                        if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then
53                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then
54                                RebuildFrequency=true
55                                NbRebuildDir=$( expr $(( 12 * ${PeriodYear} )) / ${PeriodPost} )
56                            fi
57                        else
58                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
59                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
60                        fi ;;
61                    *D|*d)
62                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
63                        NbDays=$( IGCM_date_DaysInYear ${year} )
64                        if [ ${config_UserChoices_CalendarType} = 360d ] || [ ${config_UserChoices_CalendarType} = noleap ] ; then
65                            if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then
66                                if [ $( expr ${CumulPeriod} % $( expr \( ${NbDays} \* ${PeriodYear} \/ ${PeriodPost} \) ) ) -eq 0 ] ; then
67                                    RebuildFrequency=true
68                                    NbRebuildDir=$( expr $(( ${NbDays} * ${PeriodYear} )) / ${PeriodPost} )
69                                fi
70                            else
71                                IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
72                                IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
73                            fi
74                        else
75#                           if [ ${PeriodYear} -eq 1 ] ; then
76#                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
77#                               PostEndJul=${year}${NbDays}
78#                               #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}"
79#                               #echo "PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
80#                               if [ ${PostEndJul} -eq ${PeriodEndJul} ] ; then
81#                                   RebuildFrequency=true
82#                                   NbRebuildDir=$( expr ${NbDays} / ${PeriodPost} )
83#                               fi
84#                           else
85                            IGCM_debug_Print 3 "For RebuildFrequency with leap calendar:"
86                            IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y."
87                            IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment."
88#                           fi
89                        fi;;
90                esac ;;
91            *M|*m)
92                PeriodMonth=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[mM]//" )
93                case ${config_UserChoices_PeriodLength} in
94                    *Y|*y)
95                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
96                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
97                    *M|*m)
98                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
99                        if [ ${PeriodPost} -le ${PeriodMonth} ] ; then
100                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodMonth}  ) -eq 0 ] ;  then
101                                RebuildFrequency=true
102                                NbRebuildDir=$( expr ${PeriodMonth} / ${PeriodPost} )
103                            fi
104                        else
105                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
106                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
107                        fi ;;
108                    *D|*d)
109                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
110                        IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}" ;;
111                esac
112                ;;
113            *D|*d)
114                PeriodDay=$( echo ${config_Post_RebuildFrequency} | sed -e "s/[dD]//" )
115                case ${config_UserChoices_PeriodLength} in
116                    *Y|*y)
117                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
118                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
119                    *M|*m)
120                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
121                        IGCM_debug_Print 3 "RebuildFrequency frequency ${config_Post_RebuildFrequency}" ;;
122                    *D|*d)
123                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
124                        if [ ${PeriodPost} -le ${PeriodDay} ] ; then
125                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} )) % ${PeriodDay}  ) -eq 0 ] ;  then
126                                RebuildFrequency=true
127                                NbRebuildDir=$( expr ${PeriodDay} / ${PeriodPost} )
128                            fi
129                        else
130                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
131                            IGCM_debug_Print 3 "RebuildFrequency frequency : ${config_Post_RebuildFrequency}"
132                        fi ;;
133
134                esac
135                ;;
136            NONE|none)
137                ;;
138            *)
139                IGCM_debug_Print 3 "KeyWord not allowed for RebuildFrequency in config.card"
140                ;;
141        esac
142    else
143        #
144        IGCM_debug_Print 1 "Asynchronous rebuild has not been activated"
145        IGCM_debug_Print 1 "Proceed with standard post-treatment pathway"
146        echo
147        #
148    fi
149
150    IGCM_debug_Print 1 "RebuildFrequency flag value : ${RebuildFrequency}"
151    IGCM_post_Initialize
152
153    IGCM_debug_PopStack "IGCM_post_Configure"
154}
155
156function IGCM_post_Initialize
157{
158    IGCM_debug_PushStack "IGCM_post_Initialize"
159
160    # Debug Print :
161    echo
162    IGCM_debug_Print 1 "IGCM_post_Initialize :"
163    echo
164
165    typeset POST NbDays PeriodEndJul PostEndJul LengthDays
166    POST=false
167
168    #==================================
169    # Define variable ${config_Post_${post_freq}}
170    # who contains frequency for specific post-treatment
171    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Post
172
173    for option in ${config_Post[*]} ; do
174        IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Post ${option}
175    done
176
177    # READ TIME SERIES OR SEASONAL FREQUENCY
178    # AND TURN ON THE FLAG WHEN MODULO IS ZERO
179    for post_freq in TimeSeriesFrequency SeasonalFrequency ; do
180        #
181        # Initialize
182        #
183        eval ${post_freq}=false
184        #
185        # Extract frequency from previously defined variable
186        #
187        config_Post_post_freq=$( eval echo \${config_Post_${post_freq}} )
188        #
189        # Offset for Seasonal Average starting period
190        #
191        if [ ${post_freq} = SeasonalFrequency ] ; then
192            if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
193                PeriodOffset=0
194            else
195                PeriodOffset=${config_Post_SeasonalFrequencyOffset}
196            fi
197        else
198            PeriodOffset=0
199        fi
200        #
201        if ( [ X${config_Post_post_freq} = X${NULL_STR} ] || [ X${config_Post_post_freq} = XNONE ] ) ; then
202            #
203            continue
204            #
205        fi
206        #
207        # For each componant select determine which files need post-processing
208        #
209        for comp in ${config_ListOfComponents[*]} ; do
210            #
211            #echo "-----"
212            eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
213            ListFilesName=${compname}_OutputFiles_List
214            eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
215            #
216            if [ X${FileName0} != X${NULL_STR} ] ; then
217                #
218                #IGCM_debug_Print 1 "Component      : ${compname}"
219                #
220                # INITIALISATION
221                #
222                eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
223                typeset i=0
224                #
225                until [ $i -eq $NbFiles ]; do
226                    #
227                    eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1
228                    eval file_in=${file_in_}
229                    let $(( i_ = i+2 ))
230                    eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
231                    eval flag_post=${flag_post_}
232                    #
233                    if [ X${flag_post} != XNONE ] ; then
234                    #
235                        case ${config_Post_post_freq} in
236                            *y|*Y)
237                                PeriodYear=$( echo ${config_Post_post_freq} | sed -e "s/[yY]//" )
238                                #
239                                case ${config_UserChoices_PeriodLength} in
240                                    *Y|*y)
241                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[yY]//" )
242                                        if [ ${PeriodPost} -le ${PeriodYear} ] ; then
243                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodYear} ) -eq 0 ] ;  then
244                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
245                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true
246                                            fi
247                                        else
248                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
249                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
250                                        fi ;;
251                                    *M|*m)
252                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
253                                        if [ ${PeriodPost} -le $(( ${PeriodYear} * 12 )) ] ; then
254                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) % $(( ${PeriodYear} * 12 )) ) -eq 0 ] ; then
255                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && eval ${post_freq}=true
256                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} * 12 )) -ne 0 ] && POST=true
257                                            fi
258                                        else
259                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
260                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
261                                        fi ;;
262                                    *D|*d)
263                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
264                                        NbDays=$( IGCM_date_DaysInYear ${year} )
265                                        if [ ${config_UserChoices_CalendarType} = 360d ] | [ ${config_UserChoices_CalendarType} = noleap ] ; then
266                                            if [ ${PeriodPost} -le $(( ${PeriodYear} * ${NbDays} )) ] ; then
267                                                if [ $( expr $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) % \
268                                                     $(( ${NbDays} * ${PeriodYear} / ${PeriodPost} )) ) -eq 0 ] ; then
269                                                    [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] && eval ${post_freq}=true
270                                                    [ $(( ${CumulPeriod} - ( ${PeriodOffset} * ${NbDays} / ${PeriodPost} ) )) -ne 0 ] POST=true
271                                                fi
272                                            else
273                                                IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
274                                                IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
275                                            fi
276                                        else
277#                                           if [ ${PeriodYear} -eq 1 ] ; then
278#                                               PeriodEndJul=$( IGCM_date_ConvertGregorianDateToJulian ${PeriodDateEnd} )
279#                                               PostEndJul=${year}${NbDays}
280#                                                #echo "PeriodYear=${PeriodYear} NbDays=${NbDays}"
281#                                               #echo PeriodEndJul=${PeriodEndJul} PostEndJul=${PostEndJul}"
282#                                               if [ ${PostEndJul} -le ${PeriodEndJul} ] ; then
283#                                                   eval ${post_freq}=true
284#                                                   POST=true
285#                                               fi
286#                                           else
287                                            IGCM_debug_Print 3 "For ${post_freq} with leap calendar, for ${comp} and ${file_in} :"
288                                            IGCM_debug_Print 3 "We have a daily PeriodLength frequency and RebuildFrequency=${PeriodYear}Y."
289                                            IGCM_debug_Print 3 "No post-treatment. Case not properly handle at this moment."
290#                                           fi
291                                        fi;;
292                                esac ;;
293                            *M|*m)
294                                PeriodMonth=$( echo ${config_Post_post_freq} | sed -e "s/[mM]//" )
295                                case ${config_UserChoices_PeriodLength} in
296                                    *Y|*y)
297                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
298                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
299                                    *M|*m)
300                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[mM]//" )
301                                        if [ ${PeriodPost} -le ${PeriodMonth} ] ; then
302                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) % ${PeriodMonth}  ) -eq 0 ] ;  then
303                                                [ $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
304                                                [ $(( ${CumulPeriod} * ${PeriodPost} -  ${PeriodOffset} )) -ne 0 ] && POST=true
305                                            fi
306                                        else
307                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
308                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
309                                        fi;;
310                                    *D|*d)
311                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
312                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
313                                esac ;;
314                            *D|*d)
315                                PeriodDay=$( echo ${config_Post_post_freq} | sed -e "s/[dD]//" )
316                                case ${config_UserChoices_PeriodLength} in
317                                    *Y|*y)
318                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
319                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
320                                    *M|*m)
321                                        IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
322                                        IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} " ;;
323                                    *D|*d)
324                                        PeriodPost=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" )
325                                        if [ ${PeriodPost} -le ${PeriodDay} ] ; then
326                                            if [ $( expr $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) % ${PeriodDay}  ) -eq 0 ] ;  then
327                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && eval ${post_freq}=true
328                                                [ $(( ${CumulPeriod} * ${PeriodPost} - ${PeriodOffset} )) -ne 0 ] && POST=true
329                                            fi
330                                        else
331                                            IGCM_debug_Print 3 "PeriodLength frequency ${config_UserChoices_PeriodLength} not compatbile with"
332                                            IGCM_debug_Print 3 "${flag_post} frequency : ${config_Post_post_freq} "
333                                        fi;;
334                                esac ;;
335                            NONE|none)
336                                ;;
337                            *)
338                                IGCM_debug_Print 3 "KeyWord not allowed for ${post_freq} in config.card"
339                                ;;
340                        esac
341                    fi
342                    let $(( i=i+3 ))
343                done
344            fi
345        done
346    done
347    #
348    if ( [ ! X${config_Post_TimeSeriesFrequency} = X${NULL_STR} ] && \
349         [ ! X${config_Post_TimeSeriesFrequency} = XNONE ]        && \
350         [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
351        TimeSeriesFrequency=true
352        POST=true
353    fi
354
355    if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && \
356         [ ! X${config_Post_RebuildFrequency} = XNONE ]        && \
357         [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ) ; then
358        RebuildFrequency=true
359        POST=true
360    fi
361
362    #
363    IGCM_debug_Print 1 "POST-TREATEMENT flag value : ${POST}"
364    #
365    IGCM_post_Submit
366
367    IGCM_debug_PopStack "IGCM_post_Initialize"
368}
369
370function IGCM_post_Submit
371{
372    IGCM_debug_PushStack "IGCM_post_Submit"
373
374    POST_DIR=${R_OUT_POST}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
375
376    if [ ${POST} = true ]; then
377        echo
378        IGCM_debug_Print 1 "IGCM_post_Submit :"
379        echo
380        IGCM_debug_Print 1 "POST_DIR = ${POST_DIR}"
381    fi
382
383    #============ TIME SERIES POST-TREATMENT ===========#
384    if [ ${TimeSeriesFrequency} = true ] ; then
385
386        IGCM_debug_Print 2 "TIME SERIES POST-TREATMENT :"
387        echo
388        #
389        typeset listVarEnv
390        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
391
392        if [ ${RebuildFrequency} = true ] ; then
393            #
394            echo export DEBUG_debug=${DEBUG_debug}     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
395            echo export MODIPSL=${MODIPSL}             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
396            echo export libIGCM_SX=${libIGCM}          >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
397            echo export libIGCM=${libIGCM_POST}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
398            echo export SUBMIT_DIR=${SUBMIT_DIR}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
399            echo export POST_DIR=${POST_DIR}           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
400            echo export MASTER=${MASTER}               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
401            echo export DateBegin=${DateBegin}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
402            echo export PeriodDateEnd=${PeriodDateEnd} >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
403            echo export StandAlone=false               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
404            echo export RESOL_ATM=${RESOL_ATM}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
405            echo export RESOL_OCE=${RESOL_OCE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
406            echo export RESOL_ICE=${RESOL_ICE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
407            echo export RESOL_SRF=${RESOL_SRF}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
408            echo export listVarEnv=${listVarEnv}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
409            echo IGCM_sys_MkdirWork ${POST_DIR}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
410            echo IGCM_debug_Verif_Exit                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
411            echo IGCM_sys_QsubPost create_ts           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
412            #
413        else
414            #
415            IGCM_sys_RshPost <<-EOF
416            export DEBUG_debug=${DEBUG_debug}
417            export MODIPSL=${MODIPSL}
418            export libIGCM_SX=${libIGCM}
419            export libIGCM=${libIGCM_POST}
420            export SUBMIT_DIR=${SUBMIT_DIR}
421            export POST_DIR=${POST_DIR}
422            export MASTER=${MASTER}
423            export DateBegin=${DateBegin}
424            export PeriodDateEnd=${PeriodDateEnd}
425            export StandAlone=false
426            export RESOL_ATM=${RESOL_ATM}
427            export RESOL_OCE=${RESOL_OCE}
428            export RESOL_ICE=${RESOL_ICE}
429            export RESOL_SRF=${RESOL_SRF}
430            export listVarEnv=${listVarEnv}
431            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
432            . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
433            IGCM_sys_MkdirWork ${POST_DIR}
434            IGCM_debug_Verif_Exit
435            IGCM_sys_QsubPost create_ts
436EOF
437            #
438        fi
439    fi
440
441    #=============  SEASONAL POST-TREATMENT ============#
442    if [ ${SeasonalFrequency} = true ] ; then
443        #
444        IGCM_debug_Print 2 "SEASONNAL POST-TREATMENT :"
445        echo
446        #
447        typeset listVarEnv
448        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,POST_DIR,DateBegin,PeriodDateEnd,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
449
450        if [ ${RebuildFrequency} = true ] ; then
451            #
452            echo export DEBUG_debug=${DEBUG_debug}     >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
453            echo export MODIPSL=${MODIPSL}             >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
454            echo export libIGCM_SX=${libIGCM}          >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
455            echo export libIGCM=${libIGCM_POST}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
456            echo export SUBMIT_DIR=${SUBMIT_DIR}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
457            echo export POST_DIR=${POST_DIR}           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
458            echo export MASTER=${MASTER}               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
459            echo export DateBegin=${DateBegin}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
460            echo export PeriodDateEnd=${PeriodDateEnd} >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
461            echo export StandAlone=false               >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
462            echo export RESOL_ATM=${RESOL_ATM}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
463            echo export RESOL_OCE=${RESOL_OCE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
464            echo export RESOL_ICE=${RESOL_ICE}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
465            echo export RESOL_SRF=${RESOL_SRF}         >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
466            echo export listVarEnv=${listVarEnv}       >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
467            echo IGCM_sys_MkdirWork ${POST_DIR}        >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
468            echo IGCM_debug_Verif_Exit                 >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
469            echo IGCM_sys_QsubPost create_se           >> ${RUN_DIR}/REBUILD_${PeriodDateBegin}/rebuild.ksh
470            #
471        else
472            #
473            IGCM_sys_RshPost <<-EOF
474            export DEBUG_debug=${DEBUG_debug}
475            export MODIPSL=${MODIPSL}
476            export libIGCM_SX=${libIGCM}
477            export libIGCM=${libIGCM_POST}
478            export SUBMIT_DIR=${SUBMIT_DIR}
479            export POST_DIR=${POST_DIR}
480            export MASTER=${MASTER}
481            export DateBegin=${DateBegin}
482            export PeriodDateEnd=${PeriodDateEnd}
483            export StandAlone=false
484            export RESOL_ATM=${RESOL_ATM}
485            export RESOL_OCE=${RESOL_OCE}
486            export RESOL_ICE=${RESOL_ICE}
487            export RESOL_SRF=${RESOL_SRF}
488            export listVarEnv=${listVarEnv}
489            . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
490            . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
491            IGCM_sys_MkdirWork ${POST_DIR}
492            IGCM_debug_Verif_Exit
493            IGCM_sys_QsubPost create_se
494EOF
495        #
496        fi
497    fi
498
499    #============== REBUILD POST-TREATMENT =============#
500
501    if ( [ ${config_Post_RebuildFromArchive} = true ] && [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
502        IGCM_sys_Put_Dir REBUILD_${PeriodDateBegin} ${REBUILD_DIR}
503    fi
504    #
505    if [ ${RebuildFrequency} = true ] ; then
506        #
507        if ( [ ${config_Post_RebuildFromArchive} = true ] ) ; then
508        #
509        IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM ARCHIVE:"
510        echo
511        #
512        typeset listVarEnv
513        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,RebuildFromArchive,POST_DIR,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
514        IGCM_sys_RshPost <<-EOF
515        export DEBUG_debug=${DEBUG_debug}
516        export MODIPSL=${MODIPSL}
517        export libIGCM_SX=${libIGCM}
518        export libIGCM=${libIGCM_POST}
519        export SUBMIT_DIR=${SUBMIT_DIR}
520        export RebuildFromArchive=${config_Post_RebuildFromArchive}
521        export REBUILD_DIR=${REBUILD_DIR}
522        export POST_DIR=${POST_DIR}
523        export MASTER=${MASTER}
524        export DateBegin=${DateBegin}
525        export PeriodDateBegin=${PeriodDateBegin}
526        export PeriodDateEnd=${PeriodDateEnd}
527        export NbRebuildDir=${NbRebuildDir}
528        export StandAlone=false
529        export RESOL_ATM=${RESOL_ATM}
530        export RESOL_OCE=${RESOL_OCE}
531        export RESOL_ICE=${RESOL_ICE}
532        export RESOL_SRF=${RESOL_SRF}
533        export listVarEnv=${listVarEnv}
534        . ${libIGCM_POST}/libIGCM_debug/libIGCM_debug.ksh
535        . ${libIGCM_POST}/libIGCM_sys/libIGCM_sys.ksh
536        IGCM_sys_MkdirWork ${POST_DIR}
537        IGCM_debug_Verif_Exit
538        IGCM_sys_QsubPost rebuild_fromArchive
539EOF
540
541        else 
542        #
543        IGCM_debug_Print 2 "REBUILD POST-TREATMENT FROM WORKDIR :"
544        echo
545        IGCM_debug_Print 2 "NOT FULLY SUPPORTED"
546        IGCM_debug_Print 2 "EXIT NOW TO AVOID BIG PROBLEM"
547        IGCM_debug_Print 2 "Contact libIGCM developpers"
548        #
549        IGCM_debug_Exit "FATAL ERROR IN REBUILD CONFIGURATION"
550        IGCM_debug_Verif_Exit
551        #
552
553#        typeset listVarEnv
554#        listVarEnv="DEBUG_debug,MODIPSL,libIGCM,libIGCM_SX,SUBMIT_DIR,REBUILD_DIR,RebuildFromArchive,POST_DIR,MASTER,DateBegin,PeriodDateBegin,PeriodDateEnd,NbRebuildDir,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF"
555#        export DEBUG_debug=${DEBUG_debug}
556#        export MODIPSL=${MODIPSL}
557#        export libIGCM_SX=${libIGCM}
558#        export libIGCM=${libIGCM}
559#        export SUBMIT_DIR=${SUBMIT_DIR}
560#        export RebuildFromArchive=${config_Post_RebuildFromArchive}
561#        export REBUILD_DIR=${REBUILD_DIR}
562#        export POST_DIR=${libIGCM}
563#        export DateBegin=${DateBegin}
564#        export PeriodDateBegin=${PeriodDateBegin}
565#        export PeriodDateEnd=${PeriodDateEnd}
566#        export NbRebuildDir=${NbRebuildDir}
567#        export StandAlone=false
568#        export RESOL_ATM=${RESOL_ATM}
569#        export RESOL_OCE=${RESOL_OCE}
570#        export RESOL_ICE=${RESOL_ICE}
571#        export RESOL_SRF=${RESOL_SRF}
572#        export listVarEnv=${listVarEnv}
573#        IGCM_sys_Qsub rebuild_fromWorkdir ${libIGCM}
574
575        fi
576    fi
577
578    IGCM_debug_PopStack "IGCM_post_Submit"
579}
Note: See TracBrowser for help on using the repository browser.