From: John H. <jdh...@ac...> - 2004-09-16 18:40:56
|
>>>>> "Chris" == Chris Barker <Chr...@no...> writes: Chris> I think you should generally not blindly apply the MATLAB Chris> approach. Python is a more powerful language than MATLAB, Chris> and support for more than just doubles is one it's Chris> features! Agreed. That's why we're here, after all. Chris> How does the datetime module store the values in a datetime Chris> object? My first inclination would be to follow it's Chris> approach, but it may not be suited to arrays ( :-( ) From the header of datetime.h /* Fields are packed into successive bytes, each viewed as unsigned and * big-endian, unless otherwise noted: * * byte offset * 0 year 2 bytes, 1-9999 * 2 month 1 byte, 1-12 * 3 day 1 byte, 1-31 * 4 hour 1 byte, 0-23 * 5 minute 1 byte, 0-59 * 6 second 1 byte, 0-59 * 7 usecond 3 bytes, 0-999999 * 10 */ I am concerned about the performance and memory hit of using, for example, a list of a list of datetime objects rather than a numeric array of floats. In the float representation, you can efficiently create a large date range array with, for example, the drange code I posted. Another concern is implementation: I would have to special case setting the tick limits and locations, eg calls to set_xlim and set_xticks, to check for datetime instances. I'm not totally wed to the float array approach however, and it is possible to handle datetime conversions as special cases in the axis functions if the consensus is that this would be better. Chris> A couple projects you might want to make use of: Chris> http://pytz.sourceforge.net/ Chris> and: Chris> https://moin.conectiva.com.br/DateUtil These look very nice and their is a good likelihood I'll use both. DateUtil can extend and improve the date tickers considerably, and the pytz classes should keep users happy around the world! Thanks, JDH |