[SciPy-User] formating monthly freq data using scikits.timeseries

Pierre GM pgmdevlist at gmail.com
Tue Nov 2 04:39:35 EDT 2010


On Nov 1, 2010, at 11:05 PM, Solomon Negusse wrote:

> Hi All,
> I have some hydrologic data that I need to reformat for  use in a hydrodynamic simulation.  The data comes in the shape of (number of years, 13) where the first column is the year and subsequent columns are  data for each month.  How do I read in such data using tsfromtxt and convert it 2D format with just datetime and data columns of daily or sub-daily frequency?

If I understand correctly what you're trying to do, you can't directly.
First, load your data using an annual frequency, with the date at the first column. You'll end up w/ a timeseries of shape (N,12), with N the number of months.
Then, create a second timeseries with a monthly frequency, starting at the first year and with length the .size of your first series. Fill the second one with values of the first one (using eg. monthly_series.flat = annual_series.flat). That should give you a (Nx12) series of monthly data. 
From there, you can use convert to transform the monthly series into a series of daily frequency.




More information about the SciPy-User mailing list