#!/bin/sh # # TRC Note - this file should be renamed from wcn_exe.txt to wcn_exe.ch and # the executable bit set, i,e., % chmod +x wcn_exe.ch # # wcn_ex.sh # # Written by Tom Salem, August 2004, NWS Glasgow # # Usage: wcn_exe.sh # # This script creates a NIMNAT message, WCL product, and WOU product for training on the # Watch by County procedure. It saves the trainer from having to edit the WCL and WOU # products each time the training is done. # ############################################################## # # The script creates a unique (different time) NIMNAT message and writes it to the local # text database. The script also creates a WCL product with pre-configured counties and # a 1 hour expiration time. The operator and trainee can choose whether to use a different # set or the same set of counties for the WOU product. (Note that the counties are pre- # configured in this training script.) Once a decision is made, the script will write the # WOU product to the locat text database. # # NOTE: # # The program does NOT have the WOU product as a practice product. It is a test product and # the WOU CAN BE SENT OUT TO THE WORLD--SO BE CAREFULL. # ################################################################ # # Edit this section for your CWA. # # Define the following variables: # # WCL_FIPS_COUNTIES: The FIPS codes for the counties you want to be in the WCL product # Ex. Montana counties 71 and 105 would be MTC071-105 # Don't end the variable with a dash. # WCL_FIPS_COUNTIES="MTC071-105" # # # WCL_COUNTY_NAMES: The names of the counties in the WCL product # Ex. "Phililips Valley" These counties would be in the watch # Suggestion: Keep it short so all fit on one line or you can use \n for a new line. # WCL_COUNTY_NAMES=" PHILLIPS VALLEY" # # # STATE: The two letter abbreviation of the state where the watch is for. # Ex. "MT" for Montana # STATE="MT" # # # STATENAME: The name of the state where the watch is for. # Ex. "MONTANA" All in caps for product. # STATENAME="MONTANA" # # # WOU_CHANGES_UGC: FIPS codes for the counties in the watch. This is for when the list will be # different from the WCL list. # Ex. MTC019-071-105 # Added county 19 to the UGC line. Remember the FIPS codes should be in order. # Note: No dash at the end of the line and they must be in the same state. # WOU_CHANGES_UGC="MTC019-071-105" # # # WOU_CHANGES_NAMES: County names for the WOU product if different from the WCL product. # Ex. "DANIELS PHILLIPS VALLEY" # WOU_CHANGES_NAMES="DANIELS PHILLIPS VALLEY" # # # HOURS_Z: Hours from Z time. MDT is 6, MST is 7, EDT is 8. # HOURS_Z=6 # # # TIMEZ: TIME ZONE. Ex. MDT # TIMEZ="MDT" # # ######### # # The following variables can be edited. However, you do not have to. # # WFO: Local WFO code (Ex. GGW) # WFO=${FXA_LOCAL_SITE} # # # WATCH_NUMBER: SPC Watch number. This will also decide the WOU product that is issued. # Note: This must be a 4 digit number. # WATCH_NUMBER=9998 # ########################################################################## # # The script! # # First thing to do is to create a NIMNAT message with the current time. # # Create a long date and a short date for the NIMNAT message ldat=$(date -u) sdat=$(date -u +%d%H%M) # # Create the NIMNAT message and send it to the text database" echo -e "NXXX80 KNCF" ${sdat} > /tmp/NIMNAT echo -e "NIMNAT\n\nAlert Administrative Message\nNATIONAL WEATHER SERVICE\n"${ldat} >> /tmp/NIMNAT echo -e "\n\nThis is a test. Normally it would be from the Strom Prediction Center." >> /tmp/NIMNAT echo -e "It would also have a time and phone number for you to call in to SPC.\n\n\$\$" >> /tmp/NIMNAT textdb -w WSHNIMNAT < /tmp/NIMNAT rm /tmp/NIMNAT # # Create the WCL product and send it to the text database as WCLJ # The watch will be evffective for one hour # # The following are to determine the current date and time. The different variables will be # used to create the text products and determine the times for the text products. # ihr=$(date -u +%H) idy=$(date -u +%d) imm=$(date -u +%M) iyy=$(date -u +%y) iYY=$(date -u +%Y) imth=$(date -u +%m) daya=$(date -u +%a | tr '[a-z]' '[A-Z]') mona=$(date -u +%b | tr '[a-z]' '[A-Z]') # # Calculate Local Time for products # let bhr=ihr-${HOURS_Z} if [ ${bhr} -lt "01" ]; then let bhr=bhr+24 fi if [ ${bhr} -gt 12 ]; then let bhr=bhr-12 ap=" PM " else ap=" AM " fi # # The expiration will be 1 hour later--except if it is run during the last hour # of the Z day--then the expiration will be at 2359. # let hr1=ihr+1 if [ $hr1 -lt 10 ]; then hrr=${hr1} hr1=0${hrr} elif [ $hr1 -gt 23 ]; then hr1=23 imm=59 fi # # Set end time (etim), end UGC time (eugc), and the VTEC times (vtecb and vtece). # etim=${hr1}${imm} eugc=-${idy}${hr1}${imm}- vtecb=${iyy}${imth}${idy}"T"${ihr}${imm}"Z-" vtece=${iyy}${imth}${idy}"T"${hr1}${imm}"Z/" # # Create the WCL product and write it to the database. # echo -e "NWUS64 KWNS" ${sdat} > /tmp/WCL echo -e "WCLJ\n\n.SEVERE THUNDERSTORM WATCH J" >> /tmp/WCL echo -e "COORDINATION COUNTY LIST FROM THE NWS STORM PREDICTION CENTER" >> /tmp/WCL echo -e "EFFECTIVE UNTIL" ${etim} "UTC." >> /tmp/WCL echo -e "\n\n"${WCL_FIPS_COUNTIES}${eugc}"\n\n"${STATE}"\n. "${STATENAME}" CONTINUES INCLUDED ARE\n\n" >> /tmp/WCL echo -e "\n "${WCL_COUNTY_NAMES}"\n\$\$\n\nATTN...WFO..."${WFO}"...\n" >> /tmp/WCL textdb -w WCLJ < /tmp/WCL rm /tmp/WCL # # Calculate Local Time for the WOU product # let lhr=hr1-${HOURS_Z} if [ ${lhr} -lt "01" ]; then let lhr=lhr+24 fi if [ ${lhr} -gt 12 ]; then let lhr=lhr-12 ap=" PM " else ap=" AM " fi # # Now we wait till we are ready for the WOU to be sent # Default answer is yes # To get something changed you will have to type N or n as the first character." # echo "Do you agree with the SPC on the watch?" read expand expd=$(echo $expand | cut -c1 | tr '[A-Z]' '[a-z]') # # Figure out the product number for WOU # WN=$(echo ${WATCH_NUMBER} | cut -c4) # # Now decide whether we will use the same area or the changed area. if [ ${expd} = "n" ]; then # # Create the WOU product for a different list of counties. # echo -e "WOUS64 KWNS "${sdat}"\nWOU"${WN}"\n\nBULLETIN - IMMEDIATE BROADCAST REQUESTED" > /tmp/WOU echo -e "SEVERE THUNDERSTORM WATCH OUTLINE UPDATE FOR WS "${WATCH_NUMBER}"\nNWS STORM PREDICTION CENTER NORMAN OK" >> /tmp/WOU echo -e ${bhr}${imm} ${ap} ${TIMEZ} ${daya} ${mona} ${idy} ${iYY} >> /tmp/WOU echo -e "\nSEVERE THUNDERSTORM WATCH "${WATCH_NUMBER}" IS IN EFFECT UNTIL "${lhr}${imm}${ap}${TIMEZ} >> /tmp/WOU echo -e "FOR THE FOLLOWING LOCATIONS\n\n"${WOU_CHANGES_UGC}${eugc} >> /tmp/WOU echo -e "/T.NEW.KWNS.SV.A."${WATCH_NUMBER}"."${vtecb}${vtece}"\n\n"${STATE}"\n" >> /tmp/WOU echo -e ". "${STATENAME}" COUNTIES INCLUDED ARE\n\n"${WOU_CHANGES_NAMES}"\n\$\$\n\nATTN...WFO..."${WFO}"...\n" >> /tmp/WOU else # # Create the WOU product for the same list of counties as the WCL product. # echo -e "WOUS64 KWNS "${sdat}"\nWOU"${WN}"\n\nBULLETIN - IMMEDIATE BROADCAST REQUESTED" > /tmp/WOU echo -e "SEVERE THUNDERSTORM WATCH OUTLINE UPDATE FOR WS "${WATCH_NUMBER}"\nNWS STORM PREDICTION CENTER NORMAN OK" >> /tmp/WOU echo -e ${bhr}${imm} ${ap} ${TIMEZ} ${daya} ${mona} ${idy} ${iYY} >> /tmp/WOU echo -e "\nSEVERE THUNDERSTORM WATCH "${WATCH_NUMBER}" IS IN EFFECT UNTIL "${lhr}${imm}${ap}${TIMEZ} >> /tmp/WOU echo -e "FOR THE FOLLOWING LOCATIONS\n\n"${WCL_FIPS_COUNTIES}${eugc} >> /tmp/WOU echo -e "/T.NEW.KWNS.SV.A."${WATCH_NUMBER}"."${vtecb}${vtece}"\n\n"${STATE}"\n" >> /tmp/WOU echo -e ". "${STATENAME}" COUNTIES INCLUDED ARE\n\n"${WCL_COUNTY_NAMES}"\n\$\$\n\nATTN...WFO..."${WFO}"...\n" >> /tmp/WOU fi # # Write the WOU product to the text database. # woun="WOU"${WN} textdb -w ${woun} < /tmp/WOU rm /tmp/WOU # # End of script # echo "DONE"