# 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).