>  Docs Center  >  Libraries  >  Daithi  >  FILTER

FILTER

FILTER

Name


FILTER

Purpose


This function returns a smoothed version of the input vector.

Category


Time Series Analysis

Calling Sequence


Result = FILTER( Vector, [Width], [Window] )

Inputs


Vector: An vector of type floating point and length N.

Optional Inputs


Width: The width, of type integer, of the smoothing window.
Window: A string containing the name of the smoothing window to
return. Options are 'boxcar', 'gaussian', 'hanning',
'triangle'. The default is a boxcar window.

Keyword Parameters


BOXCAR: Sets the smoothing window to a boxcar filter. This is
the default. If set to a value, it replaces Width.
EDGE_TRUNCATE: Set this keyword to apply the smoothing to all points.
If the neighbourhood around a point includes a point outside
the array, the nearest edge point is used to compute the
smoothed result. If EDGE_TRUNCATE is not set, the points near
the end are replaced with NaNs.
FILTER: A vector containing the filter window to use. This overrides
the window requested in the Window input. This also returns
the filter after use.
NAN: Set this keyword to ignore NaN values in the input array,
provided there is at least one defined value nearby. The
default is to return NaNs wherever they occur.
NO_NAN: Obsolete version of NAN keyword retained for compatibility
but no longer used.
START_INDEX: The location of the centre of the window for the first
averaged output value, in units of Vector indices. Values must
be greater than 0. The default is 0.
STEP: An integer defining the step size for window translation, in
units of Vector indices. The default is 1.
TRIANGLE: Sets the smoothing window to a triangle filter. The default
is a boxcar filter. If set to a value, it replaces Width.
WRAP_EDGES: If set, the vector is treated as being cyclic and the
ends are joined together when smoothing.

Outputs


Result: Returns the smoothed version of Vector.

Uses


dimension.pro
filter_window.pro
plus.pro

Procedure


This function manually convolves the input vector with the filter.

Example


      Create a vector of daily data and a sinusoid for a year.
x = randomn( seed, 365 ) + sin( 6.28 * findgen( 365 ) / 365. )
Smooth x with a boxcar filter of 7 days, wrapping the edges together.
result = filter( x, 7, 'boxcar', /wrap_edges )

Modification History


  Written by: Daithi A. Stone, 2000-06-28.
Modified: DAS, 2000-07-06 (removed LENGTH.pro, added
DIMENSION.pro).
Modified: DAS, 2001-01-24 (added reform(vector) line).
Modified: DAS, 2003-11-19 (added Window input and FILTER
keyword, edited style).
Modified: DAS, 2004-07-14 (allowed input of complex vectors)
Modified: DAS, 2005-08-05 (replaced sum.pro use with IDL's
total; added NAN keyword for consistency with other
routines; removed functionality of NO_NAN keyword;
removed constants.pro use; streamlined coding)
Modified: DAS, 2005-10-21 (removed requirement of odd WIDTH;
allowed operation with WIDTH=1)
Modified: DAS, 2009-01-05 (added and implemented START_INDEX and
STEP keywords)



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us