[SciPy-user] Calculating daily averages from a timeserieswithout using the timeseries package.

Dharhas Pothina Dharhas.Pothina@twdb.state.tx...
Tue Dec 2 15:31:05 CST 2008


Well I have older versions of Scipy, Numpy & Matplotlib installed through the Fedora 8 repositories. To install the timeseries package I need to build the latest versions of scipy/numpy etc. My main concern is that I have a whole slew of scripts that are doing various analyses and plots etc and from what I understand there have been some API changes in matplotlib from the version I have installed to the latest version. I'm fairly close to a deadline and I'm worried about breaking my existing scripts when installing the more recent versions numpy/scipy/matplotlib. 

Is there a way to do a parallel install so I can choose whether to use the newer versions or the old versions of numpy/scipy etc? I looked through the scipy website and couldn't find anything.


- dharhas

>>> Pierre GM <pgmdevlist@gmail.com> 12/2/2008 2:44 PM >>>

Installing and starting to use scikits.timeseries will take you a  
couple of hours, unless you're on windows (because I don't have access  
to a windows machine and can't help you with the installation).
Trying to find a trick to solve your problem might take you as long,  
if not more. If I were you, I wouldn't hesitate

But well, some ideas
1. Revert to an array of datetime objects instead of your datenum.
2. Define some function that tests the .day of your dates, and select  
the ones that match the day you want.

or, just convert your date2num floats to int and select the int that  
correspond to your day.

3. Constrct a mask from the results of the previous step.
4. Apply the mask on your data and compute the average.
5. Rinse and repeat for a new day.

Yep, laborious...
With scikits.timeseries, it'd be something like that:
series = ts.fill_missing_dates(series).convert('D').mean(-1)
SciPy-user mailing list

More information about the SciPy-user mailing list