source: utils/CI/sette_ticket2304/all_functions.sh @ 12505

Last change on this file since 12505 was 12505, checked in by mathiot, 12 months ago

#2304 : fix issues related to MY_SRC synchronisation when files are removed

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 20.4 KB
Line 
1######################################################
2# Author : Simona Flavoni for NEMO
3# Contact : sflod@locean-ipsl.upmc.fr
4#
5# ----------------------------------------------------------------------
6# NEMO/SETTE , NEMO Consortium (2010)
7# Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
8# ----------------------------------------------------------------------
9#
10# Some scripts called by sette.sh
11# all_functions.sh   : all functions used by sette.sh 
12######################################################
13#set -x
14#set -o posix
15#set -u
16#set -e
17#+
18#
19# ================
20# all_functions.sh
21# ================
22#
23# ----------------------------------------------
24# Set of functions used by sette.sh (NEMO tests)
25# ----------------------------------------------
26#
27# SYNOPSIS
28# ========
29#
30# ::
31#
32#  $ ./set_namelist INPUT_NAMELIST VARIABLE VALUE
33#  $ post_test_tidyup
34#
35#
36# DESCRIPTION
37# ===========
38#
39# function superegrep
40#   input variable value
41#
42# function set_namelist
43#   input namelist_name variable value
44#   output namelist
45#
46# function post_test_tidyup
47#   creates nemo_validation tree, and save output & debug files
48#   this function creates tree of validation in NEMO_VALIDATION_DIR as follows :
49#
50# NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/REVISION_NUMBER(or DATE)/TEST_NAME
51#
52# NEMO_VALIDATION_DIR           : is choosen in param.cfg
53#
54# WCONFIG_NAME                  : set by makenemo at the moment of compilation
55#
56# WCOMPILER_NAME                : set by makenemo at the moment of compilation
57#
58# REVISION_NUMBER(or DATE)      : revision number by svn info, if problems with svn date is taken
59#
60# TEST_NAME                     : set in sette.sh for each configuration to be tested (directory TEST_NAME is created under ${NEW_CONF} directory )
61#
62# EXAMPLES
63# ========
64#
65# ::
66#
67#  $ ./set_namelist namelist          nn_itend        75
68#  $ ./set_namelist namelist_ice      cn_icerst_in  \"00101231_restart_ice\"
69#  $ post_test_tidyup
70#
71#
72# TODO
73# ====
74#
75# option debug
76#
77#
78# EVOLUTIONS
79# ==========
80#
81# $Id$
82#
83#   * creation
84#-
85# function to find namelists parameters
86supergrep () {
87            grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
88    }
89
90usage=" Usage : set_namelist input_namelist variable_name value"
91usage=" if value is a string ths is neede syntax : ./set_namelist namelist_name var_name \"new_value\" "
92
93# sync MYSRC files (input CFG and CFG_ST)
94sync_config() {
95   if [ ${SYNC_CONFIGS} == "yes" ]; then
96
97      echo "configuration $3/$2 will be synchronised with $3/$1"
98
99      lREF=$3/$1    # reference
100      lCFG=$3/$2    # target
101
102      # synchronise MY_SRC if $lCFG directory exist
103      if [ -d $lREF/MY_SRC ] && [ -d $lCFG ] ; then
104
105         if [ -d $lCFG/MY_SRC ] ; then
106
107            # Manage case number of file in MY_SRC changes
108            # find number of file only in $lCFG/MY_SRC
109            FCFG=`diff -r $lREF/MY_SRC $lCFG/MY_SRC | grep $lCFG/MY_SRC | awk '{print $4}'`
110
111            # if more than 0, trigger a cleaning as Makenemo do not properly manage this case.
112            if [ ! -z "$FCFG" ]; then
113               echo ''
114               echo "$lCFG contains a different file list than $lREF :"
115               diff -r $lREF/MY_SRC $lCFG/MY_SRC | grep $lCFG/MY_SRC | awk '{print $4}'
116               echo "Synchronisation is not enough because Makenemo does not handle well case where a file in MY_SRC is removed"
117               echo "Therefore, we need to clean $lCFG before starting runing it"
118               echo ''
119               CLEAN_CONFIGS="yes"
120            fi
121         fi
122
123         # synchronisation $lREF/MY_SRC directory (and delete file in target location if needed)
124         rsync -av --delete $lREF/MY_SRC/ $lCFG/MY_SRC
125      fi
126
127      # synchronize EXPREF
128      if [ -d $lREF/EXPREF ] && [ -d $lCFG/EXP00 ] ; then
129         rsync $lREF/EXPREF/*namelist*_cfg  $lCFG/EXP00/.
130         rsync $lREF/EXPREF/iodef.xml       $lCFG/EXP00/.
131         rsync $lREF/EXPREF/*context_*.xml  $lCFG/EXP00/.
132         rsync $lREF/EXPREF/file_def_*.xml  $lCFG/EXP00/.
133      fi
134
135   fi
136}
137
138# clean _ST config (input CFG CFG_ST TYPE (test or ref))
139clean_config() {
140   if [ ${CLEAN_CONFIGS} == "yes" ]; then
141      lREF=$1
142      lCFG=$2
143      lTYP=$3
144      if [ ${lTYP} == 'tests' ]; then
145         ./makenemo -n $lCFG -a $lREF clean
146      elif [ ${lTYP} == 'cfgs' ]; then
147         ./makenemo -n $lCFG -r $lREF clean
148      else
149         echo 'ERROR in the cleaning process'; exit 42
150      fi
151      echo ''
152      echo "$lCFG configuration has been cleaned"
153      echo ''
154   fi
155}
156
157# define validation dir
158set_valid_dir () {
159    LANG=en_US
160    REVISION_NB=`LC_MESSAGES=${LANG} ${SVN_CMD} info ${SETTE_DIR}/.. | grep "Last Changed Rev" | awk '{print $NF}'`
161    if [ ${#REVISION_NB} -eq 0 ]
162    then
163        echo "some problems with ${SVN_CMD} info command"
164        echo "some problems with ${SVN_CMD} info command" >> ${SETTE_DIR}/output.sette
165        REVISION_NB=`date +%Y%m%d`
166        echo "put in ${REVISION_NB} date"
167        echo "put in ${REVISION_NB} date" >> ${SETTE_DIR}/output.sette
168    else
169    echo "value of revision number of NEMOGCM: ${REVISION_NB}"
170    fi
171    [ `${SVN_CMD} status -q ${SETTE_DIR}/../{cfg,tests,src} | wc -l` -ge 1 ] && REVISION_NB=${REVISION_NB}+
172    NEMO_VALID=${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}
173}
174
175# clean valid dir (move old ocean_output/run.stat and tracer to avoid checking them in case something wrong happen.
176clean_valid_dir () {
177#   set_valid_dir # already done in sette_ref/sette_test
178   echo "validation directory is : $NEMO_VALID"
179   if [ -d $NEMO_VALID ] ; then
180      [ -f ${NEMO_VALID}/ocean.output ] && mv ${NEMO_VALID}/ocean.output ${NEMO_VALID}/ocean.output_old
181      [ -f ${NEMO_VALID}/run.stat ]     && mv ${NEMO_VALID}/run.stat     ${NEMO_VALID}/run.stat_old
182      [ -f ${NEMO_VALID}/tracer.stat ]  && mv ${NEMO_VALID}/tracer.stat  ${NEMO_VALID}/tracer.stat_old
183   fi
184}
185
186# function to set namelists parameters
187set_namelist () {
188   minargcount=3
189   if [ ${#} -lt ${minargcount} ]
190   then
191      echo "not enough arguments for set_namelist"
192      echo "${usage}"
193      exit 1
194   fi
195   unset minargcount
196   if [  ! -f ${SETTE_DIR}/output.sette ] ; then
197                touch ${SETTE_DIR}/output.sette
198        fi
199
200        echo "executing script : set_namelist $@" >> ${SETTE_DIR}/output.sette
201        echo "################" >> ${SETTE_DIR}/output.sette
202     
203   VAR_NAME=$( supergrep $2 ${EXE_DIR}/$1 )
204   if [ ${#VAR_NAME} -eq 0 ] 
205   then
206      echo "doing \"set_namelist $@\". "  >> ${SETTE_DIR}/output.sette
207      echo "variable: \"$2\" not found in \"${EXE_DIR}/$1\" "  >> ${SETTE_DIR}/output.sette
208                NAMREF=$( basename $1 _cfg )_ref
209      echo "doing more : search in ${EXE_DIR}/$NAMREF " >> ${SETTE_DIR}/output.sette
210                VAR_NAME=$( supergrep $2 ${EXE_DIR}/$NAMREF )
211           if [ ${#VAR_NAME} -eq 0 ] 
212           then
213                    echo " variable $VAR_NAME not found in ${EXE_DIR}/$1 nor in ${EXE_DIR}/$NAMREF "
214                    echo " check your variable name "
215            echo "exit"
216            echo "error in executing script : set_namelist $@" >> ${SETTE_DIR}/output.sette
217            echo "....." >> ${SETTE_DIR}/output.sette
218            exit 1
219                fi
220                LINEVAR=$( grep -s -n "$VAR_NAME" ${EXE_DIR}/$NAMREF | awk -F: '{ { print $1} }' )
221                echo " $VAR_NAME found in ${EXE_DIR}/$NAMREF at line $LINEVAR " >> ${SETTE_DIR}/output.sette
222
223#   search for namelist group name
224                NAMGRP=$( head -n$LINEVAR ${EXE_DIR}/$NAMREF | grep --line-buffered "^&nam" | tail -1 | awk -F" " '{ { print $1} }' ) 
225                echo " variable $VAR_NAME will be added in $NAMGRP namelist-group of namelist file ${EXE_DIR}/$1 " >> ${SETTE_DIR}/output.sette
226
227# check if namelist group present in namelist_cfg
228# if missing group is added at the end of namelist_cfg
229                NGRP=$(grep ${NAMGRP} ${EXE_DIR}/$1 | wc -l )
230                if [ ${NGRP} -eq 0 ]; then
231                   echo ''                                                                          >> ${SETTE_DIR}/output.sette
232                   echo "+++++ Group ${NAMGRP} containing ${2} is missing in ${EXE_DIR}/$1 +++++ "  >> ${SETTE_DIR}/output.sette
233                   echo "+++++ Group ${NAMGRP}                 is added   in ${EXE_DIR}/$1 +++++ "  >> ${SETTE_DIR}/output.sette
234                   echo ''                                                                          >> ${SETTE_DIR}/output.sette
235                   echo "&${NAMGRP}" >> ${EXE_DIR}/$1
236                   echo "/"          >> ${EXE_DIR}/$1
237                fi
238
239# Add $VARNAME in namelist file ${EXE_DIR}/$1 in namelist group $NAMGRP
240# on mac osx, replace sed --posix by gsed (available with mac port)
241                sed --posix "/${NAMGRP} /a\ ${VAR_NAME} " ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp || gsed --posix "/${NAMGRP} /a\ ${VAR_NAME} " ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
242
243# if file not empty replace ${EXE_DIR}/$1
244               if [ -s ${EXE_DIR}/$1.tmp ] ; then
245                   mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 
246                else
247                echo "file ${EXE_DIR}/$1.tmp is empty. sed command went wrong "; exit 200
248                fi
249   fi
250
251        ARGS_LST="${@:3}"
252        sed -e "s;${VAR_NAME}.*;${VAR_NAME};" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
253        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
254        sed -e "s;${VAR_NAME};$2=${ARGS_LST};"  ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
255        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
256
257        echo "finished script : set_namelist $@" >> ${SETTE_DIR}/output.sette
258        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
259        echo "                " >> ${SETTE_DIR}/output.sette
260}
261
262
263# function to tidy up after each test and populate the NEMO_VALIDATION store
264post_test_tidyup () {
265# Save current exit status of caller script
266    RUN_STATUS=$? 
267    echo "Exit status: ${RUN_STATUS}" 
268#
269# requires the following variables defined and exported from the calling script:
270#  SETTE_DIR
271#  INPUT_DIR
272#  EXE_DIR
273#  CONFIG_DIR
274#  NEMO_VALIDATION_DIR
275#  NEW_CONF
276#  CMP_NAM
277#  TEST_NAME
278echo "SETTE directory is : ${SETTE_DIR}"
279echo "INPUT directory is : ${INPUT_DIR}"
280echo "EXECUTION directory is : ${EXE_DIR}"
281echo "CONFIG directory is : ${CONFIG_DIR}"
282echo "VALIDATION directory is : ${NEMO_VALID}"
283echo "NEW CONFIGURATION is : ${NEW_CONF}"
284echo "COMPILER is : ${CMP_NAM}"
285echo "TEST is : ${TEST_NAME}"
286echo "TOOLS directory is : ${TOOLS_DIR}"
287################################################################
288# SMALL DEBUG
289    EXIT_STATUS=${RUN_STATUS}
290    if [ ! -r ${EXE_DIR}/ocean.output ]
291        then
292        grep "E R R O R" ${EXE_DIR}/ocean.output && echo "Some ERRORS at execution time, see ${EXE_DIR}/ocean.output"
293        EXIT_STATUS=2
294        # exit 2 Error now catch in the report
295    fi
296
297    if [ ! -r ${EXE_DIR}/time.step ]
298        then
299        echo "file time.step does not exist"   >> ${SETTE_DIR}/output.sette
300        echo "some problems during execution of model"  >> ${SETTE_DIR}/output.sette
301        EXIT_STATUS=1
302        # exit 1 Error now catch in the report
303    else
304        echo "file time.step exists"  >> ${SETTE_DIR}/output.sette
305        echo "execution of model time step loop started"   >> ${SETTE_DIR}/output.sette
306    fi
307
308################################################################
309
310################################################################
311#
312# Creation of NEMO_VALIDATION tree
313#    set_valid_dir already done in sette_reference_config
314    mkdir -p ${NEMO_VALIDATION_DIR}
315    if [ -d ${NEMO_VALIDATION_DIR} ] ; then
316   echo "created ${NEMO_VALIDATION_DIR} directory"   >> ${SETTE_DIR}/output.sette
317    else
318   echo "problems in creating ${NEMO_VALIDATION_DIR} directory"   >> ${SETTE_DIR}/output.sette
319   echo "EXIT,"
320   exit 1
321    fi
322#
323# Exit before populating validation directory if the model run has
324# returned a non-zero exit status
325# On CRAY NEMO exit is not the expected 999 or 123456 (let this bloc in case useful later on).
326#    case ${EXIT_STATUS} in
327#        0|123456|999) echo " NEMO finished with exit code $EXIT_STATUS " ; post_test_tidyup ;;
328#        *) echo " NEMO abort on an unexpected error (segmentation fault or whatever) $EXIT_STATUS "
329#    esac
330
331    [ ${EXIT_STATUS} -ne 0 ] && exit ${EXIT_STATUS} 
332#
333# Save output & debug files in NEMO_VALIDATION tree
334    echo "saving ocean & ice output, run.stat, tracer.stat files ...." >> ${SETTE_DIR}/output.sette
335    echo "            " >> ${SETTE_DIR}/output.sette
336    [ -f ${EXE_DIR}/ocean.output ] && cp ${EXE_DIR}/*ocean.output ${NEMO_VALIDATION_DIR}/.
337    [ -f ${EXE_DIR}/run.stat ] && cp ${EXE_DIR}/*run.stat ${NEMO_VALIDATION_DIR}/.
338    [ -f ${EXE_DIR}/output.namelist.dyn ] && cp ${EXE_DIR}/*output.nam* ${NEMO_VALIDATION_DIR}/.
339    [ -f ${EXE_DIR}/tracer.stat ] && cp ${EXE_DIR}/*tracer.stat ${NEMO_VALIDATION_DIR}/.
340
341    if [ -n "$(ls ${NEMO_VALIDATION_DIR}/*run*)" ] ; then
342   echo "moved run.stat in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
343   echo "moved run.stat in ${NEMO_VALIDATION_DIR} directory" 
344    else
345   echo "problem in looking for run.stat file in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
346   echo "run.stat IS NOT in ${NEMO_VALIDATION_DIR} directory" 
347    fi
348    if [ -n "$(ls ${NEMO_VALIDATION_DIR}/*ocean.output*)" ] ; then
349   echo "moved ocean.output in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
350   echo "moved ocean.output in ${NEMO_VALIDATION_DIR} directory" 
351    else
352   echo "problem in looking for ocean.output file in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
353   echo "ocean.output IS NOT in ${NEMO_VALIDATION_DIR} directory" 
354    fi
355    if [ -n "$(ls ${NEMO_VALIDATION_DIR}/*tracer.stat*)" ] ; then
356        echo "moved tracer.stat in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
357        echo "moved tracer.stat in ${NEMO_VALIDATION_DIR} directory"
358    else
359        echo "problem in looking for tracer.stat file in ${NEMO_VALIDATION_DIR} directory"  >> ${SETTE_DIR}/output.sette
360        echo "tracer.stat IS NOT in ${NEMO_VALIDATION_DIR} directory"
361    fi
362}
363
364#############################################################
365# extra functions to manipulate settings in the iodef.xml file
366#
367# Examples:
368#   set_xio_file_type    iodef.xml one_file
369#   set_xio_using_server iodef.xml true
370#   set_xio_buffer_size  iodef.xml 50000000
371#   set_xio_field_defs   iodef.xml
372#
373#############################################################
374
375usage2=" Usage : set_xio_file_type input_iodef.xml one_file||multiple_file"
376usage3=" Usage : set_xio_using_server input_iodef.xml true||false"
377usage4=" Usage : set_xio_buffer_size input_iodef.xml int_buffer_size"
378usage5=" Usage : set_xio_field_defs input_iodef.xml"
379
380set_xio_file_type () {
381        minargcount=2
382        if [ ${#} -lt ${minargcount} ]
383        then
384                echo "not enough arguments for set_xio_file_type"
385                echo "${usage2}"
386                exit 1
387        fi
388        if [ $2 != "one_file" ] && [ $2 != "multiple_file" ]
389        then
390                echo "unrecognised argument for set_xio_file_type"
391                echo "${usage2}"
392                echo $2
393                exit 1
394        fi
395        unset minargcount
396        if [  ! -f ${SETTE_DIR}/output.sette ] ; then
397                touch ${SETTE_DIR}/output.sette
398        fi
399
400        echo "executing script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette
401        echo "################" >> ${SETTE_DIR}/output.sette
402
403        VAR_NAME=$( grep "^.*<.*file_definition.*type.*=" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" )
404        if [ ${#VAR_NAME} -eq 0 ]
405        then
406                echo "doing \"set_xio_file_type $@\". "
407                echo "xml_tag: file_definition with variable: type is empty"
408                echo "confirm that an appropriate file_definition is in \"${EXE_DIR}/$1\" "
409                echo "exit"
410                echo "error in executing script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette
411                echo "....." >> ${SETTE_DIR}/output.sette
412                exit 1
413        fi
414        if [ $2 == "one_file" ] 
415        then
416           sed -e "s:multiple_file:one_file:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
417        else
418           sed -e "s:one_file:multiple_file:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
419        fi
420        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
421
422        echo "finished script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette
423        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
424        echo "                " >> ${SETTE_DIR}/output.sette
425}
426
427set_xio_using_server () {
428        minargcount=2
429        if [ ${#} -lt ${minargcount} ]
430        then
431                echo "not enough arguments for set_xio_using_server"
432                echo "${usage2}"
433                exit 1
434        fi
435        if [ $2 != "true" ] && [ $2 != "false" ]
436        then
437                echo "unrecognised argument for set_xio_using_server"
438                echo "${usage2}"
439                echo $2
440                exit 1
441        fi
442        unset minargcount
443        if [  ! -f ${SETTE_DIR}/output.sette ] ; then
444                touch ${SETTE_DIR}/output.sette
445        fi
446
447        echo "executing script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette
448        echo "################" >> ${SETTE_DIR}/output.sette
449
450        VAR_NAME=$( grep "^.*<.*variable id.*=.*using_server.*=.*bool" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" )
451        if [ ${#VAR_NAME} -eq 0 ]
452        then
453                echo "doing \"set_xio_using_server $@\". "
454                echo "xml_tag: "variable id=using_server" with variable: bool is empty"
455                echo "confirm that an appropriate variable id is in \"${EXE_DIR}/$1\" "
456                echo "exit"
457                echo "error in executing script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette
458                echo "....." >> ${SETTE_DIR}/output.sette
459                exit 1
460        fi
461        if [ $2 == "false" ]
462        then
463           sed -e "/using_server/s:true:false:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
464           export USING_MPMD=no
465        else
466           sed -e "/using_server/s:false:true:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
467           export USING_MPMD=yes
468        fi
469        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
470
471        echo "finished script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette
472        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
473        echo "                " >> ${SETTE_DIR}/output.sette
474}
475
476set_xio_buffer_size () {
477        minargcount=2
478        if [ ${#} -lt ${minargcount} ]
479        then
480                echo "not enough arguments for set_xio_buffer_size"
481                echo "${usage4}"
482                exit 1
483        fi
484        unset minargcount
485        if [  ! -f ${SETTE_DIR}/output.sette ] ; then
486                touch ${SETTE_DIR}/output.sette
487        fi
488
489        echo "executing script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette
490        echo "################" >> ${SETTE_DIR}/output.sette
491
492        VAR_NAME=$( grep "^.*<.*variable id.*=.*buffer_size.*=.*integer" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" )
493        if [ ${#VAR_NAME} -eq 0 ]
494        then
495                echo "doing \"set_xio_buffer_size $@\". "
496                echo "xml_tag: "variable id=buffer_size" with variable: integer is empty"
497                echo "confirm that an appropriate variable id is in \"${EXE_DIR}/$1\" "
498                echo "exit"
499                echo "error in executing script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette
500                echo "....." >> ${SETTE_DIR}/output.sette
501                exit 1
502        fi
503        sed -e "/buffer_size/s:>.*<:>$2<:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp
504        mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1
505
506        echo "finished script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette
507        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
508        echo "                " >> ${SETTE_DIR}/output.sette
509}
510
511set_xio_field_defs () {
512        minargcount=1
513        if [ ${#} -lt ${minargcount} ]
514        then
515                echo "not enough arguments for set_xio_field_defs"
516                echo "${usage5}"
517                exit 1
518        fi
519        unset minargcount
520        if [  ! -f ${SETTE_DIR}/output.sette ] ; then
521                touch ${SETTE_DIR}/output.sette
522        fi
523
524        echo "executing script : set_xio_field_defs $@" >> ${SETTE_DIR}/output.sette
525        echo "################" >> ${SETTE_DIR}/output.sette
526
527
528        [ -f ${EXE_DIR}/field_def_nemo-oce.xml ] || sed -i '/field_def_nemo-oce/d' $1
529        [ -f ${EXE_DIR}/field_def_nemo-ice.xml ] || sed -i '/field_def_nemo-ice/d' $1
530        [ -f ${EXE_DIR}/field_def_nemo-pisces.xml ] || sed -i '/field_def_nemo-pisces/d' $1
531
532        echo "finished script : set_xio_field_defs $@" >> ${SETTE_DIR}/output.sette
533        echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette
534        echo "                " >> ${SETTE_DIR}/output.sette
535}
Note: See TracBrowser for help on using the repository browser.