source: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_obelix.ksh @ 559

Last change on this file since 559 was 463, checked in by mafoipsl, 13 years ago

Delete useless sleep.

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