source: tags/libIGCM_v1_7/libIGCM_sys/libIGCM_sys_cesium.ksh @ 302

Last change on this file since 302 was 288, checked in by mafoipsl, 14 years ago

Add SUBLIT_DIR in messgae snt at the end of each simulation. Complete messages in clean_month.

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