7.0 Filtering Of Time Series

3y ago
38 Views
4 Downloads
2.08 MB
26 Pages
Last View : 4m ago
Last Download : 3m ago
Upload by : Mika Lloyd
Transcription

ATM 552 Notes:Filtering of Time Series Chapter 7page 2057.0 Filtering of Time Series7.1 IntroductionIn this section we will consider the problem of filtering time or space series so thatcertain frequencies or wavenumbers are removed and some are retained. This is an oftused and oft-abused method of accentuating certain frequencies and removing others.The technique can be used to isolate frequencies that are of physical interest from thosethat are not. It can be used to remove high frequency noise or low frequency trends fromtime series and leave unaltered the frequencies of interest. These applications are calledlow-pass and high-pass filtering, respectively. A band-pass filter will remove both highfrequencies and low frequencies and leave only frequencies in a band in the middle.Band-pass filters tend to make even noise look periodic, or at least quasi-periodic. Wewill begin by noting a few important theorems that constitute the fundamental tools ofnon-recursive filtering.The Convolution Theorem:If two functions f1(t) and f2(t) have Fourier transforms F1(ω) and F2(ω) then the Fouriertransform of f1(t) f2(t) is12πAnd the Fourier transform of F1(λ )F2 (ω λ)dλ f1 (τ ) f 2 (t τ ) dτ is F1(ω) F2(ω). This latter result is the most useful in filtering, since it says that theFourier transform of the convolution of two functions in time is just the product of theFourier transforms of the individual functions.Parseval’s Theorem: 1f1( t ) f2 (t )dt 2π F2 (ω ) F1(ω )* dω for f1(t) f2(t) f(t).Copyright 2016 Dennis L. Hartmann2/20/164:43 PM205

ATM 552 Notes:Filtering of Time Series Chapter 7 1f (t ) dt 2π2page 206 F(ω )2dω Here we see that the variance of a time series integrated over all time is equal to thepower spectrum integrated over all frequency.7.2 FilteringSuppose we wish to modify oscillations of certain frequencies in a time series whilekeeping other frequencies the same. e.g. remove high frequency oscillations (low-passfilter), remove low frequencies (high-pass filter), or both (band-pass filter). The ozonelayer of Earth’s atmosphere is a low-pass filter for sunlight in the sense that it absorbs allenergy with wavelengths shorter than 300 nm before it reaches the surface. A coupledifferent approaches to filtering can be taken.7.2.1 Fourier MethodFourier analyzed time series to compute amplitudes at all frequencies. Modify theseamplitudes as desired, then reconstitute the series.f ( t ) Cω i cos (ω i t φi )(7.1)iNf filtered (t) Cω i R(ω ) cos(ω i t φi )(7.2)i 1Here the function R(w) is the response function of the desired filtering process andmeasures the ratio of the amplitude of the filtered to the unfiltered time series as afunction of frequency.R (ω ) Cω filteredCω originalThe problem with this method is that the reconstructed time series may not resemble theoriginal one, particularly near the ends. This is the same general characteristic offunctional fits discussed in an earlier chapter. Also, you need the whole record of databefore you can produce a single filtered data point, and the most recently acquired valuesare at the end of the data stream, where the problems with the Fourier method are worst.So if you want to do real-time filtering, Fourier methods are hopeless. For real-timeproblems the recursive methods are quite good.Copyright 2016 Dennis L. Hartmann2/20/164:43 PM206

ATM 552 Notes:Filtering of Time Series Chapter 7page 2077.2.2 Centered, Non-recursive Weighting MethodIn the centered non-recursive weighting method, the time series is subjected to aweighted running average, so that the filtered point is a weighted sum of surroundingpoints.ffiltered ( t ) J wk f (t kΔt)(7.3)k JSome data points will be lost from each end of the time series since we do not have thevalues to compute the smoothed series for i J and i N-J.It seems obvious that such an operation can most reasonably produce only smoothed timeseries and hence constitutes a low-pass filter. However, a high-pass filter can beconstructed quite simply by subtracting the low-pass filtered time series from the originaltime series. The new high-pass response function will then beRH (ω ) 1 RL (ω )(7.4)Where the subscripts H and L refer to high- and low-pass filters. One can then design ahigh-pass filter by first designing a low-pass filter that removes just those frequencies onewishes to retain. You can also make a band-pass filter by applying a low pass filter to atime series that has already been high-passed (or vice versa), in which case the responsefunction is the product of the two response functions (center case below). Or you cansubtract a low pass filtered version of the data set from another one with a cutoff at ahigher frequency, as illustrated below on the right.1RH 1-RLRB RH RLRB RL1 - RL211RHR(ω)R(ω)R(ω)RL0ωRB0RL2RL1RBω0ω7.3 The Response FunctionThe response function is the spectrum of amplitude modifications made to all frequenciesby the filtering function.Copyright 2016 Dennis L. Hartmann2/20/164:43 PM207

ATM 552 Notes:Filtering of Time Series Chapter 7R(ω ) page 208amplitudeof output series at frequency ωamplitude of input series at frequency ωR 2 (ω ) Φ(ω ) output power at ω Φ(ω ) input power at ωR(ω) can be real or imaginary. Some filtering is done by nature and instruments andthese may introduce phase errors. Any filter we would design and apply would have areal response function, unless we desire to introduce a phase shift. Phase shifting filtersare not too commonly used in meteorological or oceanographic data analysis ormodeling, and so we will not discuss them except in the context of recursive filtering,where a phase shift is often introduced with a single pass of a recursive filter.How do we design a weighting with the desired frequency response? Our smoothingoperation can be writteng(t ) J f (t kΔt) w( kΔt)(7.5)k Jwhere g(t) is the smoothed time series, f(t) is the original time series and w(k t) is theweighting. In the continuous case we can write this as g(t ) f (τ ) w( t τ )dτ(7.6) The filtered output g(t) is just the convolution of the unfiltered input series f(t) and thefilter weighting function w(t). From the convolution theorem the Fourier transform of f (τ ) w(t τ )dτisF(ω ) W (ω ) so thatG(ω ) F(ω ) W(ω )i.e. to obtain the frequency spectrum or Fourier coefficients of the output we multiply theFourier transform of the input times the Fourier transform of the weighting function.Copyright 2016 Dennis L. Hartmann2/20/164:43 PM208

ATM 552 Notes:Filtering of Time Series Chapter 7Pg (ω ) G(ω )G* (ω ) F (ω )W (ω ) ( F(ω )W (ω ))page 209* F (ω ) F* (ω ) W (ω )W * (ω ) F (ω ) 2 W (ω ) 2Simple Example:Suppose our input time series consists of a single cosine wave of amplitude 1.The output signal is theng( t ) K wk cos(ω (t kΔt ))k 1And the Fourier Transform G(ω ) 2 g(t ) cosω t dt0isG (ω ) 2 wk cos (ω t ω kΔt ) cos ω t dtκ wk cos ω kΔtk wk cos ω t kkNow F(ω) 1 so thatR (ω ) G (ω ) wk cos ω t k W (ω ) as k .F (ω ) k The Response function R(ω) is just the Fourier transform of the weighting function w(t).If we assume that the response function and the weighting function are symmetric,Copyright 2016 Dennis L. Hartmann2/20/164:43 PM209

ATM 552 Notes:Filtering of Time Series Chapter 7 R (ω ) W (ω ) 2 w ( t ) cos ωτ dτpage 210τ kΔt0and conversely the weighting function can be obtained from a specified (desired)Response function w (τ ) 2 R (ω ) cos ωτ dω0 w(τ) and R(ω) constitute a Fourier Transform Pair.Some examples:A Bad Example: The rectangular “Boxcar” weighting function or “running mean”smoother.1on the interval 0 τ Tw(τ ) TBoxcar Weighting Function1/T00TtAs we recall, the Fourier transform of the boxcar is the sinc function ωT sin 2 R (ω ) ωT2This response function approaches one as ωT/2 approaches zero. Hence it has no effecton frequencies with periods that are very long compared to the averaging interval T.When ωT 2n π, n 1,2,3., R(ω) 0. Τhe running mean smoother exactly removeswavelengths of which the length of the running mean is an exact multiple. For example,a 12 month running mean removes the annual cycle and all its higher harmonics.Copyright 2016 Dennis L. Hartmann2/20/164:43 PM210

ATM 552 Notes:Filtering of Time Series Chapter 7page 2111.0sinc Response0.50.-0.5Note that the response function, R(ω), of the running mean smoother is negative in theintervals 2π, -4π, 6π, -8π, etc. This means that frequencies in these intervals will bephase shifted by 180 because of the negative side lobes and the slow, 1/(ωT), drop off ofthe amplitude of these side lobes the “running mean” filter is not very good. It may beuseful if we are sure that the variance for ωT π is small.7.4 Inverse ProblemSuppose we wish to design a filter with a very sharp cutoffPerfect Square Response Function1.0R(ω)ωωc From w(τ ) 2 R(ω ) cos ωτ dω0Copyright 2016 Dennis L. Hartmann2/20/164:43 PM211

ATM 552 Notes:Filtering of Time Series Chapter 7page 212 ω τ sin c 2 w(τ ) ω cτ2we get,This is a damped sine wave (sinc function) again.The first zero crossing occurs atω cτ2π1 π τ 2ω c fcThe fact that the weight extends across several of these periods before dropping to zerocauses severe problems at the beginning and end of a finite time series. In practice it isdesirable to settle for a less sharp cutoff of R(ω) for which more practical weightingfunctions are available.“Practical” Filters(1) “Gaussian bell”e xThe function2forms a Fourier Transform pair with itself. Hence a Gaussian bell weighting functionproduces a Gaussian bell frequency response. Although, of course, when you considerthe response function the bell is peaked at zero frequency and we usually ignore thenegative frequencies.(2) The Triangular One-Two-One filtering functiong( t ) 111f (t τ ) f ( t ) f (t τ )424ωR(ω ) cos 2v Δt 2 where ν is the number of times the filter is applied.The response function for the 1-2-1 smoother approaches a Gaussian bell shape for v 5,R(ω) 0.Copyright 2016 Dennis L. Hartmann2/20/164:43 PM212

ATM 552 Notes:Filtering of Time Series Chapter 7page 213(3) Compromise Square Response:You can construct a filter which (1) has relatively few weights, (2) Has a “sort of” squareresponse and (3) has fairly small negative side lobes.Compromise Response Function1.0R(ω)BCAωThe larger the ratio A/B the larger side lobes one must accept. Some weights arenegative.You can find a number of these in the literature and in numerous software packages. Inthe next section we will show how to construct centered, non-recursive filter weights toorder.Copyright 2016 Dennis L. Hartmann2/20/164:43 PM213

ATM 552 Notes:Filtering of Time Series Chapter 7page 2147.5 Construction of Symmetric Nonrecursive Filters7.5.1 Fourier Construction of filter weightsIn this section we will describe methods for the construction of simple non-recursivefilters. Suppose we consider a simple symmetric non-recursive filterNyn Cxk n kwhereCk C k(7.7)k NTime-Shifting Theorem:To perform a Fourier transform of (7.7), it is useful to first consider the timeshifting theorem. Suppose we wish to calculate the Fourier transform of a time series f(t),which has been shifted by a time interval Δt a. Begin by substituting into the Fourierintegral representation of f(t).f (t a) 1 F(ω ) e iω (t a) dω2 π f (t a) 1 iωaeF(ω ) e iωt dω 2π(7.8)From (7.10) we infer that the Fourier transform of a time series shifted by a time intervalis equal to the Fourier transform of the unshifted time series multiplied by the factor,z eiωΔt(7.9)We can Fourier transform (7.7) and use the time shifting theorem (7.8) to obtain N iω kΔt Y (ω ) Ck eX (ω ) k N (7.10)Where Y(ω) and X(ω) are the Fourier transforms of y(t) and x(t). Because Ck C-k ande ix e ixcos x 2(7.11)we can write (7.10) asR (ω ) Copyright 2016 Dennis L. HartmannNY (ω ) C0 2 Ck cos (ω kΔt )X (ω )k 12/20/164:43 PM(7.12)214

ATM 552 Notes:Filtering of Time Series Chapter 7page 2157.5.2 Computation of Response function for Symmetric Non-Recursive WeightsIf we have a set of symmetric non-recursive weights, we can compute the responsefunction easily using (7.12). Let’s do a few examples:The running mean smoother:The running mean smoother replaces the central value on an interval with the average ofthe values surrounding that point. The running mean can be taken over an arbitrarynumber of points, e.g. 2, 3, 5, 7. Starting with (7.12) again,NR (ω ) C0 2 Ck cos (ω kΔt )(7.13)k 1a running mean smoother has Ck 1/(2N 1), where –N k N. The length of therunning mean smoother is 2N 1.2N 1 3R (ω ) 1 2 cos (ωΔt )3 30 ω πΔtπΔt2N 1 5R (ω ) 1 22 cos (ωΔt ) cos ( 2ωΔt )5 552N 1 7R (ω ) 1 222 cos (ωΔt ) cos ( 2ωΔt ) cos ( 3ωΔt )7 7770 ω These square weighting functions give damped sine wave response functions, which aregenerally undesirable. A slightly tapered weighting function, such as the 1-2-1 filtergives a much nicer response function.1-2-1 FilterR (ω ) 1 1 cos (ωΔt )2 20 ω πΔtWe have to alter (7.15) a bit to compute the response function for a 1-1 Filter, a runningmean that just averages adjacent values. The result is:1 – 1 Filter 1 R (ω ) cos ωΔt 2 0 ω πΔtAll these results are plotted in Figure 7.5.1. Note how the 1-2-1 filter cuts off moresharply than the 1-1 filter (running mean 2), but does not have the ugly negative side lobeof the 1-1-1 filter (running mean 3).Copyright 2016 Dennis L. Hartmann2/20/164:43 PM215

ATM 552 Notes:Filtering of Time Series Chapter 7page 216Figure 7.5.1. Response functions for running mean filters of length 2,3,5, and 7, plus the responsefunction of the 1-2-1 filter. Note the nasty negative side lobes of the running mean filters, whichhave sinch functions shapes. The frequency interval runs from zero to the Nyquist frequency,which is 0.5 cycles per time step, or π radians per time step.7.5.3 Computation of General Symmetric Non-Recursive Filter WeightsWe can find the weights that would give a desired response function by transforming(7.12) as follows. Multiply both sides of (7.12) bycos( jωΔt )j 0,1,., Nand then integrate frequency, ω, over the Nyquist interval 0 — π/Δt π /Δt0cos ( jωΔt )R (ω ) dω 2C j π /Δt0cos ( jωΔt ) cos ( kωΔt ) dω(7.14)(7.13) becomesCk 1π π0cos ( kω ′ )R (ω ′ ) dω ′(7.15)ω ′ Δtω , so that 0 ω' π is the Nyquist interval. From (7.14) we can derive theappropriate weighting coefficients from any arbitrary desired response R(ω).Copyright 2016 Dennis L. Hartmann2/20/164:43 PM216

ATM 552 Notes:Filtering of Time Series Chapter 7page 217A sharp cutoff low pass filterSuppose we wish to derive the coefficients of a filter whose response cuts off sharply at afrequency απ, where 0.0 α 1.0, as follows. 1 ω απR (ω ) 0 ω απ(7.16)Then from (7.14) and (7.16) we haveCk 1πCk απ0cos ( kω )dω1sin (α kπ )kπ(7.17)(7.18)Note that the amplitude of the coefficients drops off as k-1, which is rather slow. Thecoefficients, or weights, Ck, are a sinc function in k, as shown previously in Section 7.4.To get a really sharp cutoff we need to use a large number of weights. Usually we wantto keep the number of points to a minimum, because we lose N-1 data off each end of thetime series and because the computations take time. The computation time problem canbe alleviated with the use of recursive filters.If we truncate (7.18) at some arbitrary value of N, then the response function will be lesssharp than we would like and will have wiggles associated with Gibb’s phenomenon.This is shown in Figure 7.4.1 which shows the response function (7.12) for the weights(7.18) for truncation of N 10, N 20, and N 50. The value of α 0.5 was chosen to cutthe Nyquist interval in the center.Copyright 2016 Dennis L. Hartmann2/20/164:43 PM217

ATM 552 Notes:Filtering of Time Series Chapter 7page 2181R(9NL)R(19NL)R(49NL)Filter Response10.80.6WithoutLanczos e 7.5.2: Response function for the filter weights given by (7.15) for three values of N; N 9,N 19 and N 49. α 0.5, so that the cutoff is in the middle of the Nyquist interval, 0 f 0.5., at0.25.Lanzcos Smoothing of Filter Weights:The wiggles in the response functions of Figure 7.5.2 have a wavelength ofapproximately the last included or the first excluded harmonic of (7.13). We can removethis harmonic by smoothing the response function. The running mean smoother exactlyremoves oscillations with a period equal to that of the length of the running meansmoother. The wavelength of the last harmonic included in (7.13) is 2π / N Δt ; so smooththe response function in the following way:π /NΔtN ΔtR (ω ) R (ω ) dω2π π /NΔt(7.19)The running mean filter has no effect on the average, so substituting (7.13) into (7.19) weobtain:ω π /NΔtR (ω ) C NΔt2 Ck cos ( kΔtω ) dω02π ω π /NΔt k 1 C0 N{(7.20)}N N Ck sin kΔt (ω π / NΔt ) sin kΔt (ω π / NΔt ) π k 1 k2N N Ck C0 cos (kΔtω ) sin (k π / N )π k 1 kCopyright 2016 Dennis L. Hartmann2/20/164:43 PM218

ATM 552 Notes:Filtering of Time Series Chapter 7page 219Expanding the sines and collecting terms, we obtain πk sin N R (ω ) C0 2 C cos ( kΔtω ) .πk kk 1 N N(7.21)The running mean smoother of the response function is equivalent to multiplication offilter weights by πk sin c N These factors are sometimes called the sigma factors. Note that the last coefficient, CN,disappears entirely because the sigma factor is zero (sin π 0) (We’re assuming the timestep is one unit, I guess).Figure 7.5.3 shows the response functions for the new set of weights determined bysmoothing the response function. πk C k sin c Ck N for1 k N.(7.22)1R(9L)R(19L)R(49L)Response Function10.80.6Lanczos .5Figure 7.5.3: As in 7.5.2, but with Lanczos smoothing of weights and response function.The wiggles are reduced by the Lanzcos smoothing, but the frequency cutoff issomewhat more gradual. The changes to the weighting functions for the N 9 and N 19Copyright 2016 Dennis L. Hartmann2/20/164:43 PM219

ATM 552 Notes:Filtering of Time Series Chapter 7page 220cases are shown in Fig. 7.5.4. The sigma factors reduce the magnitudes of the weights ask approaches N.0.60.5W(9L)W(9NL)Filter Weight0.40.30.20.10-0.1-0.20246810IndexFigure 7.5.4: Filter weights for raw (dashed) and Lanczos smoothed (solid) responsefunctions for case of N 9.0.6Non-Recursive Filter WeightsWith and Without Lanczos Smoothing0.5Filter 1520Figure 7.4.3b: Filter weights for raw (dashed) and smoothed (solid) response functionsfor case of N 19.Copyright 2016 Dennis L. Hartmann2/20/164:43 PM220

ATM 552 Notes:Filtering of Time Series Chapter 7page 2217.6 Recursive FiltersThe filters we have discussed so far are obtained by convolving the input seriesx(nΔt) xn with a weighting function wk, in the following way.K wkyn x n k(7.23)k KSuch filtering schemes will always be stable, but it can require a large number of weightsto achieve a desired response function. If greater efficiency of computation is desired,then it may be attractive to consider a recursive filter of the general form,KJk 0j 1yn bk xn k a j yn j(7.24)In this case the filtered value depends not only on the unfiltered input series, but also onprevious values of the filtered time series. In general, sharper response functions can beobtained with fewer weights and thereby fewer computations than with non-recursivefilters like (7.23). The method of constructing the weights for a recursive filter from adesired response function is not as easy as with convolution filters, and the filteringprocess is not necessarily stable.7.6.2 Response Function for General Linear Filters:Let's rearrange (7.24),JKj 1k 0yn a j yn

certain frequencies or wavenumbers are removed and some are retained. This is an oft-used and oft-abused method of accentuating certain frequencies and removing others. The technique can be used to isolate frequencies that are of physical interest from those that are not. It can be used to remove high frequency noise or low frequency trends from

Related Documents:

3 filtering and selective social filtering),6 Algeria (no evidence of filtering),7 and Jordan (selective political filtering and no evidence of social filtering).8 All testing was conducted in the period of January 2-15, 2010.

SonicWALL Content Filtering feature. A Web browser is used to access the SonicWALL Management interface, and the commands and functions of Content Filtering. The following sections are in this chapter: Accessing the SonicWALL using a Web browser Enabling Content Filtering and Blocking Customizing Content Filtering

WebTitan Web Filtering and URL Filtering Categories: The 53 Categories available in Web Titan for Web Filtering and URL Filtering: 1.Alcohol: Web pages that promote, advocate or sell alcohol including beer, wine and hard liquor. 4.Business/Services: General business websites. 7.Community Sites: Newsgroup sites and posting including

Keywords: Image filtering, vertically weighted regression, nonlinear filters. 1. Introduction Image filtering and reconstruction algorithms have played the most fundamental role in image processing and ana-lysis. The problem of image filtering and reconstruction is to obtain a better quality image θˆfrom a noisy image y {y

Protects users, networks, and devices with the industry's best web security and parental controls solution. Goes beyond DNS filtering with protection and support at the domain, page-level, and full-path URL. Quick Heal Web Filtering is built to handle infrastructure failures and provide high-quality service. Quick Heal Web Filtering

Content-filtering appliances combine the TCO advantages of turnkey security hardware with the laser-like focus of a dedicated filtering server. A few examples are: Barracuda Web Filter Appliance Bloxx CF-Series Celestix MSA Appliance Crossbeam Systems Secure Content URL Filtering 8e6 R3000 Enterprise Internet Filter

innovator in the sphere of online security and web content filtering. Being IWF Member, SafeDNS includes in its web filtering systems and blocks URLs of indecent images of children and abuse domains from Child Abuse Images and content list (CAIC) compiled by IWF. www.safedns.com Starting from 2015, the efficiency of the SafeDNS web filtering

Modern edge-aware filtering: local Laplacian pyramids input texture decrease texture increase large texture increase. Tonemapping with edge-aware filtering. Tonemapping with edge-aware filtering local Laplacian pyramids bilateral filter. Non-local means. Redundancy in natural images.