[Numpy-discussion] timezones and datetime64

Chris Barker - NOAA Federal chris.barker@noaa....
Thu Apr 4 13:42:04 CDT 2013


On Thu, Apr 4, 2013 at 10:54 AM, Francesc Alted <francesc@continuum.io> wrote:
> On 4/4/13 7:01 PM, Chris Barker - NOAA Federal wrote:

>> I thought about that -- but if you have timedelta without datetime,
>> you really just have an integer -- we haven't bought anything.
>
> Well, it is not just an integer.  It is an integer with a time scale:
>
> In []: np.array(1, dtype='timedelta64[us]') + np.array(1,
> dtype='timedelta64[ns]')
> Out[]: numpy.timedelta64(1001,'ns')
>
> That makes a difference.  This can be specially important for creating
> user-defined time origins:

And mixing units, as you show.

I'm curious about use-cases, though -- I can't imagine using it,
rather than just a standard integer-unit-appropriate-for-the-use-case.
It jsut down's buy enough.

For much of my code for instance, we just use integers for time
(seconds since some epoch) where I really like about a real datetime
type is when I want to convert to-from year-month-day-etc forms. And
that nifty feature isn't really usable with high-res datetime64.

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list