[Numpy-discussion] timeseries - dates prior to 1970

Bevan Jenkins bevan07@gmail....
Thu Jun 10 18:16:08 CDT 2010


Hello,

I have posted previously about dates prior to 1900 but this seems to be a 
seperate issue.  The error message is definitley different.
I can not seem to convert a timseseries from one frequency ('D') to another 
('H') when i use dates prior to 1970 as shown below.  This works fine when I 
use a date after 1970.  Is this something that can be easily fixed or work 
around that I can use? Thanks
 
In [1]: import datetime
In [2]: import numpy as np
In [3]: import scikits.timeseries as ts
In [4]: from scikits.timeseries.lib.interpolate import interp_masked1d

In [5]:

In [6]: dta = np.linspace(1.0, 5.0,5)

In [7]: msk = [1,0,1,0,0]

In [8]: dta_maskd = np.ma.masked_array(dta,msk)

In [9]: yr = 1969

In [10]: dtes = [datetime.datetime(yr, 1, 1),
   ....:          datetime.datetime(yr, 1, 2),
   ....:          datetime.datetime(yr, 1, 3),
   ....:          datetime.datetime(yr, 1, 4),
   ....:          datetime.datetime(yr, 1, 5)]

In [11]: day_ts = ts.time_series(dta_maskd, dtes, freq='D')

In [12]: hour_ts = day_ts.convert('H')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)


C:\Python26\lib\site-packages\scikits\timeseries\tseries.pyc in convert(series, 
freq, func, position, *args, **kwargs)
   2000
   2001     if series.ndim == 1:
-> 2002         obj = _convert1d(series, freq, func, position, *args, **kwargs)
   2003     elif series.ndim == 2:
   2004         base = _convert1d(series[:, 0], freq, func, position, *args, 
**kwargs)

C:\Python26\lib\site-packages\scikits\timeseries\tseries.pyc in _convert1d
(series, freq, func, position, *args, **kwargs)
   1910
   1911     cdictresult = cseries.TS_convert(data_, from_freq, to_freq, 
position,
-> 1912                                      int(start_date), mask_)
   1913     start_date = Date(freq=to_freq, value=cdictresult['startindex'])
   1914     data_ = masked_array(cdictresult['values'], mask=cdictresult
['mask'])

ValueError: start_date outside allowable range for destination frequency



More information about the NumPy-Discussion mailing list