33 parameter(version=
'CORO V1.1 seismogram COmponent ROtation')
36 integer maxsamps, maxfree
37 parameter(maxsamps=66000, maxfree=20)
44 real xdata(maxsamps), ydata(maxsamps), zdata(maxsamps)
45 integer ixdata(maxsamps), iydata(maxsamps), izdata(maxsamps)
46 equivalence(xdata,ixdata)
47 equivalence(ydata,iydata)
48 equivalence(zdata,izdata)
49 character*80 inxname, inyname, inzname
51 parameter(lux=10, luy=11, luz=12)
54 integer idata(maxsamps)
55 equivalence(
data,idata)
57 character*132 wid2line
61 character*80 free(maxfree)
64 character timestamp*13, code*10, type*20, cs*1, date*6, time*10
65 character code2*10, cs2*1
66 real c1,c2,c3,c12,c22,c32
67 integer ierr,nsamp,nsamp2,nstack,nstack2
70 character*132 wid2line2
73 integer maxopt, lastarg, iargc
75 character*2 optid(maxopt)
76 character*40 optarg(maxopt)
77 logical optset(maxopt), opthasarg(maxopt)
82 data opthasarg/.false.,.true./
83 data optarg/1h-,3hnsp/
89 print *,
'Usage: coro x,y,z inx iny inz out [-n name]' 90 print *,
' or: coro -help' 92 if (iargc().lt.1) stop
'ERROR: missing arguments' 94 if (para(1:5).eq.
'-help')
then 96 print *,
'seismogram COmponent ROtation' 98 print *,
'x,y,z components of a vactor that defines the' 99 print *,
' direction of the resulting component' 100 print *,
'inx filename of input seismograms for x-component' 101 print *,
'iny filename of input seismograms for y-component' 102 print *,
'inz filename of input seismograms for z-component' 103 print *,
'out filename of output seismograms' 105 print *,
'-n name set name of new component' 107 print *,
'All information about source and receiver location will' 108 print *,
'be taken from inx. No plausibility checks are performed!' 116 call tf_cmdline(6, lastarg, maxopt, optid,
117 & optarg, optset, opthasarg)
122 call getarg(2, inxname)
123 call getarg(3, inyname)
124 call getarg(4, inzname)
125 call getarg(5, outname)
130 read(para, *) vx,vy,vz
131 amp=sqrt(vx*vx+vy*vy+vz*vz)
137 write(free(2),
'(3hvx=,f10.6,2x,3hvy=,f10.6,2x,3hvz=,f10.6)')
139 free(3)=
'x-data from '//inxname(1:index(inxname,
' '))
140 free(4)=
'y-data from '//inyname(1:index(inyname,
' '))
141 free(5)=
'z-data from '//inzname(1:index(inzname,
' '))
142 free(6)=
'all information is taken from x-data file' 143 free(7)=
'no plausibility checks were performed' 146 call sff_ropens(lux, inxname,
147 & libversion, timestamp, code,
148 &
type, cs, c1, c2, c3, date, time, ierr)
149 if (ierr.ne.0) stop
'ERROR: opening x-component' 150 call sff_new(luo, outname, ierr)
151 call sff_wopenfs(luo, outname,
153 &
type, cs, c1, c2, c3, date, time, ierr)
154 if (ierr.ne.0) stop
'ERROR: opening output file' 155 call sff_ropens(luy, inyname,
156 & libversion, timestamp, code,
157 &
type, cs, c1, c2, c3, date, time, ierr)
158 if (ierr.ne.0) stop
'ERROR: opening y-component' 159 call sff_ropens(luz, inzname,
160 & libversion, timestamp, code,
161 &
type, cs, c1, c2, c3, date, time, ierr)
162 if (ierr.ne.0) stop
'ERROR: opening z-component' 165 do while (.not.(last))
167 call sff_rtracei(lux, tanf, dt, wid2line, nsamp, xdata, ixdata,
168 & code, last, cs, c1, c2, c3, nstack, ierr)
169 if (ierr.ne.0) stop
'ERROR: reading x-data' 171 call sff_rtracei(luy, tanf, dt, wid2line2, nsamp2, ydata, iydata
173 if (ierr.ne.0) stop
'ERROR: reading y-data' 174 if (nsamp.ne.nsamp2) stop
'ERROR: wrong number of samples in y-data' 177 call sff_rtracei(luz, tanf, dt, wid2line2, nsamp2, zdata, izdata
179 if (ierr.ne.0) stop
'ERROR: reading z-data' 180 if (nsamp.ne.nsamp2) stop
'ERROR: wrong number of samples in z-data' 184 data(i)=vx*xdata(i)+vy*ydata(i)+vz*zdata(i)
186 wid2line(36:38)=compname(1:3)
188 call sff_wtracei(luo, wid2line, nsamp,
data, idata, last,
189 & cs, c1, c2, c3, nstack, ierr)
190 if (ierr.ne.0) stop
'ERROR: writing trace'