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

Last change on this file since 359 was 359, checked in by sdipsl, 14 years ago

mistake in a test

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