34 &
'SMOOS V1.1 SMOOth Seismograms by sectral extension')
37 character*80 infile, outfile, nstring
39 parameter(luin=10, luout=11)
41 integer msamp, nsamp, i
42 parameter(msamp=200000)
44 integer nfac, npow, powsamp, newpowsamp
45 complex*16 spect(msamp)
46 real*8 singback, singto
47 parameter(singback=1.d0, singto=-1.d0)
49 integer mfree, nfree, ntrace
53 character timestamp*16, code *10
54 character*80 free(mfree)*80
55 character type*25, date*8, time*12, cs*1
57 integer idata(msamp), nstack
58 real fdata(msamp), dt, tanf
59 equivalence(fdata,idata)
61 character wid2line*132
63 integer maxopt, lastarg, iargc
66 character*2 optid(maxopt)
67 character*40 optarg(maxopt)
68 logical optset(maxopt), opthasarg(maxopt)
73 data opthasarg/.false./
80 print *,
'Usage: smoos infile outfile n' 81 print *,
' or: smoos -help' 83 if (iargc().lt.1) stop
'ERROR: missing arguments' 84 call getarg(1, argument)
85 if (argument(1:5).eq.
'-help')
then 87 print *,
'SMOOth Seismograms by sectral extension' 91 if (iargc().ne.3) stop
'ERROR: wrong number of arguments' 96 call tf_cmdline(1, lastarg, maxopt, optid,
97 & optarg, optset, opthasarg)
99 call getarg(1, infile)
100 call getarg(2, outfile)
101 call getarg(3, nstring)
102 read(nstring, *) nfac
108 print *,
'open file ',infile(1:index(infile,
' '))
109 call sff_ropenfs(luin, infile,
110 & libversion, timestamp, code,
111 & nfree, free, lenmax, mfree,
112 &
type, cs, c1, c2, c3, date, time, ierr)
113 if (ierr.ne.0) stop
'ERROR: opening input file' 114 if (lenmax.gt.80) print *,
'WARNING: ',
115 &
'FREE lines read are longer than 80 characters - ',
118 if (nfree.lt.mfree)
then 123 print *,
'open file ',outfile(1:index(outfile,
' '))
124 if (index(code,
'S').gt.0)
then 125 call sff_wopenfs(luout, outfile,
127 &
type, cs, c1, c2, c3, date, time, ierr)
129 call sff_wopenf(luout, outfile, free, nfree, ierr)
131 if (ierr.ne.0) stop
'ERROR: opening output file' 138 print *,
'work on trace ',ntrace
139 call sff_rtracefi(luin, tanf, dt,
140 & wid2line, nsamp, fdata, idata, code, last,
141 & nfree, free, mfree, lenmax,
142 & cs, c1, c2, c3, nstack, ierr)
143 if (ierr.ne.0) stop
'ERROR: reading trace' 144 if (lenmax.gt.80) print *,
'WARNING: ',
145 &
'FREE lines read are longer than 80 characters - ',
156 do while (powsamp.lt.nsamp)
160 newpowsamp=2**(npow+nfac)
161 if (newpowsamp.gt.msamp)
then 162 print *,
'ERROR: dataset has ',nsamp,
' samples' 163 print *,
'ERROR: new number of samples should be ',newpowsamp
164 print *,
'ERROR: array size is ',msamp
168 print *,
'extending from ',nsamp,
' to ',newpowsamp,
' samples' 169 print *,
'using ',powsamp,
' samples for the first stage' 173 spect(i)=dcmplx(fdata(i))
175 if (nsamp.gt.powsamp)
then 180 call tf_dfork(powsamp, spect, singback)
184 spect(newpowsamp-i)=spect(powsamp-i)
186 do i=powsamp/2+2,newpowsamp-powsamp/2
189 call tf_dfork(newpowsamp, spect, singto)
191 fdata(i)=sngl(
real(spect(i)))*2.**(float(nfac)/2.)
194 call sff_modwid2samps(wid2line, nsamp)
196 call sff_modwid2samprat(wid2line, 1./dt)
198 if (nfree.lt.mfree)
then 200 write(free(nfree), 50) npow, npow+nfac
203 if (index(code,
'I').gt.0)
then 204 call sff_wtracefi(luout,
205 & wid2line, nsamp, fdata, idata, last,
207 & cs, c1, c2, c3, nstack, ierr)
209 call sff_wtracef(luout,
210 & wid2line, nsamp, fdata, idata, last,
211 & nfree, mfree, ierr)
213 if (ierr.ne.0) stop
'ERROR: writing trace' 217 50
format(
'extended number of samples from 2**',i5,
' to 2**',i5)