{"action":"created","comment":{"url":"https://api.github.com/repos/spencerahill/aospy/pulls/comments/95720747","pull_request_review_id":16284922,"id":95720747,"diff_hunk":"@@ -168,6 +168,39 @@ def numpy_datetime_range_workaround(date):\n     return date\n \n \n+def numpy_datetime_workaround_encode_cf(ds):\n+    \"\"\"Generate CF-compliant units for out-of-range dates.\n+\n+    Hack to address np.datetime64, and therefore pandas and xarray, not\n+    supporting dates outside the range 1677-09-21 and 2262-04-11 due to\n+    nanosecond precision.  See e.g.\n+    https://github.com/spencerahill/aospy/issues/96.\n+\n+    Specifically, we coerce the data such that, when decoded, the earliest\n+    value starts in 1678 but with its month, day, and shorter timescales\n+    (hours, minutes, seconds, etc.) intact and with the time-spacing between\n+    values intact.\n+\n+    Parameters\n+    ----------\n+    ds : xarray.Dataset\n+\n+    Returns\n+    -------\n+    xarray.Dataset\n+\n+    \"\"\"\n+    time = ds[TIME_STR]\n+    units = time.attrs['units']\n+    units_yr = units.split(' since ')[1].split('-')[0]\n+    min_yr = xr.decode_cf(time.to_dataset('dummy'))['time'].values[0].year\n+    new_units_yr = pd.Timestamp.min.year + 2 - min_yr\n+    new_units = units.replace(units_yr, str(new_units_yr))\n+    time.attrs['units'] = new_units\n+    time.attrs['calendar'] = 'noleap'","path":"aospy/utils/times.py","position":33,"original_position":33,"commit_id":"192a174fb3709025555ee23c129f12953119c01c","original_commit_id":"192a174fb3709025555ee23c129f12953119c01c","user":{"login":"spencerahill","id":6200806,"avatar_url":"https://avatars.githubusercontent.com/u/6200806?v=3","gravatar_id":"","url":"https://api.github.com/users/spencerahill","html_url":"https://github.com/spencerahill","followers_url":"https://api.github.com/users/spencerahill/followers","following_url":"https://api.github.com/users/spencerahill/following{/other_user}","gists_url":"https://api.github.com/users/spencerahill/gists{/gist_id}","starred_url":"https://api.github.com/users/spencerahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencerahill/subscriptions","organizations_url":"https://api.github.com/users/spencerahill/orgs","repos_url":"https://api.github.com/users/spencerahill/repos","events_url":"https://api.github.com/users/spencerahill/events{/privacy}","received_events_url":"https://api.github.com/users/spencerahill/received_events","type":"User","site_admin":false},"body":"I was wondering the same thing!  It was in there previously, so I thought you had put it there for a particular reason.  Let's omit; don't see good reason why we would need noleap.","created_at":"2017-01-12T03:36:29Z","updated_at":"2017-01-12T03:36:29Z","html_url":"https://github.com/spencerahill/aospy/pull/113#discussion_r95720747","pull_request_url":"https://api.github.com/repos/spencerahill/aospy/pulls/113","_links":{"self":{"href":"https://api.github.com/repos/spencerahill/aospy/pulls/comments/95720747"},"html":{"href":"https://github.com/spencerahill/aospy/pull/113#discussion_r95720747"},"pull_request":{"href":"https://api.github.com/repos/spencerahill/aospy/pulls/113"}}},"pull_request":{"url":"https://api.github.com/repos/spencerahill/aospy/pulls/113","id":101156834,"html_url":"https://github.com/spencerahill/aospy/pull/113","diff_url":"https://github.com/spencerahill/aospy/pull/113.diff","patch_url":"https://github.com/spencerahill/aospy/pull/113.patch","issue_url":"https://api.github.com/repos/spencerahill/aospy/issues/113","number":113,"state":"open","locked":false,"title":"ENH improve logic & tests of limited date range workarounds","user":{"login":"spencerahill","id":6200806,"avatar_url":"https://avatars.githubusercontent.com/u/6200806?v=3","gravatar_id":"","url":"https://api.github.com/users/spencerahill","html_url":"https://github.com/spencerahill","followers_url":"https://api.github.com/users/spencerahill/followers","following_url":"https://api.github.com/users/spencerahill/following{/other_user}","gists_url":"https://api.github.com/users/spencerahill/gists{/gist_id}","starred_url":"https://api.github.com/users/spencerahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencerahill/subscriptions","organizations_url":"https://api.github.com/users/spencerahill/orgs","repos_url":"https://api.github.com/users/spencerahill/repos","events_url":"https://api.github.com/users/spencerahill/events{/privacy}","received_events_url":"https://api.github.com/users/spencerahill/received_events","type":"User","site_admin":false},"body":"This cleans up/refactors and slightly improves the logic for the limited daterange workaround.  (It was motivated by what I thought was a bug, but was actually just due to a filename of some netCDF data from the CAM model being misleading w/r/t its time values.)\r\n\r\n@spencerkclark, one thing that's not strictly necessary that I changed here is using `open_mfdataset` rather than `open_dataset` followed by `xr.concat`.  Obviously the code is cleaner with mfdataset, but as I recall there were some performance problems there?  I can't find our discussion on it though either in the repo or our emails.  Is this still a problem?  I'm willing to revert to open_dataset if the performance hit is too much.","created_at":"2017-01-11T22:08:10Z","updated_at":"2017-01-12T03:36:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db9d7be34647f35e5a251203f81ca661b67c077d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/spencerahill/aospy/pulls/113/commits","review_comments_url":"https://api.github.com/repos/spencerahill/aospy/pulls/113/comments","review_comment_url":"https://api.github.com/repos/spencerahill/aospy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spencerahill/aospy/issues/113/comments","statuses_url":"https://api.github.com/repos/spencerahill/aospy/statuses/192a174fb3709025555ee23c129f12953119c01c","head":{"label":"spencerahill:av-dtypein-bug","ref":"av-dtypein-bug","sha":"192a174fb3709025555ee23c129f12953119c01c","user":{"login":"spencerahill","id":6200806,"avatar_url":"https://avatars.githubusercontent.com/u/6200806?v=3","gravatar_id":"","url":"https://api.github.com/users/spencerahill","html_url":"https://github.com/spencerahill","followers_url":"https://api.github.com/users/spencerahill/followers","following_url":"https://api.github.com/users/spencerahill/following{/other_user}","gists_url":"https://api.github.com/users/spencerahill/gists{/gist_id}","starred_url":"https://api.github.com/users/spencerahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencerahill/subscriptions","organizations_url":"https://api.github.com/users/spencerahill/orgs","repos_url":"https://api.github.com/users/spencerahill/repos","events_url":"https://api.github.com/users/spencerahill/events{/privacy}","received_events_url":"https://api.github.com/users/spencerahill/received_events","type":"User","site_admin":false},"repo":{"id":37231620,"name":"aospy","full_name":"spencerahill/aospy","owner":{"login":"spencerahill","id":6200806,"avatar_url":"https://avatars.githubusercontent.com/u/6200806?v=3","gravatar_id":"","url":"https://api.github.com/users/spencerahill","html_url":"https://github.com/spencerahill","followers_url":"https://api.github.com/users/spencerahill/followers","following_url":"https://api.github.com/users/spencerahill/following{/other_user}","gists_url":"https://api.github.com/users/spencerahill/gists{/gist_id}","starred_url":"https://api.github.com/users/spencerahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencerahill/subscriptions","organizations_url":"https://api.github.com/users/spencerahill/orgs","repos_url":"https://api.github.com/users/spencerahill/repos","events_url":"https://api.github.com/users/spencerahill/events{/privacy}","received_events_url":"https://api.github.com/users/spencerahill/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spencerahill/aospy","description":"Climate data analysis, database, and visualization package for Python","fork":false,"url":"https://api.github.com/repos/spencerahill/aospy","forks_url":"https://api.github.com/repos/spencerahill/aospy/forks","keys_url":"https://api.github.com/repos/spencerahill/aospy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spencerahill/aospy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spencerahill/aospy/teams","hooks_url":"https://api.github.com/repos/spencerahill/aospy/hooks","issue_events_url":"https://api.github.com/repos/spencerahill/aospy/issues/events{/number}","events_url":"https://api.github.com/repos/spencerahill/aospy/events","assignees_url":"https://api.github.com/repos/spencerahill/aospy/assignees{/user}","branches_url":"https://api.github.com/repos/spencerahill/aospy/branches{/branch}","tags_url":"https://api.github.com/repos/spencerahill/aospy/tags","blobs_url":"https://api.github.com/repos/spencerahill/aospy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spencerahill/aospy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spencerahill/aospy/git/refs{/sha}","trees_url":"https://api.github.com/repos/spencerahill/aospy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spencerahill/aospy/statuses/{sha}","languages_url":"https://api.github.com/repos/spencerahill/aospy/languages","stargazers_url":"https://api.github.com/repos/spencerahill/aospy/stargazers","contributors_url":"https://api.github.com/repos/spencerahill/aospy/contributors","subscribers_url":"https://api.github.com/repos/spencerahill/aospy/subscribers","subscription_url":"https://api.github.com/repos/spencerahill/aospy/subscription","commits_url":"https://api.github.com/repos/spencerahill/aospy/commits{/sha}","git_commits_url":"https://api.github.com/repos/spencerahill/aospy/git/commits{/sha}","comments_url":"https://api.github.com/repos/spencerahill/aospy/comments{/number}","issue_comment_url":"https://api.github.com/repos/spencerahill/aospy/issues/comments{/number}","contents_url":"https://api.github.com/repos/spencerahill/aospy/contents/{+path}","compare_url":"https://api.github.com/repos/spencerahill/aospy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spencerahill/aospy/merges","archive_url":"https://api.github.com/repos/spencerahill/aospy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spencerahill/aospy/downloads","issues_url":"https://api.github.com/repos/spencerahill/aospy/issues{/number}","pulls_url":"https://api.github.com/repos/spencerahill/aospy/pulls{/number}","milestones_url":"https://api.github.com/repos/spencerahill/aospy/milestones{/number}","notifications_url":"https://api.github.com/repos/spencerahill/aospy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spencerahill/aospy/labels{/name}","releases_url":"https://api.github.com/repos/spencerahill/aospy/releases{/id}","deployments_url":"https://api.github.com/repos/spencerahill/aospy/deployments","created_at":"2015-06-11T01:12:43Z","updated_at":"2016-11-26T12:33:14Z","pushed_at":"2017-01-11T22:08:10Z","git_url":"git://github.com/spencerahill/aospy.git","ssh_url":"git@github.com:spencerahill/aospy.git","clone_url":"https://github.com/spencerahill/aospy.git","svn_url":"https://github.com/spencerahill/aospy","homepage":null,"size":2714,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":45,"forks":1,"open_issues":45,"watchers":14,"default_branch":"develop"}},"base":{"label":"spencerahill:develop","ref":"develop","sha":"568f41a02b17c1909d85258d193b9195a7042607","user":{"login":"spencerahill","id":6200806,"avatar_url":"https://avatars.githubusercontent.com/u/6200806?v=3","gravatar_id":"","url":"https://api.github.com/users/spencerahill","html_url":"https://github.com/spencerahill","followers_url":"https://api.github.com/users/spencerahill/followers","following_url":"https://api.github.com/users/spencerahill/following{/other_user}","gists_url":"https://api.github.com/users/spencerahill/gists{/gist_id}","starred_url":"https://api.github.com/users/spencerahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencerahill/subscriptions","organizations_url":"https://api.github.com/users/spencerahill/orgs","repos_url":"https://api.github.com/users/spencerahill/repos","events_url":"https://api.github.com/users/spencerahill/events{/privacy}","received_events_url":"https://api.github.com/users/spencerahill/received_events","type":"User","site_admin":false},"repo":{"id":37231620,"name":"aospy","full_name":"spencerahill/aospy","owner":{"login":"spencerahill","id":6200806,"avatar_url":"https://avatars.githubusercontent.com/u/6200806?v=3","gravatar_id":"","url":"https://api.github.com/users/spencerahill","html_url":"https://github.com/spencerahill","followers_url":"https://api.github.com/users/spencerahill/followers","following_url":"https://api.github.com/users/spencerahill/following{/other_user}","gists_url":"https://api.github.com/users/spencerahill/gists{/gist_id}","starred_url":"https://api.github.com/users/spencerahill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencerahill/subscriptions","organizations_url":"https://api.github.com/users/spencerahill/orgs","repos_url":"https://api.github.com/users/spencerahill/repos","events_url":"https://api.github.com/users/spencerahill/events{/privacy}","received_events_url":"https://api.github.com/users/spencerahill/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spencerahill/aospy","description":"Climate data analysis, database, and visualization package for Python","fork":false,"url":"https://api.github.com/repos/spencerahill/aospy","forks_url":"https://api.github.com/repos/spencerahill/aospy/forks","keys_url":"https://api.github.com/repos/spencerahill/aospy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spencerahill/aospy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spencerahill/aospy/teams","hooks_url":"https://api.github.com/repos/spencerahill/aospy/hooks","issue_events_url":"https://api.github.com/repos/spencerahill/aospy/issues/events{/number}","events_url":"https://api.github.com/repos/spencerahill/aospy/events","assignees_url":"https://api.github.com/repos/spencerahill/aospy/assignees{/user}","branches_url":"https://api.github.com/repos/spencerahill/aospy/branches{/branch}","tags_url":"https://api.github.com/repos/spencerahill/aospy/tags","blobs_url":"https://api.github.com/repos/spencerahill/aospy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spencerahill/aospy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spencerahill/aospy/git/refs{/sha}","trees_url":"https://api.github.com/repos/spencerahill/aospy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spencerahill/aospy/statuses/{sha}","languages_url":"https://api.github.com/repos/spencerahill/aospy/languages","stargazers_url":"https://api.github.com/repos/spencerahill/aospy/stargazers","contributors_url":"https://api.github.com/repos/spencerahill/aospy/contributors","subscribers_url":"https://api.github.com/repos/spencerahill/aospy/subscribers","subscription_url":"https://api.github.com/repos/spencerahill/aospy/subscription","commits_url":"https://api.github.com/repos/spencerahill/aospy/commits{/sha}","git_commits_url":"https://api.github.com/repos/spencerahill/aospy/git/commits{/sha}","comments_url":"https://api.github.com/repos/spencerahill/aospy/comments{/number}","issue_comment_url":"https://api.github.com/repos/spencerahill/aospy/issues/comments{/number}","contents_url":"https://api.github.com/repos/spencerahill/aospy/contents/{+path}","compare_url":"https://api.github.com/repos/spencerahill/aospy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spencerahill/aospy/merges","archive_url":"https://api.github.com/repos/spencerahill/aospy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spencerahill/aospy/downloads","issues_url":"https://api.github.com/repos/spencerahill/aospy/issues{/number}","pulls_url":"https://api.github.com/repos/spencerahill/aospy/pulls{/number}","milestones_url":"https://api.github.com/repos/spencerahill/aospy/milestones{/number}","notifications_url":"https://api.github.com/repos/spencerahill/aospy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spencerahill/aospy/labels{/name}","releases_url":"https://api.github.com/repos/spencerahill/aospy/releases{/id}","deployments_url":"https://api.github.com/repos/spencerahill/aospy/deployments","created_at":"2015-06-11T01:12:43Z","updated_at":"2016-11-26T12:33:14Z","pushed_at":"2017-01-11T22:08:10Z","git_url":"git://github.com/spencerahill/aospy.git","ssh_url":"git@github.com:spencerahill/aospy.git","clone_url":"https://github.com/spencerahill/aospy.git","svn_url":"https://github.com/spencerahill/aospy","homepage":null,"size":2714,"stargazers_count":14,"watchers_count":14,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":45,"forks":1,"open_issues":45,"watchers":14,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/spencerahill/aospy/pulls/113"},"html":{"href":"https://github.com/spencerahill/aospy/pull/113"},"issue":{"href":"https://api.github.com/repos/spencerahill/aospy/issues/113"},"comments":{"href":"https://api.github.com/repos/spencerahill/aospy/issues/113/comments"},"review_comments":{"href":"https://api.github.com/repos/spencerahill/aospy/pulls/113/comments"},"review_comment":{"href":"https://api.github.com/repos/spencerahill/aospy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spencerahill/aospy/pulls/113/commits"},"statuses":{"href":"https://api.github.com/repos/spencerahill/aospy/statuses/192a174fb3709025555ee23c129f12953119c01c"}}}}
{"actor":{"display_login":"spencerahill"}}