I have been running patching code for several years
and my first general comment is that realistic applications
often call for patches of different sizes and different shapes.
(Tutorial, non-interactive C code is poorly suited to this need.)
Raw seismic data in particular seems more suited to triangular shapes.
It is worth noting that the basic concepts in this chapter
have ready extension to other shapes.
a rectangular shape could be duplicated into two identical patches;
then data in one could be zeroed above the diagonal
and in the other below;
you would have to allow, of course, for overlap the size of the filter.
Module pef automatically ignores the zeroed portion
of the triangle,
and it is irrelevant what mis2()
does with a zeroed portion of data,
if a triangular footprint of weights is designed to ignore its output.
Code the linear operator
including its adjoint.
Some familiar operations can be seen in a new light when done in patches.
Patch the data.
In each patch,
find the mean value.
Replace each value by the mean value.
Reconstruct the wall.
Smoothing while filling missing data.
This is like smoothing,
but you set window weights to zero where there is no data.
Because there will be a
different set of weights in each window,
you will need to make a simple generalization to mkwallwt.
Divide the data into patches.
Compute the square root of the sum of the squares
of all the data in each patch.
Divide all values in that patch by this amount.