{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/xarray/issues/2436","repository_url":"https://api.github.com/repos/pydata/xarray","labels_url":"https://api.github.com/repos/pydata/xarray/issues/2436/labels{/name}","comments_url":"https://api.github.com/repos/pydata/xarray/issues/2436/comments","events_url":"https://api.github.com/repos/pydata/xarray/issues/2436/events","html_url":"https://github.com/pydata/xarray/issues/2436","id":363299007,"node_id":"MDU6SXNzdWUzNjMyOTkwMDc=","number":2436,"title":"allow access to time attributes from netcdf files","user":{"login":"sbiner","id":16655388,"node_id":"MDQ6VXNlcjE2NjU1Mzg4","avatar_url":"https://avatars1.githubusercontent.com/u/16655388?v=4","gravatar_id":"","url":"https://api.github.com/users/sbiner","html_url":"https://github.com/sbiner","followers_url":"https://api.github.com/users/sbiner/followers","following_url":"https://api.github.com/users/sbiner/following{/other_user}","gists_url":"https://api.github.com/users/sbiner/gists{/gist_id}","starred_url":"https://api.github.com/users/sbiner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbiner/subscriptions","organizations_url":"https://api.github.com/users/sbiner/orgs","repos_url":"https://api.github.com/users/sbiner/repos","events_url":"https://api.github.com/users/sbiner/events{/privacy}","received_events_url":"https://api.github.com/users/sbiner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-24T20:02:49Z","updated_at":"2018-09-25T15:54:29Z","closed_at":null,"author_association":"NONE","body":"I like the automatic decoding of the time variable when reading netcdf files but I often need to keep the calendar attribute of the time variable.\r\n\r\nCould it be possible to keep those attributes in the DataSet/DataArray return by open_dataset?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pydata/xarray/issues/comments/424399958","html_url":"https://github.com/pydata/xarray/issues/2436#issuecomment-424399958","issue_url":"https://api.github.com/repos/pydata/xarray/issues/2436","id":424399958,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDM5OTk1OA==","user":{"login":"spencerkclark","id":6628425,"node_id":"MDQ6VXNlcjY2Mjg0MjU=","avatar_url":"https://avatars0.githubusercontent.com/u/6628425?v=4","gravatar_id":"","url":"https://api.github.com/users/spencerkclark","html_url":"https://github.com/spencerkclark","followers_url":"https://api.github.com/users/spencerkclark/followers","following_url":"https://api.github.com/users/spencerkclark/following{/other_user}","gists_url":"https://api.github.com/users/spencerkclark/gists{/gist_id}","starred_url":"https://api.github.com/users/spencerkclark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencerkclark/subscriptions","organizations_url":"https://api.github.com/users/spencerkclark/orgs","repos_url":"https://api.github.com/users/spencerkclark/repos","events_url":"https://api.github.com/users/spencerkclark/events{/privacy}","received_events_url":"https://api.github.com/users/spencerkclark/received_events","type":"User","site_admin":false},"created_at":"2018-09-25T15:54:28Z","updated_at":"2018-09-25T15:54:28Z","author_association":"CONTRIBUTOR","body":"@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.:\r\n```\r\nIn [1]: import cftime\r\n\r\nIn [2]: import numpy as np\r\n\r\nIn [3]: import xarray as xr\r\n\r\nIn [4]: units = 'days since 2000-02-25'\r\n\r\nIn [5]: times = cftime.num2date(np.arange(7), units=units, calendar='365_day')\r\n\r\nIn [6]: da = xr.DataArray(np.arange(7), coords=[times], dims=['time'], name='a')\r\n\r\nIn [7]: da.to_netcdf('data-noleap.nc')\r\n\r\nIn [8]: ds = xr.open_dataset('data-noleap.nc')\r\n\r\nIn [9]: ds.encoding['calendar']\r\n---------------------------------------------------------------------------\r\nKeyError                                  Traceback (most recent call last)\r\n<ipython-input-38-677c245c7bb8> in <module>()\r\n----> 1 default.encoding['calendar']\r\n\r\nKeyError: 'calendar'\r\n\r\nIn [10]: ds.time.encoding['calendar']\r\nOut[10]: u'noleap'\r\n```"}}
{"actor":{"display_login":"spencerkclark"}}