# Re: new question about FFTA

Dear Andrew,

Yes, is a pretty good detailed explanation. Thanks a lot!!

Cheers,
Antonio

----- Original Message -----
From: "Andrew Wittenberg" <atw@gfdl.noaa.gov>
To: "antonio rodríguez" <arv@ono.com>
Cc: <ferret_users@ferret.wrc.noaa.gov>
Sent: Monday, October 14, 2002 4:48 PM
Subject: Re: new question about FFTA

On Mon, 14 Oct 2002, antonio rodríguez wrote:
> > One thing you could do, if there is just one missing timestep, is
> > to skip that first value by sending  variable[l=2:428]  to the function.
>
> This work fine. But what would happen if the missing value is for
> example the 20th? or the range from 125 to 201?

Hi Antonio,

Try filling in the missing values with your best guess, prior to
performing the FFT.  Here are some examples, using a dataset that comes
with Ferret -- you'll have to decide which is best for your application.

use monthly_navy_winds
set region/x=180w/y=0

! Timeseries with missing data.
let tseries = IF abs(uwnd) GT 1 THEN uwnd

! Missing vals replaced by zeros.
let fill_zero = missing(tseries,0)

! Missing vals replaced by the timeseries average.
let fill_tave = missing(tseries,tseries[t=@ave])

! Missing vals replaced by nearest valid values.
let fill_nearest = tseries[t=@fnr]

! Missing vals linearly interpolated from nearest valid points;
! ends can't be interpolated and so are filled with zeros.
let fill_linear = missing(tseries[t=@fln],0)

! Let's compare the results.
cancel view
set view upper
plot uwnd,fill_zero,fill_tave,fill_nearest,fill_linear
set view lower
plot
ffta(uwnd),ffta(fill_zero),ffta(fill_tave),ffta(fill_nearest),ffta(fill_line
ar)

Andrew