#______________________________________________________________________________ # NAME : foreign_afos # Author : Peter Henrichsen # Purpose : This script runs two scripts: # 1. The "afstoawp.sh" script runs program afstoawp # to convert the AFOS map into AWIPS Redbook a # formatted map. # This AWIPS map is then sent using snd2forgn. # 2. Then "foreign_fillafos.sh" script runs program fillafos # to reblock the afos product into 1280 byte records. # This reblocked afos map is then sent using snd2forgn. # # History : 1999-06-30 Peter Henrichsen # : 1999-08-18 Peter Henrichsen modified to skip conversion # of selected afos products to awips Redbook format. # Also modified to send awips Redbook graphics that were # created on a foreign system. # : 1999-12-20 Peter Henrichsen modified to use USHutil. # : 2000-03-14 Peter Henrichsen modified for running by dbnet. # # # Location : This script is found on hp36 as: # : /tmp_mnt/export/sgi73/peterhen/util/ush/ibm/ # foreign_afos # : & on ncosp as # : /nwprod/util/ush/foreign_afos or # : /nfsuser/g02/wx12ph/util/ush/foreign_afos # # Usage : This script is remotely started by dbnet via a foreign alert # from das1. The foreign alert is ftp'd into das1 from various # foreign workstations. Dbnet then starts fnafos which runs # foreign_afos to convert AFOS utf graphs files into AWIPS graphics # format for sending to the world. # #_______________________________________________________________________________ USAGE="usage: $MEMBER" export vertime="2000-03-14 1125L" VERS="version:$USHutil/$MEMBER $vertime " # print "$USAGE" print "$VERS" cd $DATA set -x integer istat integer kstat export filename=`basename ${INFILE}` export afosfile=`echo ${filename} | awk 'BEGIN{FS="."} {print $1}'` msg="$MEMBER HAS STARTED!" postmsg "$jlogfile" "$msg" kinpil=${NAME} if test "${kinpil}" = '64e' then PIL='54e' else PIL=$kinpil fi # # convert PIL to "caps". # PILNUM=`echo $PIL | tr '[a-z]' '[A-Z]' ` export time=`date +"%d%H%M%S` cp $INFILE $DATA/$afosfile cp $INFILE $DATA/$filename.$time istat=0 # START of logic to check if this is an AWIPS Reedbook product! #--------------------------------------------------------------- # get title of product amsg1=`egrep ${PILNUM} $FIXutil/forgnpil.dat \ | cut -f2 -d","` export amsg1 NUM=${#filename} # get the number of sub types in filename! export numprt=`echo $filename | awk -F_ '{print NF}'` if [ $numprt -gt 1 ] then WASAWIP=NO # remove the under score separators from $filename. group=`echo $filename \ | awk -F_ '{for(i=1;i<=NF;i++) \ {if(i$DATA/${PILNUM}.card istat=$? if test "$istat" = 0 then # get WMO name of the product. export wmonam=`awk '{print $7}' <$DATA/${PILNUM}.card` export AWIPOUT=$awipfile.$wmonam.$USR # convert to lower case export awipout=`echo $AWIPOUT | tr '[A-Z]' '[a-z]' ` export TYPE=`awk '{print $8}' <$DATA/${PILNUM}.card` # this is an awips file send it and exit mkdir -m 775 -p $pcom/awips >/dev/null 2>&1 cp $DATA/$awipfile $pcom/awips/$awipout #______________________________________________________________ # start the procedure to post the awips product. #______________________________________________________________ export MODEL=$model $USHutil/snd2forgn $TYPE $MODEL $job $pcom/awips/$awipout err=$? msg="Awipsmap, $wmonam ${amsg1}, WAS POSTED!" postmsg "$jlogfile" "$msg" fi else #--------------------------------------------------------------- # END of logic to check if this is an AWIPS Reedbook product! KEY=AFOS MODEL=man$PIL CONCARD=card$PIL # export CONCARD time PIL PILNUM KEY # get description of this afos product for the jlogfile. export amsg1=`egrep ${PILNUM} $FIXutil/forgnpil.dat \ | cut -f2 -d","` #____________________________________________________________________ # # check to see if this afos pil is to be converted to awips? # #____________________________________________________________________ # grep -c $PILNUM $FIXutil/afostitles.cntl istat=$? if test "$istat" = 0 then # get the control card for program "afstoawp" to see if we are to # really to convert this product to awips! egrep -h ^$PILNUM $FIXutil/afstoawp.controls >$DATA/${PILNUM}.card # get confalg for this afos product. conflag=`awk '{print $10}' <$DATA/${PILNUM}.card` if test "$conflag" = 'YES' then set +x echo " " echo "######################################" echo " CONVERT AFOS MAP ${PIL} INTO AWIPS" echo "######################################" echo " " set -x awiprc=1 echo $awiprc > $DATA/$jobid.awiprc msg="Convert $PILNUM $amsg1 to AWIPS!" postmsg "$jlogfile" "$msg" # Now start the script to convert this AFOS product into AWIPS Redbook # format export member=afstoawp.sh $USHutil/$member $DATA/$filename.$time "${PIL}" read awiprc < $DATA/$jobid.awiprc if test $awiprc -eq '0' then msg="$PILNUM Converted to AWIPS!" else msg="ERROR $PILNUM NOT Converted to AWIPS!" postmsg "$jlogfile" "$msg" fi else msg="SKIPPING conversion of $PILNUM to AWIPS!" postmsg "$jlogfile" "$msg" fi else msg="Will NOT Convert $PILNUM to AWIPS!" postmsg "$jlogfile" "$msg" fi # Now the AFOS product must be reblock! set +x echo " " echo "######################################" echo " REBLOCK THE AFOS MAP ${PIL}" echo "######################################" echo " " set -x export member=foreign_fillafos.sh $USHutil/$member $DATA/$afosfile fi msg="$MEMBER HAS COMPLETED NORMALLY!" postmsg "$jlogfile" "$msg" # CLEAN UP UN-NEED FILES and move output into comout! outcom=$comout/foreign.$PDY chmod 775 $DATA/$pgmout mkdir -m 775 -p $outcom >/dev/null 2>&1 cp $DATA/$pgmout $outcom/${job}.${PIL}.$pid chmod 775 $outcom/${job}.${PIL}.$pid #cd #rm -rf $DATA