home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 822108756

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/5106#issuecomment-822108756 https://api.github.com/repos/pydata/xarray/issues/5106 822108756 MDEyOklzc3VlQ29tbWVudDgyMjEwODc1Ng== 40218891 2021-04-19T01:27:02Z 2021-04-19T01:28:38Z NONE

When the time dimension of the dataset being appended to is 1, the inferred unit is "days". This happens on line 318 in file conding/times.py. In this case variable timedeltas is an empty array and np.all evaluates to True: np.all(np.array([]) % 86400000000000 == 0) True (which surprised me, by the way). When I forced _infer_time_units_from_diff to return "hours", the time coordinate in my example is evaluated correctly, so I think this particular code is the cause for the error.

Since the fallback return value is set to "seconds", I would argue that the case of empty timedeltas should be set to "seconds" as well. Are there alternatives or I should go ahead and create a pull request?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  849751721
Powered by Datasette · Queries took 0.76ms · About: xarray-datasette