home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 339646702

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/1662#issuecomment-339646702 https://api.github.com/repos/pydata/xarray/issues/1662 339646702 MDEyOklzc3VlQ29tbWVudDMzOTY0NjcwMg== 1197350 2017-10-26T12:16:03Z 2017-10-26T12:16:03Z MEMBER

Hi Guillaume! Nice to see so many old friends showing up on the xarray repo...

The issue you raise is totally reasonable from a user perspective: missing values in datetime data should be permitted. But there are some upstream issues that make it challenging to solve (like most of our headaches related to datetime data).

In numpy (and computer arithmetic in general), NaN only exists in floating point datatypes. It is impossible to have a numpy datetime array with NaN in it: ```python

a = np.array(['2010-01-01', '2010-01-02'], dtype='datetime64[ns]') a[0] = np.nan ValueError: Could not convert object to NumPy datetime `` The same error would be raised ifawere an integer array; to get around that, xarray automatically casts integers with missing data to floats. But that approach obviously doesn't work withdatetime` dtypes.

Further downstream, xarray relies on netcdf4-python's num2date function to decode the date. The error is raised by that package.

This is my understanding of the problem. Some other folks here like @jhamman and @spencerkclark might have ideas about how to solve it. They are working on a new package called netcdftime which will isolate and hopefully enhance such time encoding / decoding functions.

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