tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Datetime units

Open genematx opened this issue 1 year ago • 2 comments
trafficstars

This expands BuiltinDtype by adding explicit units for numpy datetime64 and timedelta64 dtypes, e.g. datetime64[ns]. This is required, for unambiguous representation of 8-byte datetime objects, specifically with zarr.

The BuiltinDtype class now defines an additional attribute, units, which is "" by default. The units are extracted from (and added to) the string representation of numpy.dtype, e.g. <M8[ns].

More information of supported units can be found here.

Checklist

  • [x] Add a Changelog entry
  • [ ] Add the ticket number which this PR closes to the comment section

genematx avatar Sep 05 '24 21:09 genematx

@joshmoore @MSanKeys963 If you have a moment I wonder if you could comment on plans for datetime data types in Zarr v3. At SciPy 2023 I remarked to Josh that they appeared to be missing from the spec and I think he suggested that they might be reintroduced. It does seem to be common in xarray examples, particularly climate examples.

The term datetime appears on that linked page once, but in the context of a "(currently made up) extension data type".

danielballan avatar Sep 06 '24 12:09 danielballan

@danielballan: thanks for the ping. Unfortunately, I don't have any updates on datetime in Zarr v3. As you can imagine, the focus is still heavily on getting zarr-python v3 out the door, but I imagine there would be a lot of support for moving it forward. (I pointed to this PR and https://github.com/bluesky/tiled/pull/774 at a recent dev meeting.)

joshmoore avatar Sep 09 '24 10:09 joshmoore