#!/bin/sh # set -nv # set -x ################################################################ # setup_hysplit_shift_script # hsyplit setup script to shift particle positions # and re-save new file to initialize subsequent hysplit run ################################################################ # # created: 10 Jun 2010 - # revised: 10 Jan 2011 - 8 tasks; one execution of main loop only # 16 Feb 2011 - write to $GEShysplit only not /com/hysplit/prod/hysplit.$PDY # 23 Feb 2011 - force choose valid date; error checking # # parshift # Spatial adjustment of the particle positions in the HYSPLIT binary particle # position output file as specified on the command line. One or more files may # be processed by a single execution with the adjusted output always written to # a new file name. The position adjustment is only applied to one time period # if the input file contains multiple time periods. The shift is specified in # either delta latitude-longitude units. Unless a lat-lon window is specified, # all particle positions in the file are adjusted. Adjustments outside of the # may be linearly blended to zero adjustment at a distance of two windows. # Adjustment may also be specified as a rotation and distance from a point. # Particles (all species or one selected) in a window may be deleted. # USAGE: parshift -[options (default)] # -b[blend shift outside of the window] # -d[delete particles instead of shift (0)-all #-specie]' # -i[input base file name (PARDUMP)] # -o[output base file name (PARINIT)] # -r[rotation degrees:kilometers:latitude:longitude] # -s[search for multiple files with .000 suffix] # -t[time MMDDHH (missing process first time only)] # -w[window corner lat1:lon1:lat2:lon2 (-90.0:-180.0:90.0:180.0)] # -x[shift delta longitude (0.0)] # -y[shift delta latitude (0.0)] ################################################################ # NET envir and RUN are used to list today and yesterday's runs NET=hysplit envir=prod RUN=hysplit HOMEhysplit=/nwprod #SEC HOMEhysplit=/nw${envir} FIXhysplit=$HOMEhysplit/fix #FIXhysplit=/meso/save/mgc0bs/nw2010/fix # ARL EXEChysplit=$HOMEhysplit/exec #EXEChysplit=/meso/save/mgc0bs/nw2010/exec # ARL GEShysplit=/com/hysplit/$envir/input #GEShysplit=/meso/save/mgc0bs/hysplit_ini # ARL cd $GEShysplit SENDCOM=YES rm -f ncepdate NMCDATE filelist PDY ################################################################ # set constants ################################################################ # flag for blank values tflg=0 # search for multiple files (.XXX suffix) YES or NO MFILE=YES if [ "${MFILE}" = "YES" ] then pdump=PARDUMP.001 #sfx=".001" # suffix else echo "ERROR - This version assumes MFILE must be YES", $MFILE exit 99 fi # # # Start of SDM prompts ################################### # # ################################################################ # Initial Setup ################################################################ clear echo "-----------------------------------------------" echo "| HYSPLIT PARTICLE DELETE/SHIFT/ROTATE INPUT SCRIPT |" echo "-----------------------------------------------" echo # clear # echo "-------------------------------------------" # echo " RUN TYPE " # echo "-------------------------------------------" # echo "1 WMO/IAEA request for RSMC support " # echo "2 volcano " # echo "3 WFO, Homeland Security " # echo "4 Back-tracking (Source attribution) " # echo "-------------------------------------------" # echo "ENTER RUN TYPE NUMBER: " # read typenum # if [ $typenum -lt 1 -o $typenum -gt 4 ] # then # echo # echo "Not a valid entry... try again" # echo "-------------------------------------------" # echo " RUN TYPE " # echo "-------------------------------------------" # echo "1 WMO/IAEA request for RSMC support " # echo "2 volcano " # echo "3 WFO, Homeland Security " # echo "4 Back-tracking (Source attribution) " # echo "-------------------------------------------" # echo "ENTER RUN TYPE NUMBER: " # read typenum # if [ $typenum -lt 1 -o $typenum -gt 4 ] # then # echo "Not a valid entry... start over" # exit # fi # fi typenum=2 # force to volcanic ash case $typenum in 2) TYPl=volc ;; esac # 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 # default date/time for parshift kyr=`echo ${PDY} | cut -c3-4` kmo=`echo ${PDY} | cut -c5-6` kda=`echo ${PDY} | cut -c7-8` khr=${cyc} echo "----------------------------------------------------------------" echo "If the satellite obs do not match the past forecast, and you want to update the forecast," echo " this program will allow you to EDIT the model particle positions to better match the obs," echo " then you MUST run setup_hysplit again, calling up these adjusted particles to start the forecast." echo "" echo "The 3 ways to adjust the particles are:" echo "DELETE - a deletion of all ash particles or only one particle size (out of 4) in a window" echo "SHIFT - a horizontal movement (degrees latitude, longitude) of all particles within a rectangular window" echo "ROTATE - a horizontal movement (degrees clockwise) of all particles within a circular window" echo "" echo "The delete/shift/rotate applies only to the hysplit particles at one time period " echo " (valid time, e.g. time of satellite obs)" echo "" echo "The pair of setup_hysplit_shift and setup_hysplit can be run successively to piggyback on the latest change" #echo "" #echo "----------------------------------------------------------------" #### 1-10-2011 Force 1 execution only. Comment out these lines. Keep 'while LOOPNUM' structure. #### If experience shows multiple runs are useful, can reinstate this. # At end of this script, run setup_hysplit_script (+DATACHK) before run # this again to have another 'shift' piggyback on the first 'shift' #### #echo "Enter the number of executions of hysplit_parshift you want (default is 1)" #read numexec #if [ "${numexec}" = "" ] #then numexec=1 #fi #if [ $numexec -gt 1 ] #then # echo "" # echo "The setup script will loop through the 'EXECUTION TYPES' $numexec times" # echo "then continue with hysplit_setup_script for the run. " #fi #### 1-10-2011 - End force 1 loop LOOPNUM=1 while [ $LOOPNUM -le $numexec ] do # blend flag BLEND=NO # NO or YES to blend outside window or beyond scand # window WINDOW=NO # YES or NO wlat1D=-90.0 # default window equals global wlon1D=-180.0 wlat2D=90.0 wlon2D=180.0 wlat1=$wlat1D wlon1=$wlon1D wlat2=$wlat2D wlon2=$wlon2D # shift SHIFT=NO # YES OR NO dlatshiftD=0.0 # default no shift in position dlonshiftD=0.0 dlatshift=$dlatshiftD dlonshift=$dlonshiftD # rotation ROTATION=NO # YES or NO qlatD=0.0 # rotation centerpoint qlonD=0.0 angleD=0.0 # rotation angle scandD=10000. # rotation scan distance (km, rotation occurs within this dist, unless blend) qlat=$qlatD qlon=$qlonD angle=$angleD scand=$scandD # delete NUMP=0 # all particle size bins #clear echo "" echo "-------------------------------------------" echo " EXECUTION TYPE " echo "-------------------------------------------" echo "1 Delete particles " echo "2 Shift particles (in latitude, longitude increments)" echo "3 Rotate particles (degrees clockwise about a point)" echo "-------------------------------------------" echo "ENTER RUN TYPE NUMBER: " read shifttypenum if [ $shifttypenum -lt 1 -o $shifttypenum -gt 3 ] then echo echo "Not a valid entry... try again" echo "-------------------------------------------" echo " EXECUTION TYPE " echo "-------------------------------------------" echo "1 Delete particles " echo "2 Shift particles (in latitude, longitude increments)" echo "3 Rotate particles (degrees clockwise about a point)" echo "-------------------------------------------" echo "ENTER EXECUTION TYPE NUMBER: " read shifttypenum if [ $shifttypenum -lt 1 -o $shifttypenum -gt 3 ] then echo "Not a valid entry... start over" exit fi fi # these all set to NO above; set the one chosen here case $shifttypenum in 1) DELETE=YES WINDOW=YES desc="DELETE" desced="DELETED";; 2) SHIFT=YES WINDOW=YES desc=SHIFT desced=SHIFTED;; 3) ROTATION=YES desc=ROTATE desced=ROTATED;; esac # 1st time only get run from /com, else take PARSHIFT in current directory if [ $LOOPNUM -eq 1 ] then # directories of previous runs' inputs COMOUTpdy=/com/${NET}/${envir}/${RUN}.${PDY} COMOUTpdym1=/com/${NET}/${envir}/${RUN}.${PDYm1} COMOUTpdym2=/com/${NET}/${envir}/${RUN}.${PDYm1} COMOUTpdym3=/com/${NET}/${envir}/${RUN}.${PDYm1} COMOUTpdym4=/com/${NET}/${envir}/${RUN}.${PDYm1} COMOUTpdym5=/com/${NET}/${envir}/${RUN}.${PDYm1} COMOUTpdym6=/com/${NET}/${envir}/${RUN}.${PDYm1} COMOUTpdym7=/com/${NET}/${envir}/${RUN}.${PDYm1} #COMOUTpdy=/ptmp/mgc0bs/hysplit.${PDY} # ARL #COMOUTpdym1=/ptmp/mgc0bs/hysplit.${PDYm1} # ARL #COMOUTpdym2=/ptmp/mgc0bs/hysplit.${PDYm2} # ARL #COMOUTpdym3=/ptmp/mgc0bs/hysplit.${PDYm3} # ARL #COMOUTpdym4=/ptmp/mgc0bs/hysplit.${PDYm4} # ARL #COMOUTpdym5=/ptmp/mgc0bs/hysplit.${PDYm5} # ARL #COMOUTpdym6=/ptmp/mgc0bs/hysplit.${PDYm6} # ARL #COMOUTpdym7=/ptmp/mgc0bs/hysplit.${PDYm7} # ARL # start with previous inputs rm -f filelist let N=0 echo echo "--------------------------------------------------------------------" echo " FILE WITH PARTICLES TO BE ${desced} " echo " Choose the number from the run listed in which you want to " echo " ${desc} the ash before continuing on in the next run. " echo "--------------------------------------------------------------------" ls ${COMOUTpdy}/*.${TYPl}???.${pdump} \ ${COMOUTpdym1}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym2}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym3}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym4}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym5}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym6}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym7}/*.${TYPl}???.${pdump} 2>/dev/null | \ while read tmp; do let N=$N+1 echo $N - ${tmp} echo $tmp >> filelist chmod 777 filelist done Nmax=$N #### 1-10-2011 Comment out since not looping. #if [ -s PARSHIFT.001 ] #then # let Nmax=${N}+1 # echo ${Nmax} - 2nd shift/delete to what was just run #fi #### 1-10-2011 End Comment out since not looping. if [ $N -eq 0 ] then echo "" echo "TERMINATION - No prior runs available" exit fi echo "--------------------------------------------------------------------" echo "ENTER NUMBER FOR FILE (1-${Nmax}): " read initnum # if enter force retry if [ "${initnum}" = "" ] then #if [ -s PARSHIFT.001 ] # wehn force main loop to 1 only don't need this #then # let initnum=${N}+2 #else let initnum=${N}+1 #fi fi if [ $initnum -lt 1 -o $initnum -gt ${Nmax} ] then let N=0 echo echo "Not a valid entry... try again" echo "--------------------------------------------------------------------" echo " FILE WITH PARTICLES TO BE ${desced} " echo "--------------------------------------------------------------------" ls ${COMOUTpdy}/*.${TYPl}???.${pdump} \ ${COMOUTpdym1}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym2}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym3}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym4}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym5}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym6}/*.${TYPl}???.${pdump} 2>/dev/null \ ${COMOUTpdym7}/*.${TYPl}???.${pdump} 2>/dev/null | \ while read tmp; do let N=$N+1 echo $N - ${tmp} done #### 1-10-2011 Comment out since not looping. #if [ -s PARSHIFT.001 ] #then # echo ${Nmax} - 2nd shift/delete to what was just run #fi #### 1-10-2011 Comment out since not looping. echo "--------------------------------------------------------------------" echo "ENTER NUMBER FOR FILE (1-${Nmax}): " read initnum # if enter force exit if [ "${initnum}" = "" ] then echo "Not a valid entry... start over" exit fi if [ $initnum -lt 1 -o $initnum -gt ${Nmax} ] then echo "Not a valid entry... start over" exit fi fi # get chosen filename from list INI=`head -$initnum filelist | tail -1` # save pardump file from past run if [ $initnum -gt 0 ] then # read portion of filename prior to "PARDUMP" # PARDUMP MUST be last in filename klen=`expr "${INI}" : ".*"` let klenwoini=${klen}-12 # 12 for PARDUMP.001 'klen without ini' pinpf_tmp=`echo ${INI} | cut -c1-${klenwoini}` # copy to working directory for fnum in 001 002 003 004 005 006 007 008 do if [ -s ${pinpf_tmp}.PARDUMP.${fnum} ] then cp -p ${pinpf_tmp}.PARDUMP.${fnum} PARDUMP.${fnum} else echo "FATAL - ${pinpf_tmp}.PARDUMP.${fnum} not found. Shift program failed." exit 101 fi done # old #cp -p ${pinpf_tmp}.PARDUMP.001 PARDUMP.001 #cp -p ${pinpf_tmp}.PARDUMP.002 PARDUMP.002 #cp -p ${pinpf_tmp}.PARDUMP.003 PARDUMP.003 #cp -p ${pinpf_tmp}.PARDUMP.004 PARDUMP.004 #cp -p ${pinpf_tmp}.PARDUMP.005 PARDUMP.005 #cp -p ${pinpf_tmp}.PARDUMP.006 PARDUMP.006 #cp -p ${pinpf_tmp}.PARDUMP.007 PARDUMP.007 #cp -p ${pinpf_tmp}.PARDUMP.008 PARDUMP.008 fi else # doing subsequent execution of hyaplit_parshift, start with output from previous run for fnum in 001 002 003 004 005 006 007 008 do if [ -s PARSHIFT.${fnum} ] then cp -p PARSHIFT.${fnum} PARDUMP.${fnum} else echo "FATAL - ${GEShysplit}/PARSHIFT.${fnum} not found. Shift program failed." exit 102 fi done # old #cp -p PARSHIFT.001 PARDUMP.001 #cp -p PARSHIFT.002 PARDUMP.002 #cp -p PARSHIFT.003 PARDUMP.003 #cp -p PARSHIFT.004 PARDUMP.004 #cp -p PARSHIFT.005 PARDUMP.005 #cp -p PARSHIFT.002 PARDUMP.006 #cp -p PARSHIFT.003 PARDUMP.007 #cp -p PARSHIFT.008 PARDUMP.008 fi chmod 777 PARDUMP.* # check successful copies if [ ! -f PARDUMP.001 -o ! -f PARDUMP.002 -o ! -f PARDUMP.003 -o ! -f PARDUMP.004 -o \ ! -f PARDUMP.005 -o ! -f PARDUMP.006 -o ! -f PARDUMP.007 -o ! -f PARDUMP.008 ] then echo "FATAL - PARDUMP/PARSHIFT files not copied. Shift program failed" exit 5 fi # overwrite pinpf with value SDM just entered # want the initialiataion for THIS run not PRIOR run #pinpf=${pinpf_tmp} pinpf=PARDUMP ################################################################### # review inputs #################################################################### main_menu_flag=1 while [ $main_menu_flag -ne 0 ] do clear echo "THIS IS THE PARTICLE DELETE/SHIFT/ROTATE PROGRAM REVIEW MENU... VERIFY/EDIT THE FOLLOWING INFORMATION" echo echo " 1) FILE (kill and re-start this program if wrong) : ${pinpf_tmp}.PARDUMP.001" #echo " *** or move code for choosing file to here and delete above ***" echo " PARTICLE ${desc} TIME (normally this is the satellite obs time rounded to nearest hour)" echo " 2) YEAR : $kyr" echo " 3) MONTH : $kmo" echo " 4) DAY : $kda" echo " 5) HOUR : $khr" if [ "${SHIFT}" = "YES" -o "${DELETE}" = "YES" ] then echo " 6) WINDOW : $WINDOW" echo " (particles ${desc} within a rectangular ${desc}-window (box), default is entire globe)" echo " WINDOW LOWER-LEFT CORNER LATITUDE : $wlat1" echo " WINDOW LOWER-LEFT CORNER LONGITUDE : $wlon1" echo " WINDOW UPPER-RIGHT CORNER LATITUDE : $wlat2" echo " WINDOW UPPER-RIGHT CORNER LONGITUDE : $wlon2" elif [ "${ROTATION}" = "YES" ] then echo " 6) N/A" fi if [ "${SHIFT}" = "YES" ] then echo " 7) SHIFT : $SHIFT" echo " HORIZONTAL SHIFT IN LATITUDE UNITS (positive to north) : $dlatshift" echo " HORIZONTAL SHIFT IN LONGITUDE UNITS (positive to east) : $dlonshift" echo " 8) N/A" echo " 9) N/A" echo "10) BLEND SHIFT OUTSIDE THE WINDOW? : $BLEND" elif [ "${ROTATION}" = "YES" ] then echo " 7) N/A" echo " 8) ROTATION : $ROTATION" echo " (angular shift of particles within a circular ${desc}-window)" echo " ROTATION ANGLE : $angle" echo " SCAN DISTANCE (km): $scand" echo " CENTERPOINT LATITUDE : $qlat" echo " CENTERPOINT LONGITUDE : $qlon" echo " 9) N/A" echo "10) BLEND SHIFT OUTSIDE THE WINDOW? : $BLEND" elif [ "${DELETE}" = "YES" ] then echo " 7) N/A" echo " 8) N/A" echo " 9) DELETE : ${DELETE} : ${NUMP}" echo " ash particle size bin for delete [0=all, 1=(0.6um), 2=(2.0um), 3=(6.0um), 4=(20.0um)]" echo " normally this would be 0 for all" echo "10) N/A" fi echo #------ # additional checks BADINFO=0 # added test above so don't need this 2-23-11 #if [ ! -s ${pinpf_tmp}.PARDUMP.001 ] #then # BADINFO=1 # echo "**********************************************************" # echo "FATAL - File not found ${pinpf_tmp}.PARDUMP.001" # echo " Run this script again" # echo "**********************************************************" # exit 5 #fi if [ ! -s PARINV ] then #file_prefix=`echo ${pinpf} | cut -f1 -dPARDUMP` # includes $COMOUT #cp -p ${file_prefix}PARINV PARINV cp -p ${pinpf_tmp}.PARINV PARINV fi tmp=`grep "${kmo}${kda}${khr}" PARINV` fdate=`head -1 PARINV | cut -c3-8` # take out year ldate=`tail -1 PARINV | cut -c3-8` rm PARINV if [ "${tmp}" = "" ] then BADINFO=1 echo echo "**********************************************************" echo "ERROR - Date not found in particle position file." echo " First date is $fdate [MMDDHH]" echo " Last date is $ldate [MMDDHH]" echo "**********************************************************" echo " DATE must be changed" echo "**********************************************************" echo fi #------ if [ ${BADINFO} -eq 1 ] then echo "ENTER NUMBER 5 (and 4,3,2 as needed) TO EDIT OR (X) to EXIT:" else echo "ENTER NUMBER TO EDIT OR (Y) TO ACCEPT VALUES OR (X) to EXIT:" fi echo " (X EXIT means no particle shift, neither ROTATION nor SHIFT, nor DELETE no matter what is shown)" read ans case $ans in 1) clear ;; 2) clear echo "ENTER YEAR (2-digits):" read kyr if [ $kyr -gt 99 ] then echo "ENTER YEAR with 2-digits" read kyr fi ;; 3) clear echo "ENTER MONTH (01,02...):" read kmo klen=`expr "$kmo" : ".*"` if [ $klen -eq 1 ]; then kmo="0"${kmo} fi ;; 4) clear echo "ENTER DAY (01,02...):" read kda klen=`expr "$kda" : ".*"` if [ $klen -eq 1 ]; then kda="0"${kda} fi ;; 5) clear echo "ENTER HOUR (00,01,02...UTC, 2-digits):" read khr klen=`expr "$khr" : ".*"` if [ $klen -eq 1 ]; then khr="0"${khr} fi ;; 6) clear window_menu_flag=1 while [ $window_menu_flag -ne 0 ] do # ======================================================== # Parameters to define the WINDOW # ======================================================== clear echo echo "VERIFY/EDIT PARAMETERS FOR PARSHIFT/DELETE WINDOW" echo " no checks are done to make sure these are reasonable" echo if [ "${WINDOW}" = "YES" ] then echo " Corner points of the window in which particles will be shifted/deleted" echo " (note default is globe, -90.0,-180.0,90.0,180.0)" echo " 1) LOWER-LEFT CORNER LATITUDE : $wlat1" echo " 2) LOWER-LEFT CORNER LONGITUDE : $wlon1" echo " 3) UPPER-RIGHT CORNER LATITUDE : $wlat2" echo " 4) UPPER-RIGHT CORNER LONGITUDE : $wlon2" echo " " echo " 5) RESET DEFAULTS (full globe) " echo fi echo "ENTER NUMBER TO EDIT OR (Y) TO ACCEPT VALUES:" read window_ans case $window_ans in 1) clear echo "ENTER LOWER-LEFT CORNER LATITUDE " echo " (-90.000 TO 90.000, south is negative, decimal degrees):" read wlat1 ;; 2) clear echo "ENTER LOWER-LEFT CORNER LONGITUDE " echo " (-180.000 to 180.000, west is negative, decimal degrees)" read wlon1 ;; 3) clear echo "ENTER UPPER-RIGHT CORNER LATITUDE " echo " (-90.000 TO 90.000, south is negative, decimal degrees):" read wlat2 ;; 4) clear echo "ENTER UPPER-RIGHT CORNER LONGITUDE " echo " (-180.000 to 180.000, west is negative, decimal degrees)" read wlon2 ;; 5) clear echo " (wlat1,wlon1,wlat2,wlon2)" echo "Current $wlat1 $wlon1 $wlat2 $wlon2" echo "Default $wlat1D $wlon1D $wlat2D $wlon2D" echo "Reset to defaults (y/n)?" read resetwin case ${resetwin} in Y|y) wlat1=$wlat1D wlon1=$wlon1D wlat2=$wlat2D wlon2=$wlon2D ;; esac ;; Y|y) window_menu_flag=0;; *) ;; esac done ;; 7) clear shift_menu_flag=1 while [ $shift_menu_flag -ne 0 ] do # ======================================================== # Parameters for SHIFT # ======================================================== clear echo echo "VERIFY/EDIT PARAMETERS FOR SHIFT" echo " no checks are done to make sure these are reasonable" echo if [ "${SHIFT}" = "YES" ] then echo " Horizontal vector shift in lat,lon units" echo " 1) HORIZONTAL SHIFT IN DEGREES LATITUDE : $dlatshift" echo " 2) HORIZONTAL SHIFT IN DEGREES LONGITUDE : $dlonshift" echo " " echo " 3) RESET DEFAULTS (no shift) " echo fi echo "ENTER NUMBER TO EDIT OR (Y) TO ACCEPT VALUES:" read shift_ans case $shift_ans in 1) clear echo "ENTER HORIZONTAL SHIFT COMPONENT IN DEGREES LATITUDE:" echo " (positive to north, negative to south)" echo " (decimal degrees)" read dlatshift ;; 2) clear echo "ENTER HORIZONTAL SHIFT COMPONENT IN DEGREES LONGITUDE:" echo " (positive to east, negative to west)" echo " (decimal degrees)" read dlonshift ;; 3) clear echo " (dlatshift,dlonshift)" echo "Current $dlatshift $dlonshift" echo "Default $dlatshiftD $dlonshiftD" echo "Reset to defaults (y/n)?" read resetwin case ${resetwin} in Y|y) dlatshift=$dlatshiftD dlonshift=$dlonshiftD ;; esac ;; Y|y) shift_menu_flag=0;; *) ;; esac done ;; 8) clear rotate_menu_flag=1 while [ $rotate_menu_flag -ne 0 ] do # ======================================================== # Parameters for ROTATE # ======================================================== clear echo echo "VERIFY/EDIT PARAMETERS FOR PARSHIFT ROTATION MODE" echo " no checks are done to make sure these are reasonable" echo echo " Particles will be rotated (angular shift) if they are within the shift-window" echo " Scan distance - distance from the centerpoint lat-lon within which particles are shifted (e.g. the shift-window)" echo " Positive rotation angle is clockwise" echo if [ "${ROTATION}" = "YES" ] then echo " 1) ROTATION ANGLE : $angle" echo " 2) SCAN DISTANCE (km): $scand" echo " 3) CENTERPOINT LATITUDE : $qlat" echo " 4) CENTERPOINT LONGITUDE : $qlon" echo " " echo " 5) RESET DEFAULTS (no shift) " echo fi echo "ENTER NUMBER TO EDIT OR (Y) TO ACCEPT VALUES:" read rotate_ans case $rotate_ans in 1) clear echo "ENTER ROTATION ANGLE (-180 to 180, positive clockwise):" read angle ;; 2) clear echo "ENTER SCAN DISTANCE (km, dist. from centerpoint to define shift-window):" read scand ;; 3) clear echo "ENTER ROTATION CENTERPOINT LATITUDE " echo " (-90.000 TO 90.000, south is negative, decimal degrees):" read qlat ;; 4) clear echo "ENTER ROTATION CENTERPOINT LONGITUDE " echo " (-180.000 to 180.000, west is negative, decimal degrees)" read qlon ;; 5) clear echo " (rotation angle,distance about centerlat,centerlon)" echo "Current $angle $scand $qlat $qlon" echo "Default $angleD $scandD $qlatD $qlonD" echo "Reset to defaults (y/n)?" read resetwin case ${resetwin} in Y|y) angle=$angleD scand=$scandD qlat=$qlatD qlon=$qlonD ;; esac ;; Y|y) rotate_menu_flag=0;; *) ;; esac done ;; 9) clear echo "Ash particle size bin for delete: $NUMP" echo " 0=all [default]," echo " 1=(0.6um)," echo " 2=(2.0um)," echo " 3=(6.0um)," echo " 4=(20.0um)" echo "Enter 0,1,2,3, or 4 (one number only)" read pbin case $pbin in 1|2|3|4) NUMP=$pbin;; *) NUMP=0;; esac ;; 10) clear if [ "${BLEND}" = "NO" ] then BLEND=YES elif [ "${BLEND}" = "YES" ] then BLEND=NO fi ;; X|x) echo "EXIT - no particle shift/delete" exit ;; Y|y) main_menu_flag=0 if [ ${BADINFO} -eq 1 ] then main_menu_flag=1 fi ;; *) ;; esac done # # # End of SDM prompts ################################### # # # put command line variables into one variable "param" and include in output filename # so user can look at filename and know what shifting was done # Use plus signs (+) to delimit the date/time for reading in setup_hysplit_script # if [ "${SHIFT}" = "YES" -o "${DELETE}" = "YES" ] then fout="+-t${kmo}${kda}${khr}+-w${wlat1}_${wlon1}_${wlat2}_${wlon2}" param="-i$pinpf -t${kmo}${kda}${khr} -w${wlat1}:${wlon1}:${wlat2}:${wlon2} -oPARSHIFT" if [ "${SHIFT}" = "YES" ] then fout="${fout}-x${dlonshift}-y${dlatshift}" param="${param} -x${dlonshift} -y${dlatshift}" elif [ "${DELETE}" = "YES" ] then fout="${fout}-d${NUMP}" param="${param} -d${NUMP}" fi elif [ "${ROTATION}" = "YES" ] then fout="+-t${kmo}${kda}${khr}+-r${angle}_${scand}_${qlat}_${qlon}" param="-i$pinpf -t${kmo}${kda}${khr} -r${angle}:${scand}:${qlat}:${qlon} -oPARSHIFT" else echo "ERROR - None of SHIFT, ROTATE, or DELETE is YES. No particle shift is run." echo " Rerun this script and try again." exit 1 fi if [ "${BLEND}" = "YES" ] then param="${param} -b" fout="${fout}.-b" # 1-10-2011 add -b to output filename fi if [ "${MFILE}" = "YES" ] then param="${param} -s" fi set -x rm -f PARSHIFT.001 rm -f PARSHIFT.002 rm -f PARSHIFT.003 rm -f PARSHIFT.004 rm -f PARSHIFT.005 rm -f PARSHIFT.006 rm -f PARSHIFT.007 rm -f PARSHIFT.008 ############################################################# # Execute hysplit_parshift ############################################################# $EXEChysplit/hysplit_parshift ${param} sleep 5 # if parshift successful, i.e. made PARINIT file, save and plot if [ -s PARSHIFT.001 ] then if [ "${SENDCOM}" = "YES" ] then # new 2-16-11 # get base part of filename from $pinpf_tmp # assume file is in /com/hysplit/XXXX/hysplit.YYYYMMDD/ (35 characters) klen_pinpf_tmp=`expr "${pinpf_tmp}" : ".*"` base=`echo ${pinpf_tmp} | cut -c36-${klen_pinpf_tmp}` # end 2-16-11 file_prefix=`echo ${pinpf} | cut -f1 -dPARDUMP` # includes $COMOUT if [ "${MFILE}" = "YES" ] then # cannot write to $COMOUT 2-16-11 #cp -p PARSHIFT.001 ${pinpf_tmp}.${fout}.PARSHIFT.001 # save PARINIT file #cp -p PARSHIFT.002 ${pinpf_tmp}.${fout}.PARSHIFT.002 #cp -p PARSHIFT.003 ${pinpf_tmp}.${fout}.PARSHIFT.003 #cp -p PARSHIFT.004 ${pinpf_tmp}.${fout}.PARSHIFT.004 #cp -p PARSHIFT.005 ${pinpf_tmp}.${fout}.PARSHIFT.005 #cp -p PARSHIFT.006 ${pinpf_tmp}.${fout}.PARSHIFT.006 #cp -p PARSHIFT.007 ${pinpf_tmp}.${fout}.PARSHIFT.007 #cp -p PARSHIFT.008 ${pinpf_tmp}.${fout}.PARSHIFT.008 cp -p PARSHIFT.001 ${base}.${fout}.PARSHIFT.001 # save PARINIT file cp -p PARSHIFT.002 ${base}.${fout}.PARSHIFT.002 cp -p PARSHIFT.003 ${base}.${fout}.PARSHIFT.003 cp -p PARSHIFT.004 ${base}.${fout}.PARSHIFT.004 cp -p PARSHIFT.005 ${base}.${fout}.PARSHIFT.005 cp -p PARSHIFT.006 ${base}.${fout}.PARSHIFT.006 cp -p PARSHIFT.007 ${base}.${fout}.PARSHIFT.007 cp -p PARSHIFT.008 ${base}.${fout}.PARSHIFT.008 #else # cp -p PARINIT ${pinpf_tmp}.${fout}.PARINIT # save PARINIT file fi if [ -f ${base}.${fout}.PARSHIFT.001 ] then echo "==========================================================" echo "Run setup_hysplit choosing file with this base name for STARTING INPUTS:" #echo " ${pinpf_tmp}.${fout}" echo " ${pinpf_tmp}" echo "Then choose this file written here for INITIALIZATION" #echo " ${pinpf_tmp}.${fout}.PARSHIFT.001" # 2-26-11 echo " ${GEShysplit}/${base}.${fout}.PARSHIFT.001" echo "==========================================================" fi fi # get shifted PARINIT for plotting if [ "${MFILE}" = "YES" ] then /meso/save/mgc0rd/nwprod/exec/hysplit_parmerge -iPARSHIFT -oPARINIT.tmp #else # cp PARINIT PARINIT.tmp fi # plot output shifted file cp /nwprod/fix/hysplit_arlmap arlmap $EXEChysplit/hysplit_parhplot -iPARINIT.tmp -oparshift.ps mv parshift.ps ${fout}.parshift.ps if [ "${SENDCOM}" = "YES" ] then cp -p ${fout}.parshift.ps ${base}.${fout}.parshift.ps fi else echo "ERROR - Shifted particle file not written" #pwd #ls -ltr exit 2 fi # this should stop automated runs # presumably this not apt to happen for the usual case of a user manually running it if [ ${BADINFO} -eq 1 ] then echo "ERROR - BADINFO=1 job will fail" exit 3 fi let LOOPNUM=${LOOPNUM}+1 done # end loop through number of times running executable hysplit_parshift exit