Open JamieTaylor-TUOS opened 4 months ago
Thanks for opening your first issue here at xarray! Be sure to follow the issue template! If you have an idea for a solution, we would really welcome a Pull Request with proposed changes. See the Contributing Guide for more. It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better. Thank you!
Thanks for the excellent issue @JamieTaylor-TUOS
(I labeled this as "topic-cftime" as I don't think we have a "time but not necessarily cftime" label; tell me if this is not what we're intending, xarray team)
What happened?
With a Dataset/DataArray containing a time dimension whose index uses the
datetime64[ns, utc]
(timezone-aware) dtype, if one calls.isel()
to slice say the first element in this dimension, the time coordinate in the resulting Dataset/DataArray will have reverted todatetime64[ns]
(i.e. timezone-naive).What did you expect to happen?
Resulting Dataset/DataArray should retain the timezone-awareness on the coordinate of the sliced time dimension/index and still use
datetime64[ns, utc]
dtypeMinimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
Tested with version
2024.3.0
and also2024.7.0
.Similar to #6416
Environment