- Timestamp:
- 2013-11-18T13:14:32+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2013/dev_MERCATOR_UKMO_2013/NEMOGCM/SETTE/all_functions.sh
r3294 r4233 96 96 if [ ${#} -lt ${minargcount} ] 97 97 then 98 echo "not enough targuments for set_namelist"98 echo "not enough arguments for set_namelist" 99 99 echo "${usage}" 100 100 exit 1 … … 113 113 echo "doing \"set_namelist $@\". " 114 114 echo "variable: \"$2\" is empty" 115 echo "con trolthat variable $2 is in \"${EXE_DIR}/$1\" "115 echo "confirm that variable $2 is in \"${EXE_DIR}/$1\" " 116 116 echo "exit" 117 117 echo "error in executing script : set_namelist $@" >> ${SETTE_DIR}/output.sette … … 128 128 echo " " >> ${SETTE_DIR}/output.sette 129 129 } 130 130 131 131 132 # function to tidy up after each test and populate the NEMO_VALIDATION store … … 216 217 fi 217 218 } 219 220 ############################################################# 221 # extra functions to manipulate settings in the iodef.xml file 222 # 223 # Examples: 224 # set_xio_file_type iodef.xml one_file 225 # set_xio_using_server iodef.xml true 226 # set_xio_buffer_size iodef.xml 50000000 227 # 228 ############################################################# 229 230 usage2=" Usage : set_xio_file_type input_iodef.xml one_file||multiple_file" 231 usage3=" Usage : set_xio_using_server input_iodef.xml true||false" 232 usage4=" Usage : set_xio_buffer_size input_iodef.xml int_buffer_size" 233 234 set_xio_file_type () { 235 minargcount=2 236 if [ ${#} -lt ${minargcount} ] 237 then 238 echo "not enough arguments for set_xio_file_type" 239 echo "${usage2}" 240 exit 1 241 fi 242 if [ $2 != "one_file" ] && [ $2 != "multiple_file" ] 243 then 244 echo "unrecognised argument for set_xio_file_type" 245 echo "${usage2}" 246 echo $2 247 exit 1 248 fi 249 unset minargcount 250 if [ ! -f ${SETTE_DIR}/output.sette ] ; then 251 touch ${SETTE_DIR}/output.sette 252 fi 253 254 echo "executing script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette 255 echo "################" >> ${SETTE_DIR}/output.sette 256 257 VAR_NAME=$( grep "^.*<.*file_definition.*type.*=" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" ) 258 if [ ${#VAR_NAME} -eq 0 ] 259 then 260 echo "doing \"set_xio_file_type $@\". " 261 echo "xml_tag: file_definition with variable: type is empty" 262 echo "confirm that an appropriate file_definition is in \"${EXE_DIR}/$1\" " 263 echo "exit" 264 echo "error in executing script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette 265 echo "....." >> ${SETTE_DIR}/output.sette 266 exit 1 267 fi 268 if [ $2 == "one_file" ] 269 then 270 sed -e "s:multiple_file:one_file:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 271 else 272 sed -e "s:one_file:multiple_file:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 273 fi 274 mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 275 276 echo "finished script : set_xio_file_type $@" >> ${SETTE_DIR}/output.sette 277 echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette 278 echo " " >> ${SETTE_DIR}/output.sette 279 } 280 281 set_xio_using_server () { 282 minargcount=2 283 if [ ${#} -lt ${minargcount} ] 284 then 285 echo "not enough arguments for set_xio_using_server" 286 echo "${usage2}" 287 exit 1 288 fi 289 if [ $2 != "true" ] && [ $2 != "false" ] 290 then 291 echo "unrecognised argument for set_xio_using_server" 292 echo "${usage2}" 293 echo $2 294 exit 1 295 fi 296 unset minargcount 297 if [ ! -f ${SETTE_DIR}/output.sette ] ; then 298 touch ${SETTE_DIR}/output.sette 299 fi 300 301 echo "executing script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette 302 echo "################" >> ${SETTE_DIR}/output.sette 303 304 VAR_NAME=$( grep "^.*<.*variable id.*=.*using_server.*=.*boolean" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" ) 305 if [ ${#VAR_NAME} -eq 0 ] 306 then 307 echo "doing \"set_xio_using_server $@\". " 308 echo "xml_tag: "variable id=using_server" with variable: boolean is empty" 309 echo "confirm that an appropriate variable id is in \"${EXE_DIR}/$1\" " 310 echo "exit" 311 echo "error in executing script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette 312 echo "....." >> ${SETTE_DIR}/output.sette 313 exit 1 314 fi 315 if [ $2 == "false" ] 316 then 317 sed -e "/using_server/s:true:false:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 318 export USING_MPMD=no 319 else 320 sed -e "/using_server/s:false:true:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 321 export USING_MPMD=yes 322 fi 323 mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 324 325 echo "finished script : set_xio_using_server $@" >> ${SETTE_DIR}/output.sette 326 echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette 327 echo " " >> ${SETTE_DIR}/output.sette 328 } 329 330 set_xio_buffer_size () { 331 minargcount=2 332 if [ ${#} -lt ${minargcount} ] 333 then 334 echo "not enough arguments for set_xio_buffer_size" 335 echo "${usage4}" 336 exit 1 337 fi 338 unset minargcount 339 if [ ! -f ${SETTE_DIR}/output.sette ] ; then 340 touch ${SETTE_DIR}/output.sette 341 fi 342 343 echo "executing script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette 344 echo "################" >> ${SETTE_DIR}/output.sette 345 346 VAR_NAME=$( grep "^.*<.*variable id.*=.*buffer_size.*=.*integer" ${EXE_DIR}/$1 | sed -e "s% *\!.*%%" ) 347 if [ ${#VAR_NAME} -eq 0 ] 348 then 349 echo "doing \"set_xio_buffer_size $@\". " 350 echo "xml_tag: "variable id=buffer_size" with variable: integer is empty" 351 echo "confirm that an appropriate variable id is in \"${EXE_DIR}/$1\" " 352 echo "exit" 353 echo "error in executing script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette 354 echo "....." >> ${SETTE_DIR}/output.sette 355 exit 1 356 fi 357 sed -e "/buffer_size/s:>.*<:>$2<:" ${EXE_DIR}/$1 > ${EXE_DIR}/$1.tmp 358 mv ${EXE_DIR}/$1.tmp ${EXE_DIR}/$1 359 360 echo "finished script : set_xio_buffer_size $@" >> ${SETTE_DIR}/output.sette 361 echo "++++++++++++++++" >> ${SETTE_DIR}/output.sette 362 echo " " >> ${SETTE_DIR}/output.sette 363 } 364
Note: See TracChangeset
for help on using the changeset viewer.