[SciPy-user] scikits.timeseries DateArray Question[timeseriesdocumentation]

Dharhas Pothina Dharhas.Pothina@twdb.state.tx...
Wed Dec 3 16:18:46 CST 2008


Almost there I think. I'm getting the following error :

Traceback (most recent call last):
  File "/home/dharhas/scripts/selfe/plot-stations_selfevsfield_wfreq.py", line 210, in <module>
    fseries_freq = fseries.convert(freq='D', func=mean) 
AttributeError: 'function' object has no attribute 'convert'

What am I doing wrong?

The relevant code is below :

year, month, day, hour, minute, fdata = loadtxt(fieldfile,comments="#",usecols=(0,1,2,3,4,ndata),unpack=True)
fielddates = date2num([datetime.datetime(int(y),int(m),int(d),int(hh),int(mm),0) for y,m,d,hh,mm in zip(year,month,day,hour,minute)])
fdates = ts.date_array(fielddates,freq='MIN')
fseries = ts.time_series(fdata, dates=fdates)
#remove -999.9 nodata values fo parameter
fseries[fseries==-999.9] = ma.masked
fseries = fseries.fill_missing_dates

#convert tor required frequency
fseries_freq = fseries.convert(freq='D', func=mean) 

>>> Pierre GM <pgmdevlist@gmail.com> 12/03/08 3:51 PM >>>

On Dec 3, 2008, at 4:40 PM, Dharhas Pothina wrote:
> A question. Why do I need to fill missing dates? Is it required for  
> other things like calculating daily averages etc or is there another  
> reason?

Well, it is required in some operations, in particular conversion from  
one frequency to another. If you don't get any error message about the  
dates being incomplete, you're OK. If not, just use fill_missing_dates.
I recognize that it's a lot of wasted space when you have a 15min- 
interval series for example, has you end up with a LOT of missing  
data. Keep in mind that the package was initially designed for Matt's  
issues and mine, and we both usually work with daily frequencies or  
lower (monthly...).

> @Pierre & Matt. Please don't my earlier emails as criticism about  
> the documentation. I am extremely thankful that you have taken the  
> time to develop this package. Seconding Tim, I would like to  
> contribute examples/howto's based on the work I'm doing. If you have  
> any guidance on how the best way to do this is that would be great.

Oh, don't worry, we don't take it personnally. We'd be delighted to  
have some help with the documentation: it's always difficult to put  
oneself back in the shoes of a newbie when one has been working with a  
package for a while. Tutorial and how-tos would be great indeed. I'll  
give you the same answer as to Tim: just drop us a line with your  
material, we'll find a way to put it on the SVN and the online doc.

Thanks again for your support!
SciPy-user mailing list

More information about the SciPy-user mailing list