.
Given a data plane, this subroutine finds a filter that tends
to whiten the spectrum of that data plane.
The output is white residual.
Now suppose we have a data plane where the dip spectrum
is changing from place to place.
Here it is natural to apply subroutine pef2() in local patches.
This is done by subroutine lopef2().
First it builds the tent weights and erases the output residual.
Then it loops over all patches.
Then it calls pef2()
to get the prediction residual for the patch.
Next, to weight the residual by the window weight
diag()
is used,
and the patches are reassembled.
Finally the wall weight multiplies the reassembly,
so that patch overlap is accounted for.
# lopef2 -- LOcal Prediction Error Filter in 2-D
#
subroutine lopef2( data, resi, n1,n2,w1,w2,k1,k2, niter, lag1,lag2, afre, a1,a2)
integer i1,i2, n1,n2,w1,w2,k1,k2, niter, lag1,lag2, a1,a2
real data(n1,n2),resi(n1,n2), afre(a1,a2)
temporary real wallwt(n1,n2), aa( a1,a2)
temporary real pdata(w1,w2), presi(w1,w2), windwt(w1,w2)
call tent2( a1,a2, lag1,lag2, windwt,w1,w2)
call null( resi, n1*n2)
do i2= 1, k2 {
do i1= 1, k1 {
call patch2( 0,0, i1,i2,k1,k2, data,n1,n2,pdata, w1,w2)
call pef2( pdata,presi, w1,w2, niter,lag1,lag2,afre,aa,a1,a2)
call diag( 0, 0, windwt, w1*w2, presi,presi )
call patch2( 1,1, i1,i2,k1,k2, resi,n1,n2,presi, w1,w2)
}}
call mkwallwt2( k1,k2, windwt, w1,w2, wallwt, n1,n2)
call diag ( 0, 0, wallwt, n1*n2, resi, resi )
return; end
The output of lopef2() is necessarily zero around some of its outer periphery because that of pef2() is so. The output borders necessarily have some zeros because filter outputs are smaller than the inputs. Where this happens, I usually replace the (zero) output by the input (scaled by the variance ratio).