Roberts - Roberts 1978 JGR

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

VOL. 83, NO.

CII JOURNAL OF GEOPHYSICAL RESEARCH NOVEMBER 20, 1978

Use of the Butterworth Low-PassFilter for OceanographicData


Jo ROBERTS

Instituteof Marine Science,Universityof Alaska, Fairbanks,Alaska 99701

THOMAS D. ROBERTS

Departmentof ElectricalEngineering,Universityof Alaska, Fairbanks,Alaska 99701

The characteristicsof the Butterworthlow-passfilter are well knownin electricalengineering.Here we


discussits usefor oceanographic recordsand compareits characteristics with otherlow-passfiltersnowin
use:the cosine-Lanczosfilter, the Gaussianfilter, and the ideal filter. The Butterworth filter is recursire,
i.e., past valuesof the outputare usedas input, soa phaseshiftis introducedunlessthe data are filtered
forwardand backwardthroughthe samefilter. When this is done,the filteredsignaldiffersonly slightly
from that of other low-passfilters.Becausethe Butterworthfilter usesfewermultiplicativeconstantsfor
the sameeffect,thereis a reductionin computertime over other low-passfilters;the differencebecomes
more pronouncedas more data pointsare used.

The interpretation of geophysicaldata is often aided by 1

numericalfiltering. One exampleof a low-passdigital filter, IH•U,o)I


'= 1+ (,o/,o,)
,- (1)
familiar to anyone who has ever 'smoothed'data, is a simple
whereo•, is the cutoff frequency,j = (- 1)•/2,and n is the num-
running averagewhich can be used to discriminateagainst
high-frequencycomponents.A goodlow-passfilter should(1) ber of poles,or order, of the filter. The larger the order, the
have a sharp cutoff, so that all undesirablehigh-frequency sharperthe cutoff. The subscriptB denotesthe Butterworth
componentsare effectivelyremoved;(2) have good transient transfer function. A bilinear transformationof (1) produces
response,so that suddensignalchangesdo not causespurious the correspondingfunction for discretesystems:
oscillationsto appearin the data;(3) haveminimalphaseshift;
(4) leavethe low-frequencycomponentsundistorted;and (5)
require minimal computertime to implement. Unfortunately,
,HB(j'o•),'
=[l+tan
tan
(ø•T/2)
1-"•
(•cT/2) (2)
these desirable featurescompete with one another. For ex- where T is the samplinginterval [Stearns,1975,p. 197].
ample, a sharpcutoff filter generallyhas an inferior transient It is convenientto use the Z transform for discretesystems.
responsecomparedwith a filter with a more gradualcutoff. The Z transformof a finitedatasequence
x• (k = 0, 1, ...,
Various low-passdigital filters for oceanographicrecordsare N - 1; x• • 0, k < 0) is denotedby X(z) and is definedby
in use at the present time, e.g., the cosine-Lanczosfilters N-1
[Mooerset al., 1968],the Gaussianfilter [Tarbell and Whitlach, Z[xl = E
1977],and the rectangular,or ideal,filter (so namedbecauseof •=0

its perfectcutoff characteristic).(On page91 of Mooerset al. wherez is a complexvariable. Sincex• = 0 for k < 0,
[1968]the equationfor the weightingfactorshouldreadf(m)
= •{[1 + cos (•'m/60)] sin (0.7•'m/12)}/O.7•-m/12.) The con- Xo Xl XN-1

sensusof opinion among investigatorswho usethesefilters is ]= + + ... zm+N-1 - z -aZ[x•]


that the low-passedsignal differs only slightly from filter to
In general,the outputy• of any digitalfilter is givenby
filterand that co.
nditions1-4 are sufficiently
. satisfied.
The purposeof this articleis to discussthe applicationof y• = box•+ b•x•_• + ... + bmx•_,• - a•y•_•
anotherdigitalfilter, the Butterworthlow-passfilter, to ocean-
..... a,•y•_,• (3)
ographicrecords.This filter, whencorrectlyused,satisfies1-4.
In addition, it requireslesscomputertime, sincefewermulti- [Cadzow,1973,p. 92]. The filtercoefficients
areatandbt,andn
plicativecoefficientsare neededfor the samefilter effect. is the order of the filter (for nonrecursivefilters, rn is the
number
of weights,
at ----0, andn -=0). TakingtheZ transforth
THE BUTTERWORTH LoW-PASS FILTER of both sidesof (3) and rearrangingyield

The Butterworthfilter, well known in electricalengineering, (bo+ b•z-• + '" + bmz


-'•)
is maximally flat in the passbandand provides virtually no Y(z)
= H(z)X(z)
= (1+ axz-X
+ ß + a,•z_,•
) X(z)
disortionof the low-frequencysignalcomponents.It has been
by the convolutiontheorem, where Y(z) = Z[yn], H(z) =
investigated extensivelyin connectionwith analogcircuitreali-
Z[hn], and hn is the impulseresponse
of the filter. The filter
zations[Kuo, 1966]and may be simplysynthesized as a digital
coefficientsfor the Butterworthtransferfunctionmay be deter-
filter [Cadzow,1973,pp. 336-340; Stearns,1975,pp. 194-201].
mined via a bilinear transformation of (1) [Stearns,1975, pp.
The Butterworthfilter is definedin termsof the squareof its
194-201]or from the polesof (2) [Cadzow,1973,p. 388].We
transfer function. For the analog case the squaredtransfer have used Stearns' method, where a filter with the desired
function, or power gain, is given by the expression
transferfunctionis obtainedby cascading
second-order
filters.
Stearnsdenotesthis numberby NS. For instance,whenNS =
Copyright
¸ 1978by the American
Geophysical
Union. 2, theresultingfilteris a fourth-orderButterworthfilter.Cas-
Paper number 8C0670. 5510
0148-0227/78/118C-0670501.00
ROBERTSAND ROBERTS:BRIEF REPORT 5511

Squared Butterworth
Cosine- Lanczos
Ideal
............ Gaussian

10-1

10-2

,.
..
10-3

ß
ß

ß
ß

10-4

10-5

10 3 10- 2 10-1 10

FREQUENCY (cycles per hour)

Fig. 1. Power gain functionsfor four low-passfilters with cutoff frequencyat 1/40 hours. The cosine-Lanczos
and
Gaussianfilters each were given 60 weights.

cading second-orderfilters minimizes roundoff error, which the squareof the gain of the originalfilter. Note, however,that
can be a problem with higher-orderfilters. Stearnsalso uses thisfinalgainis no longerthat of a Butterworth filter,though
this method to designButterworth bandpassand high-pass it will approximatea Butterworthpower gain function.
filters.
AN EXAMPLE
Becausethe Butterworth filter is recursive(that is, past
valuesof the outputare usedasinput), thereis an unavoidable Figure 2a containsinformation about the differencein sea
phaseshift of the signal.This can be removedby filteringthe level at Kodiak and at GASS9 in the Gulf of Alaska, 400 km
signal forward and then backward in time through the same away. The hourly data start on April 21, 1976, and are of 3-
filter. In this casethe final power gain functionis, of course, months duration. Only the first 512 hours are used in this
2.00 -

1.50

1.00

0.50

- 0.50

- 1.50

- 2.00 I I I I I I I I t I
50 1O0 150 200 250 300 350 400 450 500
TIME (hours)

Fig. 2a. Unfiltereddifference


in sealevelbetweentwo pointsin the Gulf of Alaska.Data weresampledeveryhour.

2.00
Butterworth & Cosine - Lanczos
Ideal
Gaussian

1.50

1.00

0.50

- 0.50

- 1.00

-1.50

- 2.00
50 100 150 200 250 300 350 400 450 500
TIME (hours)

Fig. 2b. The samedata of Figure 2a, after filtering. The first and last 60 hours of the data have bccn discarded.
ROBERTS AND ROBERTS:BRIEF REPORT 5513

4.00

Squared
Butierworth
Cosine- Lanczos

3.50 Ideal
ß ß ß ß ß ß ß ß, Gaussian

:,
ß ß
3.00
,:

2.50

2.00

I,U

rr 1.50

1.00

0.50

0.50

1.oo
[ 50 10.0 150 200 250
TIME (hours)
300 350 400 450 500

Fig. 3. Low-pass
filterimpulse
responses.
Eachfilterwasgivenasinputa 512-pointsequence
consisting
of all zeros,except
for the 200th point, which had a value of 50.

example.Figure2a showsthat the signalis dominatedby the HB(z) = H•(z)'H:(z)


diurnal and semidiurnal tides. We wish to examine fluctua-
tionslongerthan 2-3 days.Thusa cutofffrequencyof approxi- = bo,•(1
+ 2z-• + z-:). bo,:(1-+2z-• + z-:)
mately 1/35 hoursis decideduponfor the filter design,sothat 1 + a•,xz-• + a2,,z-2 1 + ax,2z
-• + a:,:z-•
IH(jo)I' -- 0.5 wheno•= 2•r/40hours.We choose
a fourth- with
orderButterworth
filter(NS = 2), sinceit Satisfactorily
re-
ducesthe diurnal tide (Figure 1). bo,x= 0.0071823 bo,•= 0.0065985
The transfer function for the fourth-order Butterworth fil-
a,,, = - 1.8461 a,,2 = - 1.6961
ter, obtainedby usingStearns'algorithm, is
a•,• = 0.87488 a•,• = 0.72248
TABLE 1. Cost Comparisonsfor Different Low-PassFilters The data are filteredforwardthroughthe first filter, then
Cosine-Lanczos
backwardthroughthe samefilter, then forward throughthe
No. of Points Butterworth and Gaussian Ideal second,and backwardthrough the second.The resultingout-
put is shownin Figure 2b. The first and last 60 hourshavebeen
512 $0.42 $0.42 $0.48 discardedfor easeof comparisonwith other low-passfilters.
1024 $0.44 $0.53 $0.62
4096 $0.58 $1.48 $2.38 COMPARISON WITH OTHER Low-PASS FILTERS
8192 $0.83 $3.72 $7.35
Several other low-passfilters have been examined:(1) a
The cutofffrequency for all filterswas 1/40 hours.Sixtyweights cosine-Lanczos filter (1/40-hour cutoff,m = 60, n = 0), (2) a
were used for both the cosine-Lanczos and the Gaussian filters. Gaussianfilter (1/40-hour cutoff,m = 60, n = 0), and (3) an
5514 ROBERTS
ANDROBERTS:
BRIEFREPORT

ideal filter (using a forwara fast Fourier transform (FFT), computertime betweenthe Butterworthfilter and the com-
discardingFourier coefficientscorrespondingto frequencies parisonfilters considered,and the differencebecomesmore
greater than 1/40 hours, and then usingan inverseFFT with pronouncedas more data points are filtered. It is not our
the remainingcoefficients).The numberof weights,m, and the purposeto recommend replacement by the Butterworthfilter
cutoff for the Gaussian filter are chosen to make its cost of other filters now in use;rather, we wish to make note of the
identical to that of the cosine-Lanczosfilter. The power gain cost comparison.
functionsfor thesefilters are shown in Figure 1.
Acknowledgments.The authorswishto expresstheir appreciation
To examinethe transientresponse,an impulseof magnitude to J. Bottero for providingthe computerprogramsfor the cosine-
50 at time 200 has been applied to each of the filters. The Lanczosfilter. This work waspartiallysupportedundercontract03-5-
results are shown in Figure 3. The Butterworth filter has 022-56betweenthe Universityof AlaskaandNOAA, Departmentof
Commerce.
slightlymore overshootthan the cosine-Lanczos filter; other-
wise,the responses are almostidentical.There is no overshoot REFERENCES
for the Gaussianfilter, but the impulseis still broadened.The
ideal filter exhibits an undamped oscillation which can be Brenner,N.M., Three Fortran programsthat perform the Cooley-
eliminatedby putting a shoulderon the transfer function(J. Tukey Fouriertransform,Tech.Note 1967-2,29 pp., LincolnLab.,
Mass. Inst. of Technol., Lexington, 1967.
Holbrook and R. Weisberg,personalcommunication,1978). Cadzow, J. A., Discrete-TimeSystems:An IntroductionWith Inter-
The resultsof filteringthe sealevel data are shownin Figure disciplinaryApplications,440 pp., Prentice-Hall,EnglewoodCliffs,
2b. The Butterworth and the cosine-Lanczos filtered data are N.J., 1973.
almost identical, and the ideal filtered data are similar. As can Kuo,
F.F.,Network
Analysis
andSynthesis,
2rid
ed.,51•pp.,John
Wiley, New York, 1966.
be predicted from Figure 1, the Gaussianfilter with only 60
Mooers,C. N. K., L. M. Bogert,R. L. Smith,and J. G. Patullo,A
weightsretainsan appreciablediurnal tidal component. compilationof observations from mooredcurrent metersand
Table 1 is a costcomparisonfor the filters.Costswill vary, thermographs (and of complementary oceanographic and atmo-
of course,from computer to computer, but the running time sphericdata),vol. 2, Ref.No. 68-5,98 pp., Dep. of Oceanogr.,
Ore.
State Univ., Corvallis, 1968.
comparisonis clear. The cost for the ideal filter can probably
Stearns,S. D., Digital SignalAnalysis,280 pp., HaydenBookCom-
be somewhatreducedby usinga more efficientFFT program pany, RochellePark, N.J., 1975.
(we usedBrenner's[1967] program FOURG). In view of the Tarbell, S. A., and A. W. Whitlach,A compilationof mooredcurrent
transient responsefor this filter, however,it was not explored data and associatedoceanographic observations,1970 Measure-
further. ments,vol. 13,Rep. WH01-77-18,189pp., WoodsHole Oceanogr.
Inst., Woods Hole, Mass., 1977.
CONCLUDING REMARKS

The digital Butterworthfilter is easyto useand efficient.Its (Received May 1, 1978;


analog characteristicshave been studied extensively,so its revised June 9, 1978;
behavior is well known. There is a significantdifferencein acceptedJune 15, 1978.)

You might also like