#!/bin/bash # --------------------------------------------------------------------------- # # ad3_test : test version of ad3 generating maximum test output for w3adc # # and skipping compile. # # # # Hendrik L. Tolman # # May 2009 # # January 2014 # # # # Copyright 2009-2014 National Weather Service (NWS), # # National Oceanic and Atmospheric Administration. All rights # # reserved. WAVEWATCH III is a trademark of the NWS. # # No unauthorized use without permission. # # # # --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- # # 1. Preparations # # --------------------------------------------------------------------------- # # 1.a Check and process input if [ "$#" -gt '3' ] || [ "$#" -lt 1 ] then echo "usage: ad3_test basename [itest [icomp]]" 1>&2 ; exit 1 fi name=$1 if test "$#" -ge '2' then itst=$2 else itst='0' fi # 1.b Internal variables - - - - - - - - - - - - - - - - - - - - - - - - - - - switch="switch" # file containing switches compress=0 # source code compression par in w3adc # if not 0, documentaion removed from .f90 file # 1.c Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv main_dir=$WWATCH3_DIR temp_dir=$WWATCH3_TMP source=$WWATCH3_SOURCE list=$WWATCH3_LIST # 1.d Set up paths etc. - - - - - - - - - - - - - - - - - - - - - - - - - - - path_b="$main_dir/bin" path_w="$temp_dir" path_i="$main_dir/ftn" path_o="$main_dir/obj" path_m="$main_dir/mod" path_e="$main_dir/exe" if [ -n "`echo $name | grep scrip_ 2>/dev/null`" ] then path_i="$path_i/SCRIP" fi if [ ${name:0:3} = 'yow' ] then path_i="$path_i/PDLIB" fi sw_str=`cat $path_b/$switch` if [ ! -d $path_w ] then if ! `mkdir $path_w` then echo ' *** w3adc error ***' echo " Cannot create $path_w" exit 3 fi fi # 1.e Test necessity of running w3adc - - - - - - - - - - - - - - - - - - - - if [ -f $path_i/$name.ftn ] then w3adc='yes' idstr= else w3adc='no' idstr='[no w3adc]' fi # 1.f Output - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo "ad3 : processing $name $idstr" if [ "$itst" != '0' ] then echo ' ' ; echo 'Test output ad3 ' ; echo '----------------' echo " bin directory : $path_b " echo " work directory : $path_w " echo " input directory : $path_i " echo " object directory : $path_o " echo " module directory : $path_m " echo " executable dir. : $path_e " echo " switches file : $switch " ; echo ' ' echo " switches : $sw_str" echo ' ' fi # 1.g Final preparations - - - - - - - - - - - - - - - - - - - - - - - - - - - cd $path_w # --------------------------------------------------------------------------- # # 2. Run w3adc # # --------------------------------------------------------------------------- # # 2.a Make input file if [ "$w3adc" = 'yes' ] then echo "1 $compress" > w3adc.inp.$name echo "'$path_i/$name.ftn' '$name.f90'" >> w3adc.inp.$name echo "'$sw_str'" >> w3adc.inp.$name # 2.b Add NCEP/NCO docmentation - - - - - - - - - - - - - - - - - - - - - - - # Obsolete feature, removed # 2.c Run w3adc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$itst" != '0' ] then echo '-- input file w3adc.inp -------------------------------------------' cat w3adc.inp.$name echo '-- end of file ----------------------------------------------------' fi $path_b/w3adc < w3adc.inp.$name fi rm -f w3adc.inp.$name rm -f $name.f90 # End of ad3 ---------------------------------------------------------------- #