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-823218179,https://api.github.com/repos/pydata/xarray/issues/5106,823218179,MDEyOklzc3VlQ29tbWVudDgyMzIxODE3OQ==,2448579,2021-04-20T12:04:06Z,2021-04-20T12:04:06Z,MEMBER,Thanks @yt87 can you open a new issue to fix that error message? ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,849751721
https://github.com/pydata/xarray/issues/5106#issuecomment-822968365,https://api.github.com/repos/pydata/xarray/issues/5106,822968365,MDEyOklzc3VlQ29tbWVudDgyMjk2ODM2NQ==,40218891,2021-04-20T04:41:07Z,2021-04-20T04:41:07Z,NONE,"I am closing this issue. It is impossible to guess the proper time unit when dealing with missing data. Setting the attribute explicitly is a better solution.
A minor quibble: the statement
``ds1.reftime.encoding['units'] = 'hours since Big Bang'``
rises an exception
``AttributeError: 'NoneType' object has no attribute 'groups'``
It should be
``ValueError: invalid time units: hours since Big Bang``
the same as in the case ``'hours after 1970-01-01'``","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,849751721
https://github.com/pydata/xarray/issues/5106#issuecomment-822126043,https://api.github.com/repos/pydata/xarray/issues/5106,822126043,MDEyOklzc3VlQ29tbWVudDgyMjEyNjA0Mw==,2448579,2021-04-19T02:33:21Z,2021-04-19T02:33:21Z,MEMBER,"There is a related issue for netCDF. The automagic guessing is not working so you'll need to manually set `.encoding[""units""]` to preserve the time resolution you want. See https://xarray.pydata.org/en/stable/io.html#time-units","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,849751721
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