source: SH_SHM/trunk/util/shm_exec_hypocenter @ 350

Revision 350, 2.3 KB checked in by marcus, 12 years ago (diff)

r188 | klaus | 2011-03-17 15:23:12 +0100 (Do, 17 Mär 2011) | 1 line

small changes in station settings; new hypocenter path

  • 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_INPUTS/hypocenter_velmod_$modelname.dat)  then
52        set velmod=$SH_INPUTS/hypocenter_velmod_$modelname.dat
53else
54        set velmod=$SH_INPUTS/hypocenter_velmod.dat
55endif
56echo "Hypocenter: using velocity model $velmod"
57
58# create file STATION0.HYP
59if  (-e $hyphead)  \rm $hyphead
60touch $hyphead
61echo "RESET TEST(13)=2.0"            >>$hyphead
62echo ""                              >>$hyphead
63set slist=`grep 'Station code' $evtfile | awk '{print $4}' | sort -u`
64foreach s ($slist)
65        $SH_UTIL/statinf -hypocenter $s   >>$hyphead
66end
67echo ""                              >>$hyphead
68cat $velmod                          >>$hyphead
69echo ""                              >>$hyphead
70echo " 5.0 1100.2200. 1.74"          >>$hyphead
71
72# check for IASP91 model
73if  (! -e IASP91.HED)  ln -s $SH_INPUTS/IASP91.HED IASP91.HED
74if  (! -e IASP91.TBL)  ln -s $SH_INPUTS/IASP91.TBL IASP91.TBL
75
76# call hypocenter
77if  (-e $hyplog)  \rm $hyplog
78$hypexec <<END >& $hyplog
79$hypoin
80n
81END
82
83if  (-e hypout.evt)  \rm hypout.evt
84$SH_UTIL/ev4hypocenter print.out hypsum.out hypout.evt hypview.txt
85
86# if something went wrong, get at least back the input data
87if  (! -e hypout.evt)  then
88        cp $evtfile hypout.evt
89else if  (-z hypout.evt)  then
90        cp $evtfile hypout.evt
91else
92        set num=`grep -c 'Station code' hypout.evt`
93        if  ($num < 2)  cp $evtfile hypout.evt
94endif
95
96$SH_TEXTEDIT hypview.txt &
Note: See TracBrowser for help on using the repository browser.