# [SciPy-User] scikits.timeseries question

Christopher Barker Chris.Barker@noaa....
Mon Nov 30 18:23:52 CST 2009

Pierre GM wrote:
> On Nov 30, 2009, at 6:58 PM, Christopher Barker wrote:
> I guess you're confusing DateArrays and TimeSeries.

> DateArrays are just arrays of dates (think a ndarray of datetime
> objects, or a ndarray with a datetime64 dtype). TimeSeries are like
> MaskedArrays, the combination of a ndarray of values with 2 others
> ndarrays: one array of booleans (the mask), one DateArray.

Actually, I think I got that.

>> In [41]: sd = ts.Date(freq='D', year=2001, month=1, day=1)
>>
>> In [42]: sd
>> Out[42]: <D : 01-Jan-2001>
>
> All is well here.

yup.

>> In [43]: da = ts.date_array((1,2,3,4), start_date=sd)
>
> Check the doc for date_array: the first argument can be

...

>         * a sequence of integers corresponding to the representation of
>           :class:`Date` objects.

That's what I'm trying to give it.

> So, what you're trying to do is to build a an array of four dates (1,2,3,4)
>
>>>> ts.time_series((1,2,3,4),start_date=sd)
> timeseries([1 2 3 4],
>    dates = [01-Jan-2001 ... 04-Jan-2001],
>    freq  = D)

Ah, but what I am trying to do is build that "dates" array -- in teh
real case, I have 1212 pieces of data, associated with time, in terms of
"days since Jan 1, 2001). So I need to construct that dates array to
associate with the time_series data.

So I want:

dates = what_to_put_here?

ts.time_series(an_array_of_data,
start_date=sd)
timeseries([1 2 3 4],
dates = dates],
freq  = D)

While I'm at it -- what I really have is a big 'ol 3-d array, which is
gridded model output, of shape: (time, lat, lon). Time is expressed in
days since...

I need to do a moving average of the while grid over time. Can a
time_series be n-d, with time as one of the axis?

-Chris

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov