# Re: Smoothing

```On Dec 12,  8:25am, cortinas@manassas.nssl.uoknor.edu wrote:
> Subject: Smoothing
> Is there a way to smooth a 2-D plot (contour,fill)?  It appears
> that the smoothing transformations only work with 1-D plots.
>
> Thanks,
> John Cortinas
> cortinas@nssl.ou.edu
>-- End of excerpt from cortinas@manassas.nssl.uoknor.edu

Hi John,

Ferret's smoothing transformations can get applied to 1, 2, 3, or 4 axes. The
choice of smoothing is independent of the plotting or listing command you use.

Below is a cut-and-paste from the on-line Ferret Users' Guide. (The version 3.2
Users' Guide, that is. The V4.4 UG is available as PostScript, only, at this
time. January for the on-line version.)

- steve

=================================================================

*** 2.5.2   General information about smoothing transformations ***

FERRET provides several transformations for smoothing variables (removing
high frequency variability).  These transformations replace each value
on the grid to which they are applied with a weighted average of the
surrounding data values along the axis specified.  For example, the
expression u[T=@SPZ:3] replaces the value at each (I,J,K,L) grid point
of the variable"u" with the weighted average -

u at t = 0.25*(u at t-1) + 0.5*(u at t) + 0.25*(u at t+1)

The various choices of smoothing transformations (@SBX, @SBN, @SPZ, @SHN,
@SWL) represent different shapes of weighting functions or "windows" with
which the original variable is convolved.  New window functions can be
obtained by nesting the simple ones provided.  For example, using the
definitions

yes? LET ubox = u[L=@SBX:15]
yes? LET utaper = ubox[L=@SHN:7]

produces a 21 point window whose shape is a boxcar (constant weight) with
COSINE (Hanning) tapers at each end.

FERRET may be used to directly examine the shape of any smoothing window:
Mathematically, the shape of the smoothing window can be recovered as a
variable by convolving it with a delta function.  In the example below
we examine (PLOT) the shape of a 15 point Welch window (Fig. 8).

! define X axis as [-1,1] by 0.2
yes? GO unit_square
yes? SET REGION/X=-1:1
yes? LET delta = IF X EQ 0 THEN 1 ELSE 0
! convolve delta with Welch window
yes? PLOT delta[I=@SWL:15]

```

Dept of Commerce / NOAA / OAR / ERL / PMEL / TMAP