#!/bin/sh # set -x ################################################################### # READ IN DATA FROM targdata.d ################################################################### GESdir=${GESdir:-/nwges/wsr} #### Read in targdata.d header (first 9 lines) #### PDY=`head -1 $GESdir/targdata.d` cases=`head -2 $GESdir/targdata.d | tail -1` resolution=`head -3 $GESdir/targdata.d | tail -1` vnorm=`head -4 $GESdir/targdata.d | tail -1` radvr=`head -5 $GESdir/targdata.d | tail -1` lon1=`head -6 $GESdir/targdata.d | tail -1` lon2=`head -7 $GESdir/targdata.d | tail -1` lat1=`head -8 $GESdir/targdata.d | tail -1` lat2=`head -9 $GESdir/targdata.d | tail -1` #### Read in targdata.d body (remaining lines) #### #### Assumes 6 lines per case #### i=1 while [ $i -le $cases ] do line=`expr ${i} \* 6 + 4` obsdate[i]=`head -n $line $GESdir/targdata.d | tail -1` line=`expr $line + 1` veridate[i]=`head -n $line $GESdir/targdata.d | tail -1` line=`expr $line + 1` vrlon[i]=`head -n $line $GESdir/targdata.d | tail -1` line=`expr $line + 1` vrlat[i]=`head -n $line $GESdir/targdata.d | tail -1` line=`expr $line + 1` priority[i]=`head -n $line $GESdir/targdata.d | tail -1` line=`expr $line + 1` comments[i]=`head -n $line $GESdir/targdata.d | tail -1` i=`expr ${i} + 1` done i=1 while [ $i -le $cases ] do case ${priority[$i]} in 1) prioritytxt[$i]=HIGH;; 2) prioritytxt[$i]=MEDIUM;; 3) prioritytxt[$i]=LOW;; esac i=`expr ${i} + 1` done curyy=`date -u +%Y` curmm=`date -u +%m` curdd=`date -u +%d` curhh=`date -u +%H` PDY=${curyy}${curmm}${curdd} text=${GESdir}/${PDY}decision.txt carcahtext=${GESdir}/${PDY}carcah_decision.txt verinfo=${GESdir}/verifcases${curyy}.d trackinfo=${GESdir}/veriftracks${curyy}.d rm -rf $text rm -rf $carcahtext flydate[1]=`/nwprod/util/exec/ndate +48 ${PDY}00` flydate[2]=`/nwprod/util/exec/ndate +72 ${PDY}00` echo "Decision issued from NCEP at ${curhh}Z on ${curmm}/${curdd}/${curyy}" >> $text echo >> $text echo "Decision issued from NCEP at ${curhh}Z on ${curmm}/${curdd}/${curyy}" >> $carcahtext echo >> $carcahtext clear echo "----------------------------------------------------------------" echo "| WINTER STORM RECONNAISSANCE PROGRAM DECISION SCRIPT |" echo "----------------------------------------------------------------" echo echo echo "DO YOU WANT TO MAKE A FLIGHT REQUEST FOR ${flydate[1]}? (y/n)" read dowefly echo if test "$dowefly" = 'y' || test "$dowefly" = 'Y' then newcasenum=`expr ${cases} + 1` echo "FLIGHT REQUEST FOR ${flydate[1]}" >> $text echo >> $text echo "FLIGHT REQUEST FOR ${flydate[1]}" >> $carcahtext echo >> $carcahtext echo "HOW MANY FLIGHTS ARE DESIRED?" read numflights echo if [ ${numflights} -gt 3 ] then echo "You must choose 1 to 3 flights" echo "Please try again" echo echo "HOW MANY FLIGHTS ARE DESIRED?" read numflights echo fi ct=1 while test ${ct} -le ${numflights} do mk0=0 while test ${mk0} -ne 1 do mk0=1 if [ ${numflights} -gt 1 ] then if [ ${ct} -eq 1 ] then echo "ENTER THE NUMBER OF THE FIRST DESIRED FLIGHT TRACK" else echo "ENTER THE NUMBER OF THE NEXT DESIRED FLIGHT TRACK" fi else echo "ENTER THE NUMBER OF THE DESIRED FLIGHT TRACK" fi read tracknum[$ct] echo if [[ ${tracknum[$ct]} -gt 56 || ${tracknum[$ct]} -lt 1 ]] then echo "Invalid track number; valid tracks are 1 to 26, 31 to 49 and 51 to 53" echo mk0=0 fi if [[ ${tracknum[$ct]} -eq 50 || ${tracknum[$ct]} -eq 30 ]] then echo "Invalid track number; valid tracks are 1 to 26, 31 to 49 and 51 to 53" echo mk0=0 fi done mk20=1 controldate[$ct]=`echo ${flydate[1]}|cut -c7-8` while test ${mk20} -eq 1 do echo " TO ACCEPT WSR DEFAULT CONTROL TIME (${controldate[$ct]}/00Z)," echo " OR PRESS c TO CHANGE THE CONTROL TIME" read ans echo if test "$ans" = "" then hr=`echo ${flydate[1]}|cut -c9-10` controltime[$ct]=${hr} mk20=2 else echo "ENTER THE TWO DIGIT DATE OF THE CONTROL TIME" read controldate[$ct] echo echo "ENTER THE TWO DIGIT HOUR OF THE CONTROL TIME" read controltime[$ct] echo echo "THE CONTROL TIME FOR TRACK ${tracknum[$ct]} IS ${controldate[$ct]}/${controltime[$ct]}Z" echo "DO YOU WISH TO MAKE ANY CHANGES TO THIS DATA? (y/n)" read controlans echo if test "$controlans" = 'n' || test "$controlans" = 'N' then mk20=2 else mk20=1 fi fi done answer=y mark=1 while test "$answer" = 'y' || test "$answer" = 'Y' do mk1=0 while test ${mk1} -ne 1 do mk1=1 newcasemark=0 index=`expr ${ct} \* 10 + ${mark}` #caseview2.2.sh echo "----------------------------------------------------------" i=1 while test ${i} -le ${cases} do echo "PLOT# ${i}" echo " Observation time: ${obsdate[$i]}" echo " Verification time: ${veridate[$i]}" echo " Latitude: ${vrlat[$i]}" echo " Longitude: ${vrlon[$i]}" echo " Priority: ${prioritytxt[$i]}" echo " Comments: ${comments[$i]}" i=`expr ${i} + 1` if [ ${i} -le ${cases} ] then echo fi done echo "----------------------------------------------------------" echo echo " WHAT IS THE PLOT NUMBER OF THE SITUATION FLIGHT ${tracknum[$ct]} WILL TARGET?" echo " (enter ${newcasenum} to input data for a new case)" read casenum[$index] echo if [ ${casenum[$index]} -eq ${newcasenum} ] then echo "-----------------------------------------------------------------" echo "FOR CASE ${newcasenum}:" echo echo "ENTER THE OBSERVATION TIME (yyyymmddhh)" read obsdate[$newcasenum] echo echo "ENTER THE VERIFICATION TIME (yyyymmddhh)" read veridate[$newcasenum] echo echo "ENTER THE LATITUDE OF THE CENTER OF THE VERIFICATION REGION" read vrlat[$newcasenum] echo echo "ENTER THE LONGITUDE OF THE CENTER OF THE VERIFICATION REGION" read vrlon[$newcasenum] echo echo "CHOOSE A PRIORITY" echo "1) HIGH PRIORITY" echo "2) MEDIUM PRIORITY" echo "3) LOW PRIORITY" read priority[$newcasenum] case ${priority[$newcasenum]} in 1) prioritytxt[$newcasenum]=HIGH;; 2) prioritytxt[$newcasenum]=MEDIUM;; 3) prioritytxt[$newcasenum]=LOW;; esac echo echo "PROVIDE COMMENTS OR PRESS ENTER" read comments[$newcasenum] echo "-----------------------------------------------------------------" echo newcasemark=1 else if [[ ${casenum[$index]} -lt 1 || ${casenum[$index]} -gt ${cases} ]] then if [ ${cases} -eq 1 ] then echo " Invalid entry; the only valid entry is 1." else echo " Invalid entry; valid entries are 1 through ${cases}" fi echo mk1=0 fi fi casenumber=${casenum[$index]} if [[ ${obsdate[$casenumber]} -ne ${flydate[1]} && ${mk1} -eq 1 ]] then echo " You must select a case with ${flydate[1]} as the observation time" echo " Please try again" echo mk1=0 fi done if [ ${newcasemark} -eq 1 ] then newcasenum=`expr ${newcasenum} + 1` fi echo " ARE THERE ANY OTHER SITUATIONS FLIGHT ${tracknum[$ct]} WILL TARGET? (y/n)" read answer echo if test "$answer" = 'n' || test "$answer" = 'N' then casecounter[$ct]=${mark} else mark=`expr ${mark} + 1` fi done ct=`expr ${ct} + 1` done echo "PROVIDE COMMENTS ABOUT THE FLIGHT(S) FOR CARCAH OR PRESS ENTER" read carcahcomments echo echo "IF DESIRED, PROVIDE ADDITIONAL COMMENTS ABOUT THE FLIGHT(S) OR PRESS ENTER" read morecomments echo mk2=0 while test ${mk2} -ne 1 do clear echo "---------------------------------------------------------------" echo "PLEASE VERIFY THE FOLLOWING INFORMATION" echo "---------------------------------------------------------------" echo "OBSERVING AT TIME: ${flydate[1]}" ct=1 option=1 while test ${ct} -le ${numflights} do echo "${option}) FLIGHT TRACK: ${tracknum[$ct]}" number=`expr 10 + ${ct}` optracker[$option]=${number} option=`expr ${option} + 1` mark=1 while test ${mark} -le ${casecounter[$ct]} do index=`expr ${ct} \* 10 + ${mark}` casenumber=${casenum[$index]} echo "${option}) CASE: ${casenumber}" echo " Verification time: ${veridate[$casenumber]}" echo " Latitude: ${vrlat[$casenumber]}N" echo " Longitude: ${vrlon[$casenumber]}W" echo " Priority: ${prioritytxt[$casenumber]}" echo " Comments: ${comments[$casenumber]}" number=`expr 10 + 10 \* ${ct} + ${mark}` optracker[$option]=$number option=`expr ${option} + 1` mark=`expr ${mark} + 1` done ct=`expr ${ct} + 1` done echo "${option}) CARCAH comments: ${carcahcomments}" optracker[$option]=2 option=`expr ${option} + 1` echo "${option}) Additional Comments: ${morecomments}" echo "---------------------------------------------------------------" echo optracker[$option]=1 echo "DO YOU WISH TO MAKE ANY CHANGES TO THIS DATA (y/n)?" read response echo if test "$response" = 'n' || test "$response" = 'N' then ct=1 echo ${flydate[1]} >> $trackinfo while test ${ct} -le ${numflights} do if [[ ${tracknum[$ct]} -ge 1 && ${tracknum[$ct]} -le 29 ]] then city=Anchorage fi if [[ ${tracknum[$ct]} -ge 31 && ${tracknum[$ct]} -le 56 ]] then city=Honolulu fi echo " A flight is requested from ${city} along track ${tracknum[$ct]}" >> $text echo " with a control time of ${controldate[$ct]}/${controltime[$ct]}Z" >> $text echo >> $text echo " A flight is requested from ${city} along track ${tracknum[$ct]}" >> $carcahtext echo " with a control time of ${controldate[$ct]}/${controltime[$ct]}Z" >> $carcahtext echo >> $carcahtext echo " Verification information is as follows:" >> $text echo >> $text echo ${tracknum[$ct]} >> $trackinfo mark=1 while test ${mark} -le ${casecounter[$ct]} do index=`expr ${ct} \* 10 + ${mark}` casenumber=${casenum[$index]} echo " Verification time: ${veridate[$casenumber]}" >> $text echo " Latitude: ${vrlat[$casenumber]}" >> $text echo " Longitude: ${vrlon[$casenumber]}" >> $text echo " Priority: ${prioritytxt[$casenumber]}" >> $text echo " Comments: ${comments[$casenumber]}" >> $text echo >> $text echo ${veridate[$casenumber]} >> $verinfo echo ${flydate[1]} >> $verinfo echo ${vrlon[$casenumber]} >> $verinfo echo ${vrlat[$casenumber]} >> $verinfo echo ${radvr} >> $verinfo mark=`expr ${mark} + 1` done ct=`expr ${ct} + 1` done echo " CARCAH Comments: ${carcahcomments}" >> $text echo >> $text echo " Additional Comments: ${morecomments}" >> $text echo >> $text echo " Comments: ${carcahcomments}" >> $carcahtext echo >> $carcahtext mk2=1 else echo "ENTER THE NUBMER OF THE ITEM YOU WISH TO CHANGE" read changenum echo if [[ ${optracker[$changenum]} -le 19 && ${optracker[$changenum]} -gt 2 ]] then mk0=0 index=`expr ${optracker[$changenum]} - 10` while test ${mk0} -ne 1 do mk0=1 echo "ENTER THE NUBMER OF THE DESIRED FLIGHT TRACK" read tracknum[$index] echo if [[ ${tracknum[$index]} -gt 56 || ${tracknum[$index]} -lt 1 ]] then echo "Invalid track number; valid tracks are 1 to 29, 31 to 49 and 51 to 56" echo mk0=0 fi if [[ ${tracknum[$index]} -eq 50 || ${tracknum[$index]} -eq 30 ]] then echo "Invalid track number; valid tracks are 1 to 29, 31 to 49 and 51 to 56" echo mk0=0 fi done fi if [ ${optracker[$changenum]} -gt 20 ] then mk1=0 index=`expr ${optracker[$changenum]} - 10` while test ${mk1} -ne 1 do mk1=1 #caseview2.2.sh echo "----------------------------------------------------------" i=1 while test ${i} -le ${cases} do echo "CASE ${i}" echo " Observation time: ${obsdate[$i]}" echo " Verification time: ${veridate[$i]}" echo " Latitude: ${vrlat[$i]}" echo " Longitude: ${vrlon[$i]}" echo " Priority: ${prioritytxt[$i]}" echo " Comments: ${comments[$i]}" i=`expr ${i} + 1` if [ ${i} -le ${cases} ] then echo fi done echo "----------------------------------------------------------" echo echo "WHAT IS THE CASE NUMBER OF THE SITUATION THE FLIGHT WILL TARGET?" echo "(enter ${newcasenum} to input data for a new case)" read casenum[$index] echo newcasemarker=0 if [ ${casenum[index]} -eq ${newcasenum} ] then echo "-----------------------------------------------------------------" echo "FOR CASE ${newcasenum}:" echo echo "ENTER THE OBSERVATION TIME (yyyymmddhh)" read obsdate[$newcasenum] echo echo "ENTER THE VERIFICATION TIME (yyyymmddhh)" read veridate[$newcasenum] echo echo "ENTER THE LATITUDE OF THE CENTER OF THE VERIFICATION REGION" read vrlat[$newcasenum] echo echo "ENTER THE LONGITUDE OF THE CENTER OF THE VERIFICATION REGION" read vrlon[$newcasenum] echo echo "CHOOSE A PRIORITY" echo "1) HIGH PRIORITY" echo "2) MEDIUM PRIORITY" echo "3) LOW PRIORITY" read priority[$newcasenum] case ${priority[$newcasenum]} in 1) prioritytxt[$newcasenum]=HIGH;; 2) prioritytxt[$newcasenum]=MEDIUM;; 3) prioritytxt[$newcasenum]=LOW;; esac echo echo "PROVIDE COMMENTS OR PRESS ENTER" read comments[$newcasenum] echo "-----------------------------------------------------------------" echo newcasemarker=1 else if [[ ${casenum[$index]} -lt 1 || ${casenum[$index]} -gt ${cases} ]] then if [ ${cases} -eq 1 ] then echo "Invalid entry; the only valid entry is 1." else echo "Invalid entry; valid entries are 1 through ${cases}" fi echo mk1=0 fi fi casenumber=${casenum[$index]} if [[ ${obsdate[$casenumber]} -ne ${flydate[1]} && ${mk1} -eq 1 ]] then echo "You must select a case with ${flydate[1]} as the observation time" echo "Please try again" echo mk1=0 fi if [[ ${mk1} -eq 1 && ${newcasemarker} -eq 1 ]] then newcasenum=expr` ${newcasenum} + 1 ` fi done fi if [ ${optracker[$changenum]} -eq 1 ] then echo "ENTER ADDITIONAL COMMENTS ABOUT THE FLIGHT(S)" read morecomments echo fi if [ ${optracker[$changenum]} -eq 2 ] then echo "ENTER COMMENTS ABOUT THE FLIGHT(S) FOR CARCAH" read carcahcomments echo fi fi done fi if test "$dowefly" = 'n' || test "$dowefly" = 'N' then echo "PROVIDE COMMENTS FOR CARCAH OR PRESS ENTER" read carcahcomments echo echo "PROVIDE ADDITIONAL COMMENTS OR PRESS ENTER" read additcomments echo echo "FLIGHT REQUEST FOR ${flydate[1]}" >> $text echo >> $text echo " No flight is requested" >> $text echo >> $text echo " CARCAH comments: ${carcahcomments}" >> $text echo >> $text echo " Additional comments: ${additcomments}" >> $text echo >> $text echo "FLIGHT REQUEST FOR ${flydate[1]}" >> $carcahtext echo >> $carcahtext echo " No flight is requested" >> $carcahtext echo >> $carcahtext echo " Comments: ${carcahcomments}" >> $carcahtext echo >> $carcahtext fi echo "OUTLOOK FOR ${flydate[2]}" >> $text echo >> $text echo "OUTLOOK FOR ${flydate[2]}" >> $carcahtext echo >> $carcahtext clear echo "OUTLOOK:" echo echo "DO YOU ANTICIPATE FLYING AROUND ${flydate[2]}? (y/n)" read response echo if test "$response" = 'y' || test "$response" = 'Y' then mk29=0 while test ${mk29} -ne 1 do mk29=1 echo "HOW MANY TRACKS ARE ANTICIPATED?" read outlooktks if [[ ${outlooktks} -gt 3 || ${outlooktks} -lt 1 ]] then echo "Only 1-3 tracks are possible. Please try again." echo mk29=0 else echo fi done ct=1 while test ${ct} -le ${outlooktks} do mk3=0 while test ${mk3} -ne 1 do mk3=1 if [ ${outlooktks} -eq 1 ] then echo "WHICH TRACK IS ANTICIPATED FOR THIS FLIGHT?" else echo "WHICH TRACK IS ANTICIPATED FOR FLIGHT ${ct}?" fi read tracknum[$ct] echo if [[ ${tracknum[$ct]} -gt 56 || ${tracknum[$ct]} -lt 1 ]] then echo "Invalid track number; valid tracks are 1 to 29, 31 to 49 and 51 to 56" echo mk3=0 fi if [[ ${tracknum[$ct]} -eq 50 || ${tracknum[$ct]} -eq 30 ]] then echo "Invalid track number; valid tracks are 1 to 29, 31 to 49 and 51 to 56" echo mk3=0 fi if [ ${mk3} -eq 1 ] then ct=`expr ${ct} + 1` fi done done echo "ENTER ANY COMMENTS FOR CARCAH" read outlookcarcah echo echo "ENTER ANY OTHER ADDITIONAL COMMENTS" read addcomments echo ct=1 while test ${ct} -le ${outlooktks} do if [[ ${tracknum[$ct]} -ge 1 && ${tracknum[$ct]} -le 29 ]] then city=Anchorage fi if [[ ${tracknum[$ct]} -ge 31 && ${tracknum[$ct]} -le 56 ]] then city=Honolulu fi echo " A flight from ${city} along track ${tracknum[$ct]} is possible" >> $text echo >> $text echo " A flight from ${city} along track ${tracknum[$ct]} is possible" >> $carcahtext echo >> $carcahtext ct=`expr ${ct} + 1` done echo " CARCAH comments: ${outlookcarcah}" >> $text echo >> $text echo " Additional comments: ${addcomments}" >> $text echo " Comments: ${outlookcarcah}" >> $carcahtext fi if test "$response" = 'n' || test "$response" = 'N' then echo "PROVIDE COMMENTS FOR CARCAH OR PRESS ENTER" read carcahcomments echo echo "PROVIDE ADDITIONAL COMMENTS OR PRESS ENTER" read additcomments echo echo " No flights are anticipated" >> $text echo >> $text echo " CARCAH comments: ${carcahcomments}" >> $text echo >> $text echo " Additional comments: ${additcomments}" >> $text echo " No flights are anticipated" >> $carcahtext echo >> $carcahtext echo " Comments: ${carcahcomments}" >> $carcahtext fi clear echo "HERE IS THE FINAL DECISION FILE:" echo "*******************************************************************" cat $text echo "*******************************************************************" echo "Please press enter when done" read dummyresponse clear echo "-------------------------------------------------------------------" echo "| The Winter Storm Reconnaissance decision file has been created. |" echo "-------------------------------------------------------------------" ###ping -c1 emc1 > /dev/null 2>&1 ###pingerr=$? ###if test $pingerr -eq 0 ###then # ftp emc1 << ftpEOF > /dev/null 2>&1 # cd /disk21/data/web/ensgem/wsr/text # mkdir $PDY # cd $PDY # lcd $GESdir # put ${PDY}carcah_decision.txt carcah_decision.txt # put ${PDY}decision.txt decision.txt # bye #ftpEOF ftp ncorzdm << ftpEOF > /dev/null 2>&1 cd /home/people/nco/www/htdocs/pmb/sdm_wsr mkdir $PDY cd $PDY lcd $GESdir put ${PDY}carcah_decision.txt carcah_decision.txt put ${PDY}decision.txt decision.txt bye ftpEOF ###fi echo "" echo "Do you want to send an email out to CARCAH? (y/n)" echo "" read emailans if test "$emailans" = 'y' || test "$emailans" = 'Y' then cat $GESdir/${PDY}carcah_decision.txt | mail -s WINTER_STORM_RECON_REQUEST ncep.tpc.carcah@noaa.gov cat $GESdir/${PDY}decision.txt | mail -s WINTER_STORM_RECON_REQUEST sdm@noaa.gov cat $GESdir/${PDY}decision.txt | mail -s WINTER_STORM_RECON_REQUEST stephen.Renwick@keesler.af.mil cat $GESdir/${PDY}decision.txt | mail -s WINTER_STORM_RECON_REQUEST steverenwick@cableone.net echo "Email Sent to ncep.tpc.carcah@noaa.gov and sdm@noaa.gov" echo "Contact Info: John Pavone (305)229-4474" else cat $GESdir/${PDY}decision.txt | mail -s WINTER_STORM_RECON_REQUEST sdm@noaa.gov echo "Email Sent to sdm@noaa.gov" fi exit