comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Problems on the Savitzky-Golay smoothing filter
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Problems on the Savitzky-Golay smoothing filter [message #66483 is a reply to message #66474] Wed, 20 May 2009 08:01 Go to previous messageGo to previous message
wita is currently offline  wita
Messages: 43
Registered: January 2005
Member
On May 20, 12:59 pm, mengran <mengra...@gmail.com> wrote:
> Hi,everybody,
>         I have got a annoying problem about the implementing the
> Savitzky-Golay filter to smooth the time series RS data  in the IDL.
> Actually, I know the function of the Savitzky-Golay filter in IDL is
> SAVGOL.But the question is the result I got is either a horizon line
> or the same as the original line(In other words, the filter seems not
> to work at all), when I changed the parameters of the SAVGOL function.
> (when the  DEGREE = NL + NR(PARA OF THE SAVGOL FUNCTION), THE RESULT
> IS THE SAME AS THE ORIGINAL, OTHERWISE, THE RUSULT IS A HORISON LINE)
>        My pro is as follows. The class1 to class9  from txt files are
> the samples of the time series RS data.
>         Is there sth wrong with my code ? Or  the RS data that  I used
> is not appropriate for the  Savitzky-Golay filter, and I take a wrong
> method to smooth data ?  I need your suggestions, thanks  a lot !
>
> PRO Savgol_example
>
>    ;RESTORE, 'C:\WorkSpace\Default\myPlotTemplate.sav'
>    rootPath = 'C:\WorkSpace\Default\class'
>
>     n = 1 & filename = strarr(9)
> for i = 0, 8 do begin
>
>  filename[i] = strjoin([rootPath, strtrim(n, 2),'.txt'])
>       n++
>
> endfor
> for i = 0,8 do begin
>
>    plotTemplate = ASCII_TEMPLATE(filename[1])
>    y1 = READ_ASCII(filename[1], TEMPLATE = plotTemplate, COUNT =
> $                 count,NUM_RECORDS = 46 )
>    x = indgen(46)
>   iPlot,x,y1.FIELD1, NAME = 'Original Curve', $
>    COLOR=[255, 0, 0], SYM_INDEX = 4, yrange = [0,+8000], VIEW_TITLE =
> strmid(filename[1], 21, 6)
>    void = ITGETCURRENT(TOOL=oTool)
>    void = oTool->DoAction('Operations/Insert/Legend')
>
>   ; savgol
>   savgolFilter = SAVGOL(2, 2, 0,4)
>   iPlot,x,CONVOL(y1.FIELD1, savgolFilter), /OVERPLOT, $
>    COLOR=[0, 0, 255], THICK=2, $
>    NAME='Savitzky-Golay'
>    void = oTool->DoAction('Operations/Insert/LegendItem')
>   ;SAVE, plotTemplate, FILENAME='C:\WorkSpace\Default
> \myPlotTemplate.sav'
>
>  endfor
>
> END

Hi Mengran,

I have an implementation of the Savitsky-Golay filter in IDL/ENVI
based on this paper:

Jin Chen, Per. Jonsson, Masayuki Tamura, Zhihui Gu, Bunkei
Matsushita, Lars Eklundh. 2004.
A simple method for reconstructing a high-quality NDVI time-series
data set based on
the Savitzky–Golay filter. Remote Sensing of Environment 91: 332–344

If you are interested I can send you the code.

Allard
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: NetCDF4 problem
Next Topic: Can i use CONTOUR to retrieve the subscripts within a closed contour?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:33:21 PDT 2025

Total time taken to generate the page: 0.00519 seconds