|
Gri Commands
|
12.44: The `
|
`smooth {x [.n.]} \
| {y [.n.]} \
| {grid data [.f.|{along x|y}]}'
|
The `smooth x' command does smoothing by the following formula
x[i-1] x[i] x[i+1] ------ + ---- + ------ 4 2 4 |
The `smooth x .n.' command does boxcar smoothing using centred
boxcars `.n.' points wide.
The `smooth y' command does the same as `smooth x', but on the
`y' column.
There are several methods of smoothing grid data. Note that isolated missing values are filled in by each method. (Let the author know if you'd like that `feature' to be an option.)
The `smooth grid data' command smooths gridded data, by weighted
average in a plus-shaped window about each gridpoint. The smoothing
algorithm replaces each interior gridpoint value `z[i][j]' by
z[i][j] z[i-1][j] + z[i+1][j] + z[i][j-1] + z[i][j+1] ------- + --------------------------------------------- 2 8 |
Points along the edges are smoothed by the same formula, after inventing image points outside the domain by planar extrapolation.
The `smooth grid data .f.' command performs partial smoothing. A
temporary fully-smoothed grid `zSMOOTH[i][h]' is constructed as
above, and a linear combination of this grid and the original grid is
used as the replacement grid:
z[i][j] = (1-f) * z[i][j] + f * zSMOOTH[i][j] |
where `f' is the value indicated on the command line.
Thus, `smooth grid data 0' performs no smoothing at all, while
`smooth grid data 1' is equivalent to `smooth grid data'.
The `smooth grid data along x' command smooths the grid data
across `x' (i.e., horizontally), by replacing each value
`z[i][j]' with the value
z[i][j] z[i-1][j] + z[i+1][j] ------- + --------------------- 2 4 |
Points along the edges are smoothed by the same formula, after inventing image points outside the domain by linear extrapolation.
The `smooth grid data along y' command does the same thing as
`smooth grid data along x', but the smoothing is along `y'.
See also see Filter, a generalization of `smooth x|y'
which allows for more sophisticated filters.