home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1657396474

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1657396474 PR_kwDOAMm_X85NxJ61 7731 Continue to use nanosecond-precision Timestamps in precision-sensitive areas 6628425 closed 0     9 2023-04-06T13:06:50Z 2023-04-13T15:17:14Z 2023-04-13T14:58:34Z MEMBER   0 pydata/xarray/pulls/7731

This addresses the remaining cftime-related test failures in #7707 by introducing a function that always returns a nanosecond-precision Timestamp object. Despite no corresponding test failures, for safety I grepped and went ahead and replaced the pd.Timestamp constructor with this function in a few other areas. I also updated our documentation to replace any mentions of the "Timestamp-valid range" with "nanosecond-precision range" since Timestamps are now more flexible, and included a note that we have an issue open for relaxing this nanosecond-precision assumption in xarray eventually.

While in principle I think it would be fine if CFTimeIndex.to_datetimeindex returned a DatetimeIndex with non-nanosecond-precision values, since we don't use to_datetimeindex anywhere outside of tests, in its current state it was returning nonsense values: ```

import pandas as pd import xarray as xr times = xr.cftime_range("0001", periods=5) times.to_datetimeindex() DatetimeIndex(['1754-08-30 22:43:41.128654848', '1754-08-31 22:43:41.128654848', '1754-09-01 22:43:41.128654848', '1754-09-02 22:43:41.128654848', '1754-09-03 22:43:41.128654848'], dtype='datetime64[ns]', freq=None) `` This is due to the assumption incftime_to_nptimethat the resulting array will have nanosecond-precision values. We can (and should) address this eventually, but for the sake of quickly supporting pandas version two I decided to be conservative and punt this off to be part of #7493.cftime_to_nptimeis used in places other thanto_datetimeindex`, so modifying it has other impacts downstream.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7731/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 3 rows from issues_id in issues_labels
  • 9 rows from issue in issue_comments
Powered by Datasette · Queries took 0.642ms · About: xarray-datasette