#! /bin/csh -f # preparing a GAMIT processing session according to user's specs # the preparation includes # link GAMIT tables # prepare session # get/convert EOP # get/convert broadcast/precise orbits # by pfang@ucsd.edu Oct 96 # set defaults set elink = "" set regfile = "" set setup = /usr/local/processing/gamit_setup set work = . # sort user inputs foreach a ($argv) switch($a) case -el: # executable link (optional) set elink = $argv[2] breaksw case -r: # registration file name set regfile = $argv[2] breaksw case -pre: # pre handling echo $argv | cut -d- -f2 | sed -e "s/pre//" -e "s/%/-/g" >> pre.bat breaksw case -post: # post handling echo $argv | cut -d- -f2 | sed -e "s/post//" -e "s/%/-/g" >> post.bat breaksw case -eop: # EOP handling script echo $argv | cut -d- -f2 | sed -e "s/eop//" -e "s/%/-/g" >> eop.bat breaksw case -orb: # orbit handling script echo $argv | cut -d- -f2 | sed -e "s/orb//" -e "s/%/-/g" >> orb.bat breaksw case -w: # working directory (REQUIRED AND MUST BE THE FIRST ARGUMENT) set work = $argv[2] if (! -e $work) then mkdir $work if ($status != 0) then echo "FATAL: can not create $work directory. STOP" exit endif endif cd $work echo "#\!/bin/csh -f" >! pre.bat; chmod +x pre.bat echo "#\!/bin/csh -f" >! post.bat; chmod +x post.bat if (! -e eop.bat) then echo "#\!/bin/csh -f" >! eop.bat; chmod +x eop.bat endif if (! -e orb.bat) then echo "#\!/bin/csh -f" >! orb.bat; chmod +x orb.bat endif breaksw case -s: # session info set sess = (`echo $argv | cut -d- -f2 | sed -e "s/s//"`) @ yy = $sess[1] % 100 @ yr1 = $yy % 10 breaksw endsw shift end # basic checking if ($#sess < 2) then echo "FATAL: missing session specifiction. STOP" exit 1 endif foreach f ($regfile $setup) if (! -e $f) then echo "FATAL: $f not found, STOP" exit 1 endif end # register \rm sess_mk.done set myname = (`echo $0 | tr '/' ' '`) while (-e $regfile.lock) sleep 1 end echo "`hostname` $$ $myname[$#myname] $work `date`" >> $regfile # pre handling csh pre.bat if ($status) then echo "FATAL: pre.bat failed, STOP" exit 1 endif # link GAMIT tables /net/josh9/matthijs/csrc/yolo/1999/bin/link_tab $sess # link GAMIT executables (OPTIONAL) $elink # get/convert EOP set yn = `cat eop.bat | wc -l` if ($yn < 2) then echo "WARNING: Use default EOP series instead" else csh eop.bat if ($status) then echo "FATAL: eop.bat failed, STOP" exit 1 endif endif # get/convert orbits csh orb.bat if ($status) then echo "FATAL: orb.bat failed, STOP" exit 1 endif # exclude satellite # make jfile makej << EOF_makej 1 jcomm$yr1.$sess[2] n ecomm$yr1.$sess[2] EOF_makej if ($status) then echo "FATAL: makej failed, STOP" exit 1 endif # generate lfile gapr_to_l vg_in lcomm$yr1.$sess[2] long.in $yy $sess[2] if ($status) then echo "FATAL: gapr_to_l failed, STOP" exit 1 endif # post handling (optional shell script to do extra items) csh post.bat if ($status) then echo "FATAL: post.bat failed, STOP" exit 1 endif # put a ready mark chmod a+w * touch sess_mk.done # deregister while (-e $regfile.lock) sleep 1 end grep -v "`hostname` $$" $regfile >! $regfile.lock \mv $regfile.lock $regfile