I have some input data, with timestamps in the input file in the form of hours from the date time specified in the filename.
This is a bit useless, so I need to conv
As noted in another answer, for Numpy > 1.7, you can use Numpy's built-in datetime capability. The examples in the Numpy documentation don't include using np.arange with steps, so here's one:
timearray = np.arange('2000-01-01', '2000-01-02',np.timedelta64(1,'h'), dtype='datetime64')
Numpy sets the dtype of this result to datetime64[h]. You can set this explicitly to some smaller unit of time with dtype='datetime64[m]'.
In version 1.8.1 (and I expect earlier), trying to add an offset to that result array that is smaller than an hour will have no effect.
timearray += np.timedelta64(10,'s') does not change timearraytimearray2 = timearray + np.timedelta64(10,'s') will add 10 seconds to timearray and converts the dtype of timearray2 to datetime64[s]