#!/bin/sh ################################################################ # setup_hysplitwafs - HYSPLIT-volcano setup script to choose # ash reduction level or alert-ended # for dissemination # # created: 20 May 2002 # revised: 06 Jul 2010 - list available runs (code from setup_hysplit_script) ################################################################ export envir=prod export NET=hysplit export RUN=hysplit HOMEhysplit=/nw${envir} OUThysplit=/com/hysplit/${envir}/input cd $OUThysplit OUTFILE=wafs.ini TYPl=volc FILE=not_chosen red=not_chosen # Run setpdy and initialize PDY variables cyc=`date -u +%H` if test $cyc -lt 6 then cyc=00 else if test $cyc -lt 12 then cyc=06 else if test $cyc -lt 18 then cyc=12 else cyc=18 fi fi fi export cyc export cycle=t${cyc}z sh /nwprod/util/ush/setpdy.sh 1>/dev/null . PDY chmod 777 ncepdate NMCDATE PDY # directories of previous runs' inputs COMOUTpdy=/com/${NET}/${envir}/${RUN}.${PDY} COMOUTpdym1=/com/${NET}/${envir}/${RUN}.${PDYm1} ################################################################ # Get User Input ################################################################ clear echo "---------------------------------------------" echo "| HYSPLIT VOLCANIC ASH DISSEMINATION SCRIPT |" echo "---------------------------------------------" echo echo " NEW 2010: You can choose the run, it doesn't default to the last run" echo #################################################################### # review inputs #################################################################### main_menu_flag=1 START=0 # use this to force set ash reduction level first while [ $main_menu_flag -ne 0 ] do clear echo echo "VERIFY/EDIT THE FOLLOWING INFORMATION" echo echo " 1) ASH REDUCTION LEVEL : $red" echo " 2) FILENAME : $FILE" echo if [ "${FILE}" = "not_chosen" -o "${red}" = "not_chosen" ] then echo "ENTER NUMBER TO EDIT (1, then 2) " else echo "ENTER NUMBER TO EDIT OR (Y) TO ACCEPT VALUES:" fi read ans case $ans in 1) let START=${START}+1 echo " CHARTS FOR DISSEMINATION " echo "--------------------------" echo "0 no ash reduction " echo "1 small ash reduction " echo "2 medium ash reduction " echo "3 large ash reduction " echo "4 alert ended " echo "--------------------------" echo "ENTER NUMBER: " read red # read chosen filename if [ $red -lt 0 -0 $red -gt 4 ] then echo "Not a valid entry, please press 'enter' to continue and choose again" read dummy fi if [ ${START} -gt 1 ] then klen=`expr "${INI}" : ".*"` let klenm8=${klen}-8 # last 8 chars are 12_rX.ps read_tmp=`echo ${INI} | cut -c1-${klenm8}` if [ ${red} -eq 4 ] then FILE=${read_tmp}ae_r0.ps else FILE=${read_tmp}12_r${red}.ps fi fi ;; 2) if [ ${START} -ne 0 ] then # start with previous inputs rm -f filelist let N=0 echo echo "--------------------------------------------------------------------" echo " Choose run from today or yesterday " echo "--------------------------------------------------------------------" ls ${COMOUTpdy}/*.${TYPl}???.volcplot12_r0.ps \ ${COMOUTpdym1}/*.${TYPl}???.volcplot12_r0.ps 2>/dev/null | \ while read tmp; do let N=$N+1 echo $N - ${tmp} echo $tmp >> filelist chmod 777 filelist done echo "--------------------------------------------------------------------" if [ $N -eq 0 ] then echo "You can only choose files from today or yesterday" echo " but none were found. Was looking in" echo " ${COMOUTpdy} " echo " ${COMOUTpdym1}" echo " for files named *.volcplot12.*.ps" echo "FATAL - Cannot complete this script. JHYSPT_WAFS cannot be run." exit 3 fi echo "ENTER NUMBER FOR STARTING INPUTS (1-$N): " read initnum # if enter if [ "${initnum}" = "" ] then FILE=not_chosen fi # read chosen filename if [ $initnum -gt 0 -a $initnum -le $N ] then INI=`head -$initnum filelist | tail -1` klen=`expr "${INI}" : ".*"` let klenm8=${klen}-8 # last 8 chars are 12_rX.ps read_tmp=`echo ${INI} | cut -c1-${klenm8}` if [ ${red} -eq 4 ] then FILE=${read_tmp}ae_r0.ps else FILE=${read_tmp}12_r${red}.ps fi else echo "Not a valid entry, please press 'enter' to continue and choose again" read dummy fi fi ;; Y|y) main_menu_flag=0;; *) ;; esac done ################################################################ # Save Setup Information to the Base File ################################################################ rm -f $OUTFILE echo $red >$OUTFILE echo ${FILE} >>$OUTFILE chmod 777 $OUTFILE ###### clear echo echo "######################################################" echo "Setup Complete - written to $OUThysplit/${OUTFILE}" echo "Ask Operator to RERUN jhyspt_wafs" echo "######################################################" echo echo