home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 424399958

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/2436#issuecomment-424399958 https://api.github.com/repos/pydata/xarray/issues/2436 424399958 MDEyOklzc3VlQ29tbWVudDQyNDM5OTk1OA== 6628425 2018-09-25T15:54:28Z 2018-09-25T15:54:28Z MEMBER

@sbiner are you looking at the encoding attribute of the full Dataset or the time variable? The time variable should retain the calendar encoding (the Dataset will not). E.g.: ``` In [1]: import cftime

In [2]: import numpy as np

In [3]: import xarray as xr

In [4]: units = 'days since 2000-02-25'

In [5]: times = cftime.num2date(np.arange(7), units=units, calendar='365_day')

In [6]: da = xr.DataArray(np.arange(7), coords=[times], dims=['time'], name='a')

In [7]: da.to_netcdf('data-noleap.nc')

In [8]: ds = xr.open_dataset('data-noleap.nc')

In [9]: ds.encoding['calendar']

KeyError Traceback (most recent call last) <ipython-input-38-677c245c7bb8> in <module>() ----> 1 default.encoding['calendar']

KeyError: 'calendar'

In [10]: ds.time.encoding['calendar'] Out[10]: u'noleap' ```

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