Commit a980a38d authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[WP][!!!] (issue7 refract): adjust subroutine mpcfactors

Let subroutine mpcfactors select scaling factors relative of average scaled
amplitude in defined offset range for scaling mode 2 and 3, both.

This version does not yet compile.
parent 3f05f0ff
......@@ -47,7 +47,7 @@ c
cE
integer i,j,tref
real trefoff, refmpc, maxamp, thisamp
c real avgoff
real refract_avgamp
c
c scaling mode 1: individual scaling
c ----------------------------------
......@@ -68,22 +68,8 @@ c
c scaling mode 2: least offset trace is reference
c -----------------------------------------------
elseif (plpar_mode.eq.2) then
c find trace with least fieldoffset
tref=1
trefoff=fieldoffset(1)
do j=1,ntraces
if (fieldoffset(j).lt.trefoff) then
tref=j
trefoff=fieldoffset(j)
endif
enddo
c calculate reference scale
if (plpar_remav) then
maxamp=max(abs(maxval(tref)-average(tref)),
& abs(minval(tref)-average(tref)))
else
maxamp=max(abs(maxval(tref)),abs(minval(tref)))
endif
j=1
maxamp=refract_avgamp(j, .true.)
refmpc=plpar_amp/(fieldoffset(tref)**plpar_expo)/maxamp
c set mpc factors
do j=1,ntraces
......@@ -96,65 +82,8 @@ c -------------------------------------------------------------------
elseif (plpar_mode.eq.3) then
c go for files
do i=1,nfiles
c print *,'ifile ',i
if (plflag_m3avg) then
c refer scaling to amplitude average in given offset range
navg=0
maxamp=0.
c avgoff=0.
do j=1,ntraces
c print *,'itrace ',j,' offset ',fieldoffset(j)
if ((fileindex(j).eq.i)
& .and.(fieldoffset(j).ge.plpar_m3avgxmin)
& .and.(fieldoffset(j).le.plpar_m3avgxmax)) 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)
c avgoff=avgoff+fieldoffset(j)
endif
enddo
if (navg.lt.1) then
print *,'ERROR (mpc): ',
& 'file ',filename(i)(1:index(filename(i),' ')-1),
& ' has no traces in offset range selected by -S3'
stop 'aborting...'
endif
maxamp=maxamp/navg
c avgoff=avgoff/navg
refmpc=plpar_amp/maxamp
else
c refer scaling to nearest offset trace
c find trace with least fieldoffset within file
tref=0
do j=1,ntraces
if (fileindex(j).eq.i) then
if (tref.eq.0) then
tref=j
trefoff=fieldoffset(j)
else
if (fieldoffset(j).lt.trefoff) then
tref=j
trefoff=fieldoffset(j)
endif
endif
endif
enddo
if (debug) print *,'DEBUG: file ',i,' tref ',tref,
& ' trefoff ',trefoff
c calculate reference scale with respect to total reference
if (plpar_remav) then
maxamp=max(abs(maxval(tref)-average(tref)),
& abs(minval(tref)-average(tref)))
else
maxamp=max(abs(maxval(tref)),abs(minval(tref)))
endif
refmpc=plpar_amp/(maxamp*(fieldoffset(tref)**plpar_expo))
endif
maxamp=refract_avgamp(i, .false.)
refmpc=plpar_amp/maxamp
c set mpc factors within file
do j=1,ntraces
if (fileindex(j).eq.i) then
......
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