source: SH_SHM/trunk/util/shm_exec_hypocenter @ 362

Revision 362, 2.5 KB checked in by marcus, 12 years ago (diff)

r196 | klaus | 2011-04-04 12:22:37 +0200 (Mo, 04 Apr 2011) | 1 line

shm_exec_hypocenter: check for velocity model in private directory; set vp/vs ratio to 2.0 (!)

  • Property svn:executable set to *
Line 
1#! /bin/csh
2#
3# file shm_exec_hypocenter
4#      ===================
5#
6# version 3, 15-Nov-2004
7#
8# Execute hypocenter program on picked phases
9# K. Stammler, 11-Mar-2003
10
11if  ("$1" == "")  then
12        echo "Usage: $0 <evtfile>"
13        exit
14endif
15
16# get parameters
17set evtfile=$1
18
19# set constants
20set hypexec=/programs/linux/bin/hyp
21#set hypiasp=/programs/sol2/hypocenter/DAT
22set hypoin=hypocenter-in.dat
23set hyphead=STATION0.HYP
24set hyplog=hyp.log
25
26if  (! -e $evtfile)  then
27        echo "$0 : Input file $evtfile not found.  Abort."
28        exit
29endif
30
31cd $SH_SCRATCH
32
33# check depth type
34set depqual=""
35set res=`grep 'Depth type' $evtfile`
36if  ($#res == 5)  then
37        if  ($res[5] == "preset")  then
38                set res=`grep 'Depth (km)' $evtfile`
39                if  ($#res == 4)  then
40                        set depqual="-d=$res[4]"
41                endif
42        endif
43endif
44
45if  (-e $hypoin)  \rm $hypoin
46$SH_UTIL/ev2hypocenter $depqual -a $evtfile $hypoin
47
48# check for velocity model
49set modelname=""
50if  (-e table_prefix.txt)  set modelname=`cat table_prefix.txt`
51if (-e $SH_USERDIR/hypocenter_velmod_$modelname.dat) then
52        set velmod=$SH_USERDIR/hypocenter_velmod_$modelname.dat
53else if  (-e $SH_INPUTS/hypocenter_velmod_$modelname.dat)  then
54        set velmod=$SH_INPUTS/hypocenter_velmod_$modelname.dat
55else
56        set velmod=$SH_INPUTS/hypocenter_velmod.dat
57endif
58echo "Hypocenter: using velocity model $velmod"
59
60# create file STATION0.HYP
61if  (-e $hyphead)  \rm $hyphead
62touch $hyphead
63#echo "RESET TEST(13)=2.0"            >>$hyphead
64echo "RESET TEST(13)=0.5"            >>$hyphead
65#echo "RESET TEST(40)=1.0"            >>$hyphead
66echo ""                              >>$hyphead
67set slist=`grep 'Station code' $evtfile | awk '{print $4}' | sort -u`
68foreach s ($slist)
69        $SH_UTIL/statinf -hypocenter $s   >>$hyphead
70end
71echo ""                              >>$hyphead
72cat $velmod                          >>$hyphead
73echo ""                              >>$hyphead
74echo " 4.0 1100.2200. 2.00"          >>$hyphead
75
76# check for IASP91 model
77if  (! -e IASP91.HED)  ln -s $SH_INPUTS/IASP91.HED IASP91.HED
78if  (! -e IASP91.TBL)  ln -s $SH_INPUTS/IASP91.TBL IASP91.TBL
79
80# call hypocenter
81if  (-e $hyplog)  \rm $hyplog
82$hypexec <<END >& $hyplog
83$hypoin
84n
85END
86
87if  (-e hypout.evt)  \rm hypout.evt
88$SH_UTIL/ev4hypocenter print.out hypsum.out hypout.evt hypview.txt
89
90# if something went wrong, get at least back the input data
91if  (! -e hypout.evt)  then
92        cp $evtfile hypout.evt
93else if  (-z hypout.evt)  then
94        cp $evtfile hypout.evt
95else
96        set num=`grep -c 'Station code' hypout.evt`
97        if  ($num < 2)  cp $evtfile hypout.evt
98endif
99
100$SH_TEXTEDIT hypview.txt &
Note: See TracBrowser for help on using the repository browser.