Commit 3f05f0ff authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[WP][!!!] (issue7 refract): provide new function refract_avgamp

Provide new function to calculate average scaled amplitude to algorithm in
subroutine mpcfactors.

This version does not yet compile.
parent 674ac6da
......@@ -25,5 +25,61 @@ c 07/12/2015 V1.0 Thomas Forbriger
c
c ============================================================================
c
cS
real function refract_avgamp(ifile, allfiles)
c
integer ifile
logical allfiles
c
c Return average amplitude for traces in file ifile in amplitude
c reference range.
c
c ifile: file index of file to calculate average amplitude for
c allfiles: use all files not just file ifile
c
c return: average scaled amplitude value
cE
c
include 'refract_dim.inc'
include 'refract_data.inc'
include 'refract_para.inc'
c
integer navg, j
real maxamp, thisamp
logical usefile
c
navg=0
maxamp=0.
do j=1,ntraces
usefile=allfiles
if (.not.usefile) usefile=(fileindex(j).eq.ifile)
if (usefile
& .and.(fieldoffset(j).ge.plpar_avgrefxmin)
& .and.(fieldoffset(j).le.plpar_avgrefxmax)) then
navg=navg+1
if (plpar_remav) then
thisamp=max(abs(maxval(j)-average(j)),
& abs(minval(j)-average(j)))
else
thisamp=max(abs(maxval(j)),abs(minval(j)))
endif
maxamp=maxamp+thisamp*(fieldoffset(j)**plpar_expo)
endif
enddo
if (navg.lt.1) then
if (allfiles) then
print *,'ERROR (refract_avgamp): ',
& 'no traces in offset range selected by -S3 or -SN'
else
print *,'ERROR (refract_avgamp): ',
& 'file ',filename(ifile)(1:index(filename(ifile),' ')-1),
& ' has no traces in offset range selected by -S3 or -SN'
endif
stop 'aborting...'
endif
refract_avgamp=maxamp/navg
c
return
end
c
c ----- END OF sub/refract_avgamp.f -----
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment