source: tags/libIGCM_v1_8-old/libIGCM_sys/libIGCM_sys_obelix.ksh @ 1170

Last change on this file since 1170 was 305, checked in by brocksce, 14 years ago
  • Added cdo sys to libIGCM_sys_cesium
  • Made some cleaning and added a comment to indicate that .atlas_env_* file sources not only ferret/fast/atlas but also nco, cdo operators.
  • Property svn:keywords set to Date Author Revision
File size: 35.2 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil, Martial Mancip, Christian Laguerre
5# Contact: Martial.Mancip_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# The documentation of this file can be automatically generated
18# if you use the prefix #D- for comments to be extracted.
19# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
20#=========================================================
21
22#D-#==================================================
23#D-LibIGCM_sys for obelix
24#D-#==================================================
25#D-
26#D- This ksh library if a layer under some usefull
27#D-environment variables and shell commands.
28#D-All those definitions depend on host particularities.
29#D-It manages a stack mechanism and test validity of operations.
30#D-All function described bellow must be prefixed by IGCM_sys.
31
32#====================================================
33# libIGCM_sys PARAMETERS
34#====================================================
35
36#=====================================================
37# set DEBUG_sys to true to output calls of function
38typeset -r DEBUG_sys=${DEBUG_sys:=true}
39
40#=====================================================
41# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
42typeset -r DRYRUN=${DRYRUN:=0}
43
44# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
45# -------------------------------------------------------------------------------------
46# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
47# |          |  Cp/Exe param files |            |  Chmod  |                           |
48# |          |      Qsub           |            |         |                           |
49# -------------------------------------------------------------------------------------
50# |    0     |       yes           |    yes     |  yes    |      yes                  |
51# -------------------------------------------------------------------------------------
52# |    1     |       yes           |    yes     |  yes    |      no                   |
53# -------------------------------------------------------------------------------------
54# |    2     |       yes           |    yes     |  no     |      no                   |
55# -------------------------------------------------------------------------------------
56# |    3     |       yes           |    no      |  no     |      no                   |
57# -------------------------------------------------------------------------------------
58
59#=====================================================
60# Global Variables :
61#=====================================================
62# Language : "fr" or "en"
63typeset -r MYLANG="fr"
64
65#=====================================================
66# Host and user names
67# $hostname ou hostname
68typeset  HOST=${HOST:=$( hostname )}
69# $username ou whoami
70typeset  LOGIN=${LOGIN:=$( whoami )}
71
72#D-
73#D-#==================================================
74#D-Program used in libIGCM
75#D-#==================================================
76
77# rsync with path
78typeset -r RSYNC=/usr/bin/rsync
79# RSYNC_opt args to rsync
80typeset -r RSYNC_opt="-va"
81
82#====================================================
83# Set environment tools (ferret, nco, cdo)
84#====================================================
85. /home/users/brock/.atlas_env_asterix_ksh
86
87#=========================================================
88# Host specific DIRECTORIES
89#====================================================
90
91#====================================================
92#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
93typeset -r R_EXE="${MODIPSL}/bin"
94
95#====================================================
96#- SCRATCHDIR (=> ${R_DONNEES})
97if [ X${PBS_O_WORKDIR} != X ] ; then
98    typeset -r SCRATCHDIR=/scratch/$PBS_O_LOGNAME.$PBS_JOBID
99#==${WORKDIR}
100# cf /usr/Local/Env sur obelix
101else
102    typeset -r SCRATCHDIR=/tmp
103fi
104#FOR DEBUG RUN :
105#typeset -r SCRATCHDIR=/home/scratch01/${LOGIN}
106
107#====================================================
108#- SUBMIT_DIR : submission dir
109if [ X${PBS_O_WORKDIR} != X ] ; then
110    typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}}
111else
112    typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
113fi
114#====================================================
115#- ARCHIVE
116typeset -r ARCHIVE=/home/scratch01/${LOGIN}
117
118#====================================================
119#- libIGCM_POST
120typeset -r libIGCM_POST=${libIGCM}
121
122#====================================================
123#- IN
124typeset -r R_IN=${R_IN:=/home/orchidee01/mmancip/IGCM}
125
126#====================================================
127#- OUT
128typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
129
130#====================================================
131#- OUT_POST
132typeset -r R_OUT_POST=${R_OUT}
133
134#====================================================
135#- RUN_DIR_PATH : Temporary working directory (=> TMP)
136typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$}
137
138#====================================================
139#- BIG_DIR : BIG_DIR to store files waiting for rebuild
140typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}
141
142#====================================================
143#- HOST_MPIRUN_COMMAND
144typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"}
145
146#=========================================================
147#- Add "time" before mpirun command
148MPIRUN_COMMAND="time "${MPIRUN_COMMAND}
149echo ${MPIRUN_COMMAND}
150
151#====================================================
152#- Max number of arguments passed to nco operator or demigration command
153UNIX_MAX_LIMIT=360
154
155#D-#==================================================
156#D-function IGCM_sys_RshMaster
157#D-* Purpose: Just a fake command to wrapp
158#D-           IGCM_card call in post-treatment
159#D-           Ulam do not see brodie filesystem
160#D-           Cesium do not see all mercure filesystem
161#D-           That's why we need this hack.
162#D-* Examples:
163#D-
164function IGCM_sys_RshMaster {
165    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
166
167    ssh ${HOST} exec /bin/ksh  <<-EOF
168    export libIGCM=${libIGCM}
169    export DEBUG_debug=${DEBUG_debug}
170    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
171    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
172    ${@}
173EOF
174    if [ $? -gt 0 ] ; then
175        echo "IGCM_sys_RshMaster : erreur."
176        IGCM_debug_Exit "IGCM_sys_RshMaster"
177    fi
178    IGCM_debug_PopStack "IGCM_sys_RshMaster"
179}
180
181#D-#==================================================
182#D-function IGCM_sys_RshArchive
183#D-* Purpose: Archive rsh command
184#D-* Examples:
185#D-
186function IGCM_sys_RshArchive {
187    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
188    /bin/ksh <<-EOF
189    ${@}
190EOF
191    if [ $? -gt 0 ] ; then
192        echo "IGCM_sys_RshArchive : erreur."
193        IGCM_debug_Exit "IGCM_sys_RshArchive"
194    fi
195    IGCM_debug_PopStack "IGCM_sys_RshArchive"
196}
197
198#D-#==================================================
199#D-function IGCM_sys_RshPost
200#D-* Purpose: Post-process rsh command
201#D-* Examples:
202#D-
203(( RshPNum = 0 ))
204function IGCM_sys_RshPost {
205    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
206    if ( $DEBUG_sys ) ; then
207        echo "IGCM_sys_RshPost :" $@
208    fi
209    ssh obelix3 exec /bin/ksh $@ > out_RshPost.${RshPNum}
210    if [ $? -gt 0 ] ; then
211        echo "IGCM_sys_RshPost : erreur."
212        IGCM_debug_Exit "IGCM_sys_RshPost"
213    fi
214    (( RshPNum = RshPNum + 1 ))
215    IGCM_debug_PopStack "IGCM_sys_RshPost"
216}
217
218#D-#==================================================
219#D-function IGCM_sys_SendMail
220#D-* Purpose: Send mail when simulation is over
221#D-* Examples:
222#D-
223function IGCM_sys_SendMail {
224    IGCM_debug_PushStack "IGCM_sys_SendMailPost" $@
225    if ( $DEBUG_sys ) ; then
226        echo "IGCM_sys_SendMail :" $@
227    fi
228
229    cat  << END_MAIL > job_atlas.mail
230Dear ${LOGIN},
231
232  Simulation ${config_UserChoices_JobName} is finished on supercomputer `hostname`.
233  Job started : ${DateBegin}
234  Job ended   : ${DateEnd}
235  Ouput files are available in ${R_SAVE}
236  Script files and Script Outputs are available in ${SUBMIT_DIR}
237END_MAIL
238
239    if [ ! -z ${config_UserChoices_MailName} ] ; then
240        mailx -s "${config_UserChoices_JobName} completed" ${config_UserChoices_MailName} <  job_end.mail
241    elif [ -f ~/.forward ] ; then
242        mailx -s "${config_UserChoices_JobName} completed" $( cat ~/.forward ) < job_end.mail
243    fi
244
245    if [ $? -gt 0 ] ; then
246        echo "IGCM_sys_SendMail : erreur."
247        IGCM_debug_Exit "IGCM_sys_SendMail"
248    fi
249    IGCM_debug_PopStack "IGCM_sys_SendMail"
250}
251
252#D-#==================================================
253#D-function IGCM_sys_Mkdir
254#D-* Purpose: Master locale mkdir command
255#D-* Examples:
256#D-
257function IGCM_sys_Mkdir {
258    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
259    if ( $DEBUG_sys ) ; then
260        echo "IGCM_sys_Mkdir :" $@
261    fi
262    if [ ! -d ${1} ]; then
263        \mkdir -p $1
264        if [ $? -gt 0 ] ; then
265            echo "IGCM_sys_Mkdir : erreur."
266            IGCM_debug_Exit "IGCM_sys_Mkdir"
267        fi
268    fi
269    # vérification :
270    if [ ! -d ${1} ] ; then
271        echo "IGCM_sys_Mkdir : erreur."
272        IGCM_debug_Exit "IGCM_sys_Mkdir"
273    fi
274    IGCM_debug_PopStack "IGCM_sys_Mkdir"
275}
276
277#D-#==================================================
278#D-function IGCM_sys_MkdirArchive
279#D-* Purpose: Mkdir on Archive
280#D-* Examples:
281#D-
282function IGCM_sys_MkdirArchive {
283    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
284    if ( $DEBUG_sys ) ; then
285        echo "IGCM_sys_MkdirArchive :" $@
286    fi
287    #- creation de repertoire sur le serveur fichier
288    if [ ! -d ${1} ]; then 
289        \mkdir -p $1
290        if [ $? -gt 0 ] ; then
291            echo "IGCM_sys_MkdirArchive : erreur."
292            IGCM_debug_Exit "IGCM_sys_MkdirArchive"
293        fi
294    fi
295    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
296}
297
298#D-#==================================================
299#D-function IGCM_sys_MkdirWork
300#D-* Purpose: Mkdir on Work
301#D-* Examples:
302#D-
303function IGCM_sys_MkdirWork {
304    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
305    if ( $DEBUG_sys ) ; then
306        echo "IGCM_sys_MkdirWork :" $@
307    fi
308    #- creation de repertoire sur le serveur fichier
309    if [ ! -d ${1} ]; then 
310        \mkdir -p $1
311        if [ $? -gt 0 ] ; then
312            echo "IGCM_sys_MkdirWork : erreur."
313            IGCM_debug_Exit "IGCM_sys_MkdirWork"
314        fi
315    fi
316    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
317}
318
319#D-#==================================================
320#D-function IGCM_sys_Cd
321#D-* Purpose: master cd command
322#D-* Examples:
323#D-
324function IGCM_sys_Cd {
325    IGCM_debug_PushStack "IGCM_sys_Cd" $@
326    if ( $DEBUG_sys ) ; then
327        echo "IGCM_sys_Cd :" $@
328    fi
329    \cd $1
330    if [ $? -gt 0 ] ; then
331        echo "IGCM_sys_Cd : erreur."
332        IGCM_debug_Exit "IGCM_sys_Cd"
333    fi
334    IGCM_debug_PopStack "IGCM_sys_Cd"
335}
336
337#D-#==================================================
338#D-function IGCM_sys_Chmod
339#D-* Purpose: Chmod
340#D-* Examples:
341#D-
342function IGCM_sys_Chmod {
343    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
344    if ( $DEBUG_sys ) ; then
345        echo "IGCM_sys_Chmod :" $@
346    fi
347    if [ $DRYRUN -le 1 ]; then
348        \chmod $@
349        if [ $? -gt 0 ] ; then
350            echo "IGCM_sys_Chmod : erreur."
351            IGCM_debug_Exit "IGCM_sys_Chmod"
352        fi
353    else
354        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
355    fi
356    IGCM_debug_PopStack "IGCM_sys_Chmod"
357}
358
359#D-#==================================================
360#D-function IGCM_sys_FileSize
361#D-* Purpose: Filesize
362#D-* Examples:
363#D-
364function IGCM_sys_FileSize {
365    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
366
367    typeset sizeF
368    set +A sizeF -- $( ls -la ${1} )
369    if [ $? -gt 0 ] ; then
370        IGCM_debug_Exit "IGCM_sys_FileSize"
371    fi
372    eval ${2}=${sizeF[4]}
373
374    IGCM_debug_PopStack "IGCM_sys_FileSize"
375}
376
377#D-#==================================================
378#D-function IGCM_sys_TestDir
379#D-* Purpose: Test Directory that must exists
380#D-* Examples:
381#D-
382function IGCM_sys_TestDir {
383    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
384    if ( $DEBUG_sys ) ; then
385        echo "IGCM_sys_TestDir :" $@
386    fi
387    typeset ExistFlag
388    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
389    IGCM_debug_PopStack "IGCM_sys_TestDir"
390
391    return ${ExistFlag}
392}
393
394#D-#==================================================
395#D-function IGCM_sys_TestDirArchive
396#D-* Purpose: Test Directory that must exists on Archive
397#D-* Examples:
398#D-
399function IGCM_sys_TestDirArchive {
400    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
401    if ( $DEBUG_sys ) ; then
402        echo "IGCM_sys_TestDirArchive :" $@
403    fi
404    typeset ExistFlag
405    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
406    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
407
408    return ${ExistFlag}
409}
410
411#D-#==================================================
412#D-function IGCM_sys_TestFileArchive
413#D-* Purpose: Test file that must NOT EXISTS on Archive
414#D-* Examples:
415#D-
416function IGCM_sys_TestFileArchive {
417    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
418    if ( $DEBUG_sys ) ; then
419        echo "IGCM_sys_TestFileArchive :" $@
420    fi
421    typeset ExistFlag
422    ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
423    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
424
425    return ${ExistFlag}
426}
427
428#D-#==================================================
429#D-function IGCM_sys_CountFileArchive
430#D-* Purpose: Count files on Archive filesystem
431#D-* Examples:
432#D-
433function IGCM_sys_CountFileArchive {
434    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
435    ls ${@} 2>/dev/null | wc -l
436    if [ $? -gt 0 ] ; then
437        echo "IGCM_sys_CountFileArchive : erreur."
438    fi
439    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
440}
441
442#D-#==================================================
443#D-function IGCM_sys_Tree
444#D-* Purpose: Tree directories with files on ${ARCHIVE}
445#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
446#D-
447function IGCM_sys_Tree {
448    IGCM_debug_PushStack "IGCM_sys_Tree" $@
449    if ( $DEBUG_sys ) ; then
450        echo "IGCM_sys_Tree :" $@
451    fi
452
453    \tree -f $@
454
455    IGCM_debug_PopStack "IGCM_sys_Tree"
456}
457
458#D-#==================================================
459#D-function IGCM_sys_Tar
460#D-* Purpose: master un-tar command
461#D-* Examples:
462#D-
463function IGCM_sys_Tar {
464    IGCM_debug_PushStack "IGCM_sys_Tar" $@
465    if ( $DEBUG_sys ) ; then
466        echo "IGCM_sys_Tar :" $@
467    fi
468    \tar cvf $@
469    if [ $? -gt 0 ] ; then
470        echo "IGCM_sys_Tar : erreur."
471        IGCM_debug_Exit "IGCM_sys_Tar"
472    fi
473    \tar tvf $1
474
475    IGCM_debug_PopStack "IGCM_sys_Tar"
476}
477
478#D-#==================================================
479#D-function IGCM_sys_UnTar
480#D-* Purpose: master un-tar command
481#D-* Examples:
482#D-
483function IGCM_sys_UnTar {
484    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
485    if ( $DEBUG_sys ) ; then
486        echo "IGCM_sys_UnTar :" $@
487    fi
488    \tar xvf $1
489    if [ $? -gt 0 ] ; then
490        echo "IGCM_sys_UnTar : erreur."
491        IGCM_debug_Exit "IGCM_sys_UnTar"
492    fi
493    IGCM_debug_PopStack "IGCM_sys_UnTar"
494}
495
496#D-#==================================================
497#D-function IGCM_sys_Qsub
498#D-* Purpose: Qsub new job
499#D-* Examples:
500#D-
501function IGCM_sys_Qsub {
502    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
503    if ( $DEBUG_sys ) ; then
504        echo "IGCM_sys_Qsub :" $@
505    fi
506#    /usr/local/bin/qsub -q short -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
507    /usr/local/bin/qsub -q medium -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1
508    if [ $? -gt 0 ] ; then
509        echo "IGCM_sys_Qsub : erreur."
510        IGCM_debug_Exit "IGCM_sys_Qsub"
511    fi
512    IGCM_debug_PopStack "IGCM_sys_Qsub"
513}
514
515#D-#==================================================
516#D-function IGCM_sys_QsubPost
517#D-* Purpose: Qsub new job on scalaire
518#D-* Examples:
519#D-
520function IGCM_sys_QsubPost {
521    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
522    if ( $DEBUG_sys ) ; then
523        echo "IGCM_sys_QsubPost :" $@
524    fi
525    /usr/local/bin/qsub -q medium -o ${POST_DIR}/$1.${PeriodDateEnd}.out ${libIGCM_POST}/$1.job -v ${listVarEnv}
526    if [ $? -gt 0 ] ; then
527        echo "IGCM_sys_QsubPost : erreur " $@
528        IGCM_debug_Exit "IGCM_sys_QsubPost"
529    fi
530    IGCM_debug_PopStack "IGCM_sys_QsubPost"
531}
532
533#D-*************************
534#D- File transfer functions
535#D-*************************
536#D-
537
538#D-#==================================================
539#D-function IGCM_sys_Rsync_out
540#D-* Purpose: treat return val of rsync
541#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
542#D-  Error values and explanations can depend on your system version.
543function IGCM_sys_Rsync_out {
544    RET=$1
545    if [ ! $RET ] ; then
546        echo "rsync error !"
547    fi
548
549    if [ $MYLANG = "fr" ]; then
550        case $RET in
551            0)  return ;;
552            1)  echo "Erreur de rsync ; RERR_SYNTAX : "
553                echo "Erreur de syntaxe ou d'utilisation."
554                return;;
555            2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
556                echo "Incompatibilité de protocole."
557                return;;
558            3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
559                echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
560                echo "répertoires"
561                return;;
562            4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
563                echo "Action demandée non supportée : une tentative de manipulation de"
564                echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
565                echo "été faite ; ou une option qui est supportée par le  client  mais"
566                echo "pas par le serveur a été spécifiée."
567                return;;
568            10) echo "Erreur de rsync ; RERR_SOCKETIO"
569                echo "Erreur dans le socket d'entrée sortie"
570                return;;
571            11) echo "Erreur de rsync ; RERR_FILEIO"
572                echo "Erreur d'entrée sortie fichier"
573                return;;
574            12) echo "Erreur de rsync ; RERR_STREAMIO"
575                echo "Erreur dans flux de donnée du protocole rsync"
576                return;;
577            13) echo "Erreur de rsync ; RERR_MESSAGEIO"
578                echo "Erreur avec les diagnostics du programme"
579                return;;
580            14) echo "Erreur de rsync ; RERR_IPC"
581                echo "Erreur dans le code IPC"
582                return;;
583            20) echo "Erreur de rsync ; RERR_SIGNAL"
584                echo "SIGUSR1 ou SIGINT reçu"
585                return;;
586            21) echo "Erreur de rsync ; RERR_WAITCHILD"
587                echo "Une erreur retournée par waitpid()"
588                return;;
589            22) echo "Erreur de rsync ; RERR_MALLOC"
590                echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
591                return;;
592            23) echo ""
593                echo "Erreur fichier inexistant"
594                return;;
595            30) echo "Erreur de rsync ; RERR_TIMEOUT"
596                echo "Temps d'attente écoulé dans l'envoi/réception de données"
597                return;;
598            *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
599                return;;
600        esac
601    elif [ $MYLANG = "en" ] ; then
602        case $RET in
603            0)  return;;               
604            1)  echo "rsync error : Syntax or usage error "
605                return;;
606            2)  echo "rsync error : Protocol incompatibility "
607                return;;
608            3)  echo "rsync error : Errors selecting input/output files, dirs"
609                return;;
610            4)  echo "rsync error : Requested action not supported: an attempt"
611                echo "was made to manipulate 64-bit files on a platform that cannot support"
612                echo "them; or an option was specified that is supported by the client and"
613                echo "not by the server."
614                return;;
615            5)  echo "rsync error : Error starting client-server protocol"
616                return;;
617            10) echo "rsync error : Error in socket I/O "
618                return;;
619            11) echo "rsync error : Error in file I/O "
620                return;;
621            12) echo "rsync error : Error in rsync protocol data stream "
622                return;;
623            13) echo "rsync error : Errors with program diagnostics "
624                return;;
625            14) echo "rsync error : Error in IPC code "
626                return;;
627            20) echo "rsync error : Received SIGUSR1 or SIGINT "
628                return;;
629            21) echo "rsync error : Some error returned by waitpid() "
630                return;;
631            22) echo "rsync error : Error allocating core memory buffers "
632                return;;
633            23) echo "rsync error : Partial transfer due to error"
634                return;;
635            24) echo "rsync error : Partial transfer due to vanished source files"
636                return;;
637            30) echo "rsync error : Timeout in data send/receive "
638                return;;
639            *)  echo "rsync error : return code of rsync unknown :" $RET
640                return;;
641        esac
642    else
643        echo "unknown language $MYLANG."
644        return
645    fi
646}
647   
648#D-#==================================================
649#D-function IGCM_sys_Cp
650#D-* Purpose: generic cp
651#D-* Examples:
652#D-
653function IGCM_sys_Cp {
654    IGCM_debug_PushStack "IGCM_sys_Cp" $@
655    if ( $DEBUG_sys ) ; then
656        echo "IGCM_sys_Cp :" $@
657    fi
658
659    typeset RET
660
661    echo cp --preserve=timestamps $@ > out_rsync 2>&1
662    \cp --preserve=timestamps $@ >> out_rsync 2>&1
663    RET=$?
664   
665    if [ ${RET} -gt 0 ] ; then
666        echo "IGCM_sys_Cp : error."
667        cat out_rsync
668        IGCM_debug_Exit "IGCM_sys_Cp"
669    fi
670    IGCM_debug_PopStack "IGCM_sys_Cp"
671}
672
673#D-#==================================================
674#D-function IGCM_sys_Rm
675#D-* Purpose: generic rm
676#D-* Examples:
677#D-
678function IGCM_sys_Rm {
679    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
680    if ( $DEBUG_sys ) ; then
681        echo "IGCM_sys_Rm :" $@
682    fi
683
684    typeset RET
685
686    echo rm $@ > out_rsync 2>&1
687    \rm $@ >> out_rsync 2>&1
688    RET=$?
689   
690    if [ ${RET} -gt 0 ] ; then
691        echo "IGCM_sys_Rm : error."
692        cat out_rsync
693        IGCM_debug_Exit "IGCM_sys_Rm"
694    fi
695    IGCM_debug_PopStack "IGCM_sys_Rm"
696}
697
698#D-#==================================================
699#D-function IGCM_sys_RmRunDir
700#D-* Purpose: rm tmpdir (dummy function most of the time batch
701#D-                      scheduler will do the job)
702#D-* Examples:
703#D-
704function IGCM_sys_RmRunDir {
705    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
706    if ( $DEBUG_sys ) ; then
707        echo "IGCM_sys_RmRunDir :" $@
708    fi
709
710    typeset RET
711
712    echo rm $@ > out_rsync 2>&1
713    \rm $@ >> out_rsync 2>&1
714    RET=$?
715
716    if [ ${RET} -gt 0 ] ; then
717        echo "IGCM_sys_RmRunDir : error."
718        cat out_rsync
719        IGCM_debug_Exit "IGCM_sys_RmRunDir"
720    fi
721
722    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
723}
724
725#D-#==================================================
726#D-function IGCM_sys_Mv
727#D-* Purpose: generic move
728#D-* Examples:
729#D-
730function IGCM_sys_Mv {
731    IGCM_debug_PushStack "IGCM_sys_Mv" $@
732    if ( $DEBUG_sys ) ; then
733        echo "IGCM_sys_Mv :" $@
734    fi
735
736    if [ $DRYRUN = 0 ]; then
737
738        typeset RET
739           
740        echo mv $@ > out_rsync 2>&1
741        \mv $@ >> out_rsync 2>&1
742        RET=$?
743   
744        if [ ${RET} -gt 0 ] ; then
745            echo "IGCM_sys_Mv : error in mv."
746            cat out_rsync
747            IGCM_debug_Exit "IGCM_sys_Mv"
748        fi
749    else
750        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
751    fi
752
753    IGCM_debug_PopStack "IGCM_sys_Mv"
754}
755
756#D-#==================================================
757#D-function IGCM_sys_Put_Dir
758#D-* Purpose: Copy a complete directory on $(ARCHIVE)
759#D-* Examples:
760#D-
761function IGCM_sys_Put_Dir {
762    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
763    if ( $DEBUG_sys ) ; then
764        echo "IGCM_sys_Put_Dir :" $@
765    fi
766    if [ $DRYRUN = 0 ]; then
767        if [ ! -d ${1} ] ; then
768            echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
769            IGCM_debug_PopStack "IGCM_sys_Put_Dir"
770            return
771        fi
772
773        typeset RET
774
775        # Only if we use rsync
776        #IGCM_sys_TestDirArchive $( dirname $2 )
777        #
778        #USUAL WAY
779        \cp -R $1 $2 > out_rsync 2>&1
780        RET=$?
781
782        if [ ${RET} -gt 0 ] ; then
783            echo "IGCM_sys_Put_Dir : error."
784            cat out_rsync
785            IGCM_debug_Exit "IGCM_sys_Put_Dir"
786        fi
787    else
788        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
789    fi
790    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
791}
792
793#D-#==================================================
794#D-function IGCM_sys_Get_Dir
795#D-* Purpose: Copy a complete directory from $(ARCHIVE)
796#D-* Examples:
797#D-
798function IGCM_sys_Get_Dir {
799    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
800    if ( $DEBUG_sys ) ; then
801        echo "IGCM_sys_Get_Dir :" $@
802    fi
803    if [ $DRYRUN = 0 ]; then
804        if [ ! -d ${1} ] ; then
805            echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
806            IGCM_debug_PopStack "IGCM_sys_Get_Dir"
807            return
808        fi
809
810        typeset RET
811
812        #USUAL WAY
813        \cp -R $1 $2 > out_rsync 2>&1
814        RET=$?
815
816        if [ ${RET} -gt 0 ] ; then
817            echo "IGCM_sys_Get_Dir : error."
818            cat out_rsync
819            IGCM_debug_Exit "IGCM_sys_Get_Dir"
820        fi
821    else
822        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
823    fi
824    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
825}
826
827#D-#==================================================
828#D-function IGCM_sys_Get_Master
829#D-* Purpose: Copy a complete directory from MASTER filesystem
830#D-* Examples:
831#D-
832function IGCM_sys_Get_Master {
833    IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
834    if ( $DEBUG_sys ) ; then
835        echo "IGCM_sys_Get_Master :" $@
836    fi
837    if [ $DRYRUN = 0 ]; then
838        if [ ! -d ${1} ] ; then
839            echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
840            IGCM_debug_PopStack "IGCM_sys_Get_Master"
841            return
842        fi
843
844        typeset RET
845        sleep 60
846
847        #USUAL WAY
848        cp -R $1 $2 > out_rsync 2>&1
849        RET=$?
850
851        if [ ${RET} -gt 0 ] ; then
852            echo "IGCM_sys_Get_Master : error."
853            cat out_rsync
854            IGCM_debug_Exit "IGCM_sys_Get_Master"
855        fi
856    else
857        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
858    fi
859    IGCM_debug_PopStack "IGCM_sys_Get_Master"
860}
861
862#D-#==================================================
863#D-function IGCM_sys_Put_Rest
864#D-* Purpose: Put computied restarts on $(ARCHIVE).
865#D-           File and target directory must exist.
866#D-* Examples:
867#D-
868function IGCM_sys_Put_Rest {
869    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
870    if ( $DEBUG_sys ) ; then
871        echo "IGCM_sys_Put_Rest :" $@
872    fi
873    if [ $DRYRUN = 0 ]; then
874
875        IGCM_sys_TestDirArchive $( dirname $2 )
876
877        if [ ! -f ${1} ] ; then
878            echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
879            IGCM_debug_Exit "IGCM_sys_Put_Rest"
880        fi
881
882        if [ X${JobType} = XRUN ] ; then
883            IGCM_sys_Chmod 444 ${1}
884        fi
885
886        typeset RET
887
888        echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
889        ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
890        RET=$?
891        IGCM_sys_Rsync_out $RET
892
893        ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
894        (( RET=RET+$? ))
895
896        if [ ${RET} -gt 0 ] ; then
897            echo "IGCM_sys_Put_Rest : error."
898            cat out_rsync
899            IGCM_debug_Exit "IGCM_sys_Put_Rest"
900        fi
901    else
902        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
903    fi
904    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
905}
906
907#D-#==================================================
908#D-function IGCM_sys_Put_Out
909#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
910#D-* Examples:
911#D-
912function IGCM_sys_Put_Out {
913    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
914    if ( $DEBUG_sys ) ; then
915        echo "IGCM_sys_Put_Out :" $@
916    fi
917    if [ $DRYRUN = 0 ]; then
918        if [ -f ${1} ] ; then
919            if [ ! -d $( dirname $2 ) ] ; then
920                IGCM_sys_MkdirArchive $( dirname $2 )
921            fi
922        else
923            echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
924            IGCM_debug_PopStack "IGCM_sys_Put_Out"
925            return 1
926        fi
927
928        typeset RET
929        #
930        if [ X${JobType} = XRUN ] ; then
931            if [ X${3} = X ] ; then
932                IGCM_sys_Chmod 444 ${1}
933            fi
934        fi
935        #
936
937        echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
938        ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
939        RET=$?
940        IGCM_sys_Rsync_out $RET
941
942        ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
943        (( RET=RET+$? ))
944
945        if [ ${RET} -gt 0 ] ; then
946            echo "IGCM_sys_Put_Out : error."
947            cat out_rsync
948            IGCM_debug_Exit "IGCM_sys_Put_Out"
949        fi
950    else
951        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
952    fi
953    IGCM_debug_PopStack "IGCM_sys_Put_Out"
954    return 0
955}
956
957#D-#==================================================
958#D-function IGCM_sys_Get
959#D-* Purpose: Get a file from ${ARCHIVE}
960#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
961#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
962function IGCM_sys_Get {
963    IGCM_debug_PushStack "IGCM_sys_Get" $@
964
965    typeset DEST RET dm_liste ifile target
966
967    if ( $DEBUG_sys ) ; then
968        echo "IGCM_sys_Get :" $@
969    fi
970    if [ $DRYRUN -le 2 ]; then
971        if [ X${1} = X'/l' ] ; then
972            # test if the first file is present in the old computation :
973            eval set +A dm_liste \${${2}}
974        else
975            dm_liste=${1}
976        fi
977        eval DEST=\${${#}}
978
979        # test if the (first) file is present in the old computation :
980        IGCM_sys_TestFileArchive ${dm_liste[0]}
981        RET=$?
982        if [ ${RET} -gt 0 ] ; then
983            echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
984            IGCM_debug_Exit "IGCM_sys_Get"
985            #return
986        fi
987
988        (( RET=0 ))
989        for target in ${dm_liste[*]} ; do
990          \cp ${target} ${DEST} >> out_rsync 2>&1
991          (( RET=RET+$? ))
992        done
993
994#       echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1
995#       ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1
996#       RET=$?
997#       IGCM_sys_Rsync_out $RET
998
999#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
1000#       (( RET=RET+$? ))
1001
1002        if [ ${RET} -gt 0 ] ; then
1003            echo "IGCM_sys_Get : copy error."
1004            cat out_rsync
1005            IGCM_debug_Exit "IGCM_sys_Get"
1006        fi
1007    else
1008        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1009    fi
1010    IGCM_debug_PopStack "IGCM_sys_Get"
1011}
1012
1013#D-#==================================================
1014#D-function IGCM_sys_Put_Dods
1015#D-* Purpose: DO NOTHING ! Put $(ARCHIVE) files on DODS internet protocole.
1016#D-* Examples:
1017#D-
1018function IGCM_sys_Put_Dods {
1019    IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
1020    if ( $DEBUG_sys ) ; then
1021        echo "IGCM_sys_Put_Dods :" $@
1022    fi
1023    if [ $DRYRUN = 0 ]; then
1024        if [ ! -d ${R_SAVE}/${1} ] ; then
1025            echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
1026            IGCM_debug_PopStack "IGCM_sys_Put_Dods"
1027            return
1028        fi
1029        #DO NOTHING
1030    else
1031        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1032    fi
1033    IGCM_debug_PopStack "IGCM_sys_Put_Dods"
1034}
1035
1036############################################################## A FINIR !!
1037
1038#D-#==================================================
1039#D-function IGCM_sys_GetDate_FichWork
1040#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
1041#D-* Examples:
1042#D-
1043function IGCM_sys_GetDate_FichWork {
1044    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
1045    if ( $DEBUG_sys ) ; then
1046        echo "IGCM_sys_GetDate_FichWork :" $@
1047    fi
1048    # donne la date filesys d'un fichier sur la machine work
1049    IGCM_debug_PopStack "IGCM_sys_FichWork"
1050}
1051
1052#D-#==================================================
1053#D-function IGCM_sys_GetDate_FichArchive
1054#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE
1055#D-* Examples:
1056#D-
1057function IGCM_sys_GetDate_FichArchive {
1058    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
1059    if ( $DEBUG_sys ) ; then
1060        echo "IGCM_sys_GetDate_FichArchive :" $@
1061    fi
1062    IGCM_debug_PopStack "IGCM_sys_FichArchive"
1063}
1064
1065##############################################################
1066# REBUILD OPERATOR
1067
1068function IGCM_sys_rebuild {
1069    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
1070    if ( $DEBUG_sys ) ; then
1071        echo "IGCM_sys_rebuild :" $@
1072    fi
1073    rebuild -f -o $@
1074    if [ $? -gt 0 ] ; then
1075       echo "IGCM_sys_rebuild : erreur ${@}."
1076       IGCM_debug_Exit "rebuild"
1077    fi
1078
1079    IGCM_debug_PopStack "IGCM_sys_rebuild"
1080}
1081
1082##############################################################
1083# NCO OPERATOR
1084
1085function IGCM_sys_ncap {
1086    IGCM_debug_PushStack "IGCM_sys_ncap" -- $@
1087    if ( $DEBUG_sys ) ; then
1088        echo "IGCM_sys_ncap :" $@
1089    fi
1090    /usr/local/bin/ncap $@
1091    if [ $? -gt 0 ] ; then
1092       echo "IGCM_sys_ncap : erreur ${@}."
1093#       IGCM_debug_Exit "ncap"
1094    fi
1095
1096    IGCM_debug_PopStack "IGCM_sys_ncap"
1097}
1098
1099ncatted=/usr/local/bin/ncatted
1100# Problem with ksh and string passed in this function to ncatted !
1101# function IGCM_sys_ncatted {
1102#     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
1103#     if ( $DEBUG_sys ) ; then
1104#       echo "IGCM_sys_ncatted :" $@
1105#     fi
1106#     /usr/local/bin/ncatted $@
1107#     if [ $? -gt 0 ] ; then
1108#        echo "IGCM_sys_ncatted : erreur ${@}."
1109#        IGCM_debug_Exit "ncatted"
1110#     fi
1111
1112#     IGCM_debug_PopStack "IGCM_sys_ncatted"
1113# }
1114
1115function IGCM_sys_ncbo {
1116    IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
1117    if ( $DEBUG_sys ) ; then
1118        echo "IGCM_sys_ncbo :" $@
1119    fi
1120    /usr/local/bin/ncbo $@
1121    if [ $? -gt 0 ] ; then
1122       echo "IGCM_sys_ncbo : erreur ${@}."
1123#       IGCM_debug_Exit "ncbo"
1124    fi
1125
1126    IGCM_debug_PopStack "IGCM_sys_ncbo"
1127}
1128
1129function IGCM_sys_ncdiff {
1130    IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
1131    if ( $DEBUG_sys ) ; then
1132        echo "IGCM_sys_ncdiff :" $@
1133    fi
1134    /usr/local/bin/ncdiff $@
1135    if [ $? -gt 0 ] ; then
1136       echo "IGCM_sys_ncdiff : erreur ${@}."
1137#       IGCM_debug_Exit "ncdiff"
1138    fi
1139
1140    IGCM_debug_PopStack "IGCM_sys_ncdiff"
1141}
1142
1143function IGCM_sys_ncea {
1144    IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
1145    if ( $DEBUG_sys ) ; then
1146        echo "IGCM_sys_ncea :" $@
1147    fi
1148    /usr/local/bin/ncea $@
1149    if [ $? -gt 0 ] ; then
1150       echo "IGCM_sys_ncea : erreur ${@}."
1151#       IGCM_debug_Exit "ncea"
1152    fi
1153
1154    IGCM_debug_PopStack "IGCM_sys_ncea"
1155}
1156
1157function IGCM_sys_ncecat {
1158    IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
1159    if ( $DEBUG_sys ) ; then
1160        echo "IGCM_sys_ncecat :" $@
1161    fi
1162    /usr/local/bin/ncecat $@
1163    if [ $? -gt 0 ] ; then
1164       echo "IGCM_sys_ncecat : erreur ${@}."
1165#       IGCM_debug_Exit "ncecat"
1166    fi
1167
1168    IGCM_debug_PopStack "IGCM_sys_ncecat"
1169}
1170
1171function IGCM_sys_ncflint {
1172    IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
1173    if ( $DEBUG_sys ) ; then
1174        echo "IGCM_sys_ncflint :" $@
1175    fi
1176    /usr/local/bin/ncflint $@
1177    if [ $? -gt 0 ] ; then
1178       echo "IGCM_sys_ncflint : erreur ${@}."
1179#       IGCM_debug_Exit "ncflint"
1180    fi
1181
1182    IGCM_debug_PopStack "IGCM_sys_ncflint"
1183}
1184
1185function IGCM_sys_ncks {
1186    IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
1187    if ( $DEBUG_sys ) ; then
1188        echo "IGCM_sys_ncks :" $@
1189    fi
1190    /usr/local/bin/ncks $@
1191    if [ $? -gt 0 ] ; then
1192       echo "IGCM_sys_ncks : erreur ${@}."
1193#       IGCM_debug_Exit "ncks"
1194    fi
1195
1196    IGCM_debug_PopStack "IGCM_sys_ncks"
1197}
1198
1199function IGCM_sys_ncpdq {
1200    IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
1201    if ( $DEBUG_sys ) ; then
1202        echo "IGCM_sys_ncpdq :" $@
1203    fi
1204    /usr/local/bin/ncpdq $@
1205    if [ $? -gt 0 ] ; then
1206       echo "IGCM_sys_ncpdq : erreur ${@}."
1207#       IGCM_debug_Exit "ncpdq"
1208    fi
1209
1210    IGCM_debug_PopStack "IGCM_sys_ncpdq"
1211}
1212
1213function IGCM_sys_ncra {
1214    IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
1215    if ( $DEBUG_sys ) ; then
1216        echo "IGCM_sys_ncra :" $@
1217    fi
1218    /usr/local/bin/ncra $@
1219    if [ $? -gt 0 ] ; then
1220       echo "IGCM_sys_ncra : erreur ${@}."
1221#       IGCM_debug_Exit "ncra"
1222    fi
1223
1224    IGCM_debug_PopStack "IGCM_sys_ncra"
1225}
1226
1227function IGCM_sys_ncrcat {
1228    IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
1229    if ( $DEBUG_sys ) ; then
1230        echo "IGCM_sys_ncrcat :" $@
1231    fi
1232    /usr/local/bin/ncrcat $@
1233    if [ $? -gt 0 ] ; then
1234       echo "IGCM_sys_ncrcat : erreur ${@}."
1235#       IGCM_debug_Exit "ncrcat"
1236    fi
1237
1238    IGCM_debug_PopStack "IGCM_sys_ncrcat"
1239}
1240
1241function IGCM_sys_ncrename {
1242    IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
1243    if ( $DEBUG_sys ) ; then
1244        echo "IGCM_sys_ncrename :" $@
1245    fi
1246    /usr/local/bin/ncrename $@
1247    if [ $? -gt 0 ] ; then
1248       echo "IGCM_sys_ncrename : erreur ${@}."
1249#       IGCM_debug_Exit "ncrename"
1250    fi
1251
1252    IGCM_debug_PopStack "IGCM_sys_ncrename"
1253}
1254
1255function IGCM_sys_ncwa {
1256    IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
1257    if ( $DEBUG_sys ) ; then
1258        echo "IGCM_sys_ncwa :" $@
1259    fi
1260    /usr/local/bin/ncwa $@
1261    if [ $? -gt 0 ] ; then
1262       echo "IGCM_sys_ncwa : erreur ${@}."
1263#       IGCM_debug_Exit "ncwa"
1264    fi
1265
1266    IGCM_debug_PopStack "IGCM_sys_ncwa"
1267}
1268
1269##############################################################
1270# CDO OPERATOR
1271
1272function IGCM_sys_cdo {
1273    IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
1274
1275    \cdo $@
1276    if [ $? -gt 0 ] ; then
1277       echo "IGCM_sys_cdo : erreur ${@}."
1278#       IGCM_debug_Exit "cdo"
1279    fi
1280
1281    IGCM_debug_PopStack "IGCM_sys_cdo"
1282}
1283
1284############################################################
1285# Activate Running Environnment Variables
1286
1287function IGCM_sys_activ_variables {
1288    IGCM_debug_PushStack "IGCM_sys_activ_variables"
1289    if ( $DEBUG_sys ) ; then
1290        echo "IGCM_sys_activ_variables"
1291    fi
1292    IGCM_debug_PopStack "IGCM_sys_activ_variables"
1293}
1294
1295############################################################
1296# Desactivate Running Environnment Variables
1297
1298function IGCM_sys_desactiv_variables {
1299    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
1300    if ( $DEBUG_sys ) ; then
1301        echo "IGCM_sys_desactiv_variables"
1302    fi
1303    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
1304}
1305
1306############################################################
1307# Build run file
1308
1309function IGCM_sys_build_run_file {
1310    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
1311    if ( $DEBUG_sys ) ; then
1312        echo "IGCM_sys_build_run_file"
1313    fi
1314    IGCM_debug_PopStack "IGCM_sys_build_run_file"
1315}
Note: See TracBrowser for help on using the repository browser.