#!/bin/sh # set -nv ################################################################ # setup_hysplit_post2_rsmc - HYSPLIT-RSMC setup script to choose # run for dissemination # (based on setup_hysplit_wafs) # # created: 30 Mar 2011 ################################################################ export envir=prod export NET=hysplit export RUN=hysplit HOMEhysplit=/nw${envir} OUThysplit=/com/hysplit/${envir}/input cd $OUThysplit OUTFILE=rsmc.ini TYPl=rsmc FILE=not_chosen site=not_chosen seq=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 PDYp1 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 RSMC DISSEMINATION SCRIPT |" echo "---------------------------------------------" echo #################################################################### # review inputs #################################################################### main_menu_flag=1 ##### # first ask if unavailable's need to be sent, if so skip main_menu ##### clear echo "--------------------------------------" echo "| HYSPLIT RSMC DISSEMINATION SCRIPT |" echo "--------------------------------------" echo echo "Generally, at the beginning of an RSMC exercise/event " echo " and about 24-hours after products have been posted and " echo " there is no need for an update" echo "it is useful to send 'unavailable' images to the web page" echo echo "Do you want to send the 'unavailables' (y/n)?" read unav case ${unav} in y|Y) main_menu_flag=0 FILE="unavailable" ;; esac ##### # continue with main_menu ##### while [ $main_menu_flag -ne 0 ] do clear echo "--------------------------------------" echo "| HYSPLIT RSMC DISSEMINATION SCRIPT |" echo "--------------------------------------" echo echo echo "VERIFY/EDIT THE FOLLOWING INFORMATION" echo echo " 1) FILENAME : $FILE" echo " 2) Site name (from filename) : $site" echo " 3) Run sequence number (from filename ${TYPl}NNN): $seq" echo echo "(If you want to send 'unavailables' CNTL-C and start this script again.)" echo "----------------------------------------------------------" echo if [ "${FILE}" = "not_chosen" ] then ans=1 else echo "ENTER NUMBER TO EDIT OR (Y) TO ACCEPT VALUES:" read ans fi case $ans in 1) rm -f filelist let N=0 echo echo "--------------------------------------------------------------------" echo " Choose run from today or yesterday " echo "--------------------------------------------------------------------" ls ${COMOUTpdy}/*.${TYPl}???.rsmc.ps \ ${COMOUTpdym1}/*.${TYPl}???.rsmc.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 " " 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 *.rsmc.ps" echo "FATAL - Cannot complete this script. JHYSPT_POST_RSMC cannot be run." exit 3 fi echo "ENTER NUMBER FOR DISSEMINATION (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 .rsmc.ps read_tmp=`echo ${INI} | cut -c1-${klenm8}` FILE=${read_tmp}.rsmc.ps #first=`echo ${FILE} | cut -f1 -d.` # /com/hysplit/prod/hysplit #second=`echo ${FILE} | cut -f2 -d.` # ${PDY}/hysplit #third=`echo ${FILE} | cut -f3 -d.` # ${cycle} site=`echo ${FILE} | cut -f4 -d.` # SITENAME fifth=`echo ${FILE} | cut -f5 -d.` # rsmcNNN seq=`echo $fifth | cut -c5-7` #sixth=`echo ${FILE} | cut -f6 -d.` # rsmc #seventh # ps else echo "Not a valid entry, please press 'enter' to continue and choose again" read dummy fi ;; 2) echo echo "Enter the sitename (no spaces) if it differs from that given, otherwise enter L to leave it alone" read newsite case $newsite in L|l) site=${site} ;; *) site=${newsite};; esac ;; 3) echo echo "Enter the run sequence number (NNN in filename ...rsmcNNN...), otherwise enter L to leave it alone" read newseq case $newseq in L|l) seq=${seq} ;; *) seq=${newseq};; esac ;; Y|y) main_menu_flag=0;; *) ;; esac done ################################################################ # Save Setup Information to the Base File ################################################################ rm -f $OUTFILE echo ${FILE} >>$OUTFILE echo ${site} >>$OUTFILE echo ${seq} >>$OUTFILE chmod 777 $OUTFILE ###### clear echo echo "######################################################" echo "Setup Complete - written to $OUThysplit/${OUTFILE}" echo "Ask Operator to RERUN jhyspt_post_web_rsmc" echo " " echo " Unavailables written directly to ARL web, " echo " https://ready.arl.noaa.gov/rsmc2-bin/jntrsmc.pl" echo " but other files processed by an ARL script that runs every 5 minutes" echo "######################################################" echo echo