Waveform filter programs
tisli.f
Go to the documentation of this file.
1 c this is <tisli.f>
2 c------------------------------------------------------------------------------
3 c
4 c Copyright 1999, 2010 by Thomas Forbriger (IfG Stuttgart)
5 c
6 c write TIme SLIces
7 c
8 c ----
9 c This program is free software; you can redistribute it and/or modify
10 c it under the terms of the GNU General Public License as published by
11 c the Free Software Foundation; either version 2 of the License, or
12 c (at your option) any later version.
13 c
14 c This program is distributed in the hope that it will be useful,
15 c but WITHOUT ANY WARRANTY; without even the implied warranty of
16 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 c GNU General Public License for more details.
18 c
19 c You should have received a copy of the GNU General Public License
20 c along with this program; if not, write to the Free Software
21 c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 c ----
23 c
24 c REVISIONS and CHANGES
25 c 28/01/99 V1.0 Thomas Forbriger
26 c
27 c==============================================================================
28 c
29  program tisli
30 c
31  character*79 version
32  parameter(version='TISLI V1.0 write TIme SLIces')
33 c
34  integer maxsamples,nsamp,i, maxtraces, j, ntraces
35  parameter(maxsamples=4096,maxtraces=96)
36 c
37  real fdata(maxsamples, maxtraces)
38  integer idata(maxsamples, maxtraces)
39  equivalence(fdata,idata)
40 c
41  character*80 infile
42  character*80 outfile
43  character*80 outbase
44  character*4 outnum
45 c
46  integer luin, luout
47  parameter(luin=10, luout=11)
48 c
49  logical last
50 c
51  real tanf,dt,rdt,minval,maxval
52  real readversion
53  integer nstack,ierr,rnsamp
54  real c1(maxtraces), c2(maxtraces), c3(maxtraces)
55  character*1 cs
56  character*14 timestamp
57  character*10 code
58  character*132 wid2line
59 c commandline
60  integer maxopt, lastarg, iargc
61  character*80 argument
62  parameter(maxopt=3)
63  character*2 optid(maxopt)
64  character*40 optarg(maxopt)
65  logical optset(maxopt), opthasarg(maxopt)
66 c
67  logical logar
68 c debugging
69  logical debug, verbose
70 c here are the keys to our commandline options
71  data optid/2h-d, 2h-v, 2h-l/
72  data opthasarg/3*.false./
73  data optarg/3*1h-/
74 c
75 c------------------------------------------------------------------------------
76 c basic information
77 c
78 c
79  argument=' '
80  if (iargc().eq.1) call getarg(1, argument)
81  if ((argument(1:5).eq.'-help').or.(iargc().lt.1)) then
82  print *,version
83  print *,'Usage: tisli infile outbase [-l] [-v]'
84  print *,' or: tisli -help'
85  if (iargc().lt.1) stop 'ERROR: missing arguments'
86  print *,' '
87  print *,'write TIme SLIces'
88  print *,' '
89  print *,'infile input file containing data from'
90  print *,' array receivers'
91  print *,'outbase basename for output files'
92  print *,' '
93  print *,'-v be verbose'
94  print *,'-l output logarithmic values'
95  print *,' '
96  print *,'This program reads time series for receivers'
97  print *,'at different spatial locations (expected to'
98  print *,'cover an area in the manner of an array).'
99  print *,'For each time sample a separate ASCII output file'
100  print *,'is created (with basename ''outbase'') which'
101  print *,'contains instantaneous signal amplitude at the'
102  print *,'given location together with horizontal coordinates'
103  print *,'in an ASCII table. These files are meant to be input'
104  print *,'to further steps of processing (like graphical'
105  print *,'display).'
106  stop
107  endif
108 c
109 c------------------------------------------------------------------------------
110 c read command line arguments
111 c
112  call tf_cmdline(1, lastarg, maxopt, optid,
113  & optarg, optset, opthasarg)
114  debug=optset(1)
115  verbose=optset(2)
116  logar=optset(3)
117 c
118  call getarg(1, infile)
119  call getarg(2, outbase)
120 c
121 c------------------------------------------------------------------------------
122 c go
123 c
124  call sff_ropen(luin, infile, readversion, timestamp, code, ierr)
125  if (ierr.ne.0) stop 'ERROR: opening input file'
126 c
127  last=.false.
128  ntraces=0
129  do while(.not.(last))
130  ntraces=ntraces+1
131  if (i.gt.maxtraces) stop 'ERROR: too many traces'
132  nsamp=maxsamples
133  call sff_rtracei(luin, tanf, dt,
134  & wid2line, nsamp, fdata(1,ntraces), idata(1,ntraces), code, last,
135  & cs, c1(ntraces), c2(ntraces), c3(ntraces), nstack, ierr)
136  if (ierr.ne.0) stop 'ERROR: reading input file'
137  if (cs.ne.'C') stop 'ERROR: wrong coordinate system'
138  if (j.gt.1) then
139  if (dt.ne.rdt) stop 'ERROR: inconsistent sampling rates'
140  if (nsamp.ne.rnsamp) stop 'ERROR: inconsistent number of samples'
141  else
142  rdt=dt
143  rnsamp=nsamp
144  endif
145  enddo
146 c
147  minval=fdata(1,1)
148  maxval=fdata(1,1)
149 c
150  do i=1,nsamp
151  write(outnum, '(i4.4)') i
152  outfile=outbase(1:index(outbase, ' ')-1)//'.'//outnum
153  open(luout, file=outfile, err=99)
154  do j=1,ntraces
155  if (logar) fdata(i,j)=log(abs(fdata(i,j)))
156  write(luout, '(3(g15.8,2x))', err=97) c1(j), c2(j), fdata(i,j)
157  minval=min(minval,fdata(i,j))
158  maxval=max(maxval,fdata(i,j))
159  enddo
160  close(luout, err=98)
161  enddo
162 c
163  print 50,minval,maxval,(minval+maxval)*0.5,
164  & (maxval-minval)*0.1,10,(minval+maxval)*.5
165 c
166  stop
167  50 format('minimum: ',g15.8,' maximum: ',g15.8,' mean: ',g15.8,/
168  & '"-C',e15.10,'" -S',i3.3,' "-M',e15.10,'"')
169  99 stop 'ERROR: opening input file'
170  98 stop 'ERROR: closing input file'
171  97 stop 'ERROR: writing input file'
172  end
173 c
174 c ----- END OF tisli.f -----
program tisli
Definition: tisli.f:29