[SciPy-User] scikits.timeseries question
Mon Nov 30 19:16:41 CST 2009
Pierre GM wrote:
> Ah OK. Well, the answer is: that depends. iIf you know that your
> dates are just in daily increments from 2001-01-01 (like a range),
> then just use start_date and length.
right -- but I don't know that.
> If you may have several duplicated dates (like 2001-01-01,
> 2001-01-02, 2001-01-02, 2001-01-03...), then the easiest is probably:
>>>> da = ts.date_array(np.array(0,1,1,2)+sd)
nope -- not duplicated, but maybe there are missing ones. The point is
that I have an array of "days since", and I want array of
timeseries.dates (which is a DateArray, yes?)
> np.array(...) + sd gives you a ndarray of Date objects (so its dtype
> is np.object), and you use that as the input of date_array. The
> frequency should be recognized properly.
OK -- though it seems I SHOULD be able to go straight to an DateArray,
and I'm still confused about what this means:
>> In : da = ts.date_array((1,2,3,4), start_date=sd)
> Check the doc for date_array: the first argument can be
> * an existing :class:`DateArray` object;
> * a sequence of :class:`Date` objects with the same frequency;
> * a sequence of :class:`datetime.datetime` objects;
> * a sequence of dates in string format;
> * a sequence of integers corresponding to the representation of
> :class:`Date` objects.
That's what I have: a sequence of integers corresponding to the
representation of the Date objects (doesn't it represent them as "units
since start date" where units is the "freq" ?
If that's not what if means, then what does it mean?
Robert Ferrell wrote:
> If this happens to be what you are trying to do, be careful of the
> counting of days (0 based, vs 1 based).
yup -- thanks for the reminder.
>> 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?
> Well, I never tried so I can tell you. Check wheter lib.moving_funcs
> supports 2D data.
hmm -- I see this:
ts_lib.mov_average(data, span, dtype=None)
Calculates the moving average of a series.
data : array-like
Input data, as a sequence or (subclass of) ndarray.
Masked arrays and TimeSeries objects are also accepted.
The input array should be 1D or 2D at most.
If the input array is 2D, the function is applied on each
I've got a 3-d array -- darn! Maybe I'll poke into it and see if it can
Christopher Barker, Ph.D.
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
More information about the SciPy-User