source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercure.ksh @ 343

Last change on this file since 343 was 343, checked in by mmaipsl, 14 years ago

Suppress out_rsync anoying file if systemfunction is OK.
Correct some little bugs.
Add two DODS functions IGCM_Dods_Rm and IGCM_Dods_Cp on post-treatment systems.

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