{"action":"created","comment":{"url":"https://api.github.com/repos/astroplanners/astroplan/pulls/comments/34846909","id":34846909,"diff_hunk":"@@ -158,6 +157,52 @@ def __init__(self, location=None, timezone='UTC', name=None, latitude=None,\n             raise TypeError('timezone keyword should be a string, or an '\n                             'instance of datetime.tzinfo')\n \n+    def astropy_to_local_time(self, astropy_time):\n+        '''\n+        Convert the `~astropy.time.Time` object ``astropy_time`` to a\n+        localized `~datetime.datetime` object.\n+\n+        Parameters\n+        ----------\n+        time : `~astropy.time.Time`","path":"astroplan/core.py","position":24,"original_position":24,"commit_id":"c7e7ea342498954b25c754d2edfaadc6cbf6f351","original_commit_id":"c7e7ea342498954b25c754d2edfaadc6cbf6f351","user":{"login":"bmorris3","id":3497584,"avatar_url":"https://avatars.githubusercontent.com/u/3497584?v=3","gravatar_id":"","url":"https://api.github.com/users/bmorris3","html_url":"https://github.com/bmorris3","followers_url":"https://api.github.com/users/bmorris3/followers","following_url":"https://api.github.com/users/bmorris3/following{/other_user}","gists_url":"https://api.github.com/users/bmorris3/gists{/gist_id}","starred_url":"https://api.github.com/users/bmorris3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmorris3/subscriptions","organizations_url":"https://api.github.com/users/bmorris3/orgs","repos_url":"https://api.github.com/users/bmorris3/repos","events_url":"https://api.github.com/users/bmorris3/events{/privacy}","received_events_url":"https://api.github.com/users/bmorris3/received_events","type":"User","site_admin":false},"body":"Ah, got it.","created_at":"2015-07-16T22:50:11Z","updated_at":"2015-07-16T22:50:11Z","html_url":"https://github.com/astroplanners/astroplan/pull/22#discussion_r34846909","pull_request_url":"https://api.github.com/repos/astroplanners/astroplan/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/comments/34846909"},"html":{"href":"https://github.com/astroplanners/astroplan/pull/22#discussion_r34846909"},"pull_request":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/astroplanners/astroplan/pulls/22","id":39852858,"html_url":"https://github.com/astroplanners/astroplan/pull/22","diff_url":"https://github.com/astroplanners/astroplan/pull/22.diff","patch_url":"https://github.com/astroplanners/astroplan/pull/22.patch","issue_url":"https://api.github.com/repos/astroplanners/astroplan/issues/22","number":22,"state":"open","locked":false,"title":"Timezone convenience methods","user":{"login":"bmorris3","id":3497584,"avatar_url":"https://avatars.githubusercontent.com/u/3497584?v=3","gravatar_id":"","url":"https://api.github.com/users/bmorris3","html_url":"https://github.com/bmorris3","followers_url":"https://api.github.com/users/bmorris3/followers","following_url":"https://api.github.com/users/bmorris3/following{/other_user}","gists_url":"https://api.github.com/users/bmorris3/gists{/gist_id}","starred_url":"https://api.github.com/users/bmorris3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmorris3/subscriptions","organizations_url":"https://api.github.com/users/bmorris3/orgs","repos_url":"https://api.github.com/users/bmorris3/repos","events_url":"https://api.github.com/users/bmorris3/events{/privacy}","received_events_url":"https://api.github.com/users/bmorris3/received_events","type":"User","site_admin":false},"body":"Here are some convenience methods for switching between timezones when using the `Observer` class, requested by @eteq and @ejeschke. On Slack, @eteq gave the following mini example API:\r\n\r\n```python\r\n>>> obs = Observer(…,timezone=pytz.timezone('US/Eastern'),…)\r\n>>> t = Time(57100.3, format='mjd')\r\n>>> obs.time_to_local_time(t)\r\ndatetime.datetime(2015, 3, 19, 3, 12, tzinfo=<DstTzInfo 'US/Eastern' EDT-1 day, 20:00:00 DST>)\r\n>>> dt = datetime.datetime(2015, 3, 19, 3, 12) #this is naive\r\n>>> obs.local_time_to_time(dt)\r\n<Time object: scale='utc' format='datetime' value=2015-03-19 07:12:00>\r\n>>> dt = datetime.datetime(2015, 3, 19, 3, 12, tzinfo=pytz.timezone('US/Pacific'))\r\n>>> obs.local_time_to_time(dt)\r\nValueError: timezone of input and Observer.timezone don’t match!\r\n```\r\nwhich was the template for this PR.","created_at":"2015-07-13T20:29:48Z","updated_at":"2015-07-16T22:50:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"166f9cb32a865cb9b08a5400505be1e532ef0f9c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/astroplanners/astroplan/pulls/22/commits","review_comments_url":"https://api.github.com/repos/astroplanners/astroplan/pulls/22/comments","review_comment_url":"https://api.github.com/repos/astroplanners/astroplan/pulls/comments{/number}","comments_url":"https://api.github.com/repos/astroplanners/astroplan/issues/22/comments","statuses_url":"https://api.github.com/repos/astroplanners/astroplan/statuses/c7e7ea342498954b25c754d2edfaadc6cbf6f351","head":{"label":"bmorris3:timezones","ref":"timezones","sha":"c7e7ea342498954b25c754d2edfaadc6cbf6f351","user":{"login":"bmorris3","id":3497584,"avatar_url":"https://avatars.githubusercontent.com/u/3497584?v=3","gravatar_id":"","url":"https://api.github.com/users/bmorris3","html_url":"https://github.com/bmorris3","followers_url":"https://api.github.com/users/bmorris3/followers","following_url":"https://api.github.com/users/bmorris3/following{/other_user}","gists_url":"https://api.github.com/users/bmorris3/gists{/gist_id}","starred_url":"https://api.github.com/users/bmorris3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmorris3/subscriptions","organizations_url":"https://api.github.com/users/bmorris3/orgs","repos_url":"https://api.github.com/users/bmorris3/repos","events_url":"https://api.github.com/users/bmorris3/events{/privacy}","received_events_url":"https://api.github.com/users/bmorris3/received_events","type":"User","site_admin":false},"repo":{"id":34740000,"name":"astroplan","full_name":"bmorris3/astroplan","owner":{"login":"bmorris3","id":3497584,"avatar_url":"https://avatars.githubusercontent.com/u/3497584?v=3","gravatar_id":"","url":"https://api.github.com/users/bmorris3","html_url":"https://github.com/bmorris3","followers_url":"https://api.github.com/users/bmorris3/followers","following_url":"https://api.github.com/users/bmorris3/following{/other_user}","gists_url":"https://api.github.com/users/bmorris3/gists{/gist_id}","starred_url":"https://api.github.com/users/bmorris3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmorris3/subscriptions","organizations_url":"https://api.github.com/users/bmorris3/orgs","repos_url":"https://api.github.com/users/bmorris3/repos","events_url":"https://api.github.com/users/bmorris3/events{/privacy}","received_events_url":"https://api.github.com/users/bmorris3/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bmorris3/astroplan","description":"Observation planning package for astronomers","fork":true,"url":"https://api.github.com/repos/bmorris3/astroplan","forks_url":"https://api.github.com/repos/bmorris3/astroplan/forks","keys_url":"https://api.github.com/repos/bmorris3/astroplan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bmorris3/astroplan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bmorris3/astroplan/teams","hooks_url":"https://api.github.com/repos/bmorris3/astroplan/hooks","issue_events_url":"https://api.github.com/repos/bmorris3/astroplan/issues/events{/number}","events_url":"https://api.github.com/repos/bmorris3/astroplan/events","assignees_url":"https://api.github.com/repos/bmorris3/astroplan/assignees{/user}","branches_url":"https://api.github.com/repos/bmorris3/astroplan/branches{/branch}","tags_url":"https://api.github.com/repos/bmorris3/astroplan/tags","blobs_url":"https://api.github.com/repos/bmorris3/astroplan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bmorris3/astroplan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bmorris3/astroplan/git/refs{/sha}","trees_url":"https://api.github.com/repos/bmorris3/astroplan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bmorris3/astroplan/statuses/{sha}","languages_url":"https://api.github.com/repos/bmorris3/astroplan/languages","stargazers_url":"https://api.github.com/repos/bmorris3/astroplan/stargazers","contributors_url":"https://api.github.com/repos/bmorris3/astroplan/contributors","subscribers_url":"https://api.github.com/repos/bmorris3/astroplan/subscribers","subscription_url":"https://api.github.com/repos/bmorris3/astroplan/subscription","commits_url":"https://api.github.com/repos/bmorris3/astroplan/commits{/sha}","git_commits_url":"https://api.github.com/repos/bmorris3/astroplan/git/commits{/sha}","comments_url":"https://api.github.com/repos/bmorris3/astroplan/comments{/number}","issue_comment_url":"https://api.github.com/repos/bmorris3/astroplan/issues/comments{/number}","contents_url":"https://api.github.com/repos/bmorris3/astroplan/contents/{+path}","compare_url":"https://api.github.com/repos/bmorris3/astroplan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bmorris3/astroplan/merges","archive_url":"https://api.github.com/repos/bmorris3/astroplan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bmorris3/astroplan/downloads","issues_url":"https://api.github.com/repos/bmorris3/astroplan/issues{/number}","pulls_url":"https://api.github.com/repos/bmorris3/astroplan/pulls{/number}","milestones_url":"https://api.github.com/repos/bmorris3/astroplan/milestones{/number}","notifications_url":"https://api.github.com/repos/bmorris3/astroplan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bmorris3/astroplan/labels{/name}","releases_url":"https://api.github.com/repos/bmorris3/astroplan/releases{/id}","created_at":"2015-04-28T15:47:16Z","updated_at":"2015-04-28T15:47:16Z","pushed_at":"2015-07-16T17:51:29Z","git_url":"git://github.com/bmorris3/astroplan.git","ssh_url":"git@github.com:bmorris3/astroplan.git","clone_url":"https://github.com/bmorris3/astroplan.git","svn_url":"https://github.com/bmorris3/astroplan","homepage":"https://astroplan.readthedocs.org/","size":504,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"astroplanners:master","ref":"master","sha":"8edfe5f3e193b4d0b95c7d1b0383587776fd1c94","user":{"login":"astroplanners","id":12143843,"avatar_url":"https://avatars.githubusercontent.com/u/12143843?v=3","gravatar_id":"","url":"https://api.github.com/users/astroplanners","html_url":"https://github.com/astroplanners","followers_url":"https://api.github.com/users/astroplanners/followers","following_url":"https://api.github.com/users/astroplanners/following{/other_user}","gists_url":"https://api.github.com/users/astroplanners/gists{/gist_id}","starred_url":"https://api.github.com/users/astroplanners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astroplanners/subscriptions","organizations_url":"https://api.github.com/users/astroplanners/orgs","repos_url":"https://api.github.com/users/astroplanners/repos","events_url":"https://api.github.com/users/astroplanners/events{/privacy}","received_events_url":"https://api.github.com/users/astroplanners/received_events","type":"Organization","site_admin":false},"repo":{"id":34693515,"name":"astroplan","full_name":"astroplanners/astroplan","owner":{"login":"astroplanners","id":12143843,"avatar_url":"https://avatars.githubusercontent.com/u/12143843?v=3","gravatar_id":"","url":"https://api.github.com/users/astroplanners","html_url":"https://github.com/astroplanners","followers_url":"https://api.github.com/users/astroplanners/followers","following_url":"https://api.github.com/users/astroplanners/following{/other_user}","gists_url":"https://api.github.com/users/astroplanners/gists{/gist_id}","starred_url":"https://api.github.com/users/astroplanners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astroplanners/subscriptions","organizations_url":"https://api.github.com/users/astroplanners/orgs","repos_url":"https://api.github.com/users/astroplanners/repos","events_url":"https://api.github.com/users/astroplanners/events{/privacy}","received_events_url":"https://api.github.com/users/astroplanners/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/astroplanners/astroplan","description":"Observation planning package for astronomers","fork":false,"url":"https://api.github.com/repos/astroplanners/astroplan","forks_url":"https://api.github.com/repos/astroplanners/astroplan/forks","keys_url":"https://api.github.com/repos/astroplanners/astroplan/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astroplanners/astroplan/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astroplanners/astroplan/teams","hooks_url":"https://api.github.com/repos/astroplanners/astroplan/hooks","issue_events_url":"https://api.github.com/repos/astroplanners/astroplan/issues/events{/number}","events_url":"https://api.github.com/repos/astroplanners/astroplan/events","assignees_url":"https://api.github.com/repos/astroplanners/astroplan/assignees{/user}","branches_url":"https://api.github.com/repos/astroplanners/astroplan/branches{/branch}","tags_url":"https://api.github.com/repos/astroplanners/astroplan/tags","blobs_url":"https://api.github.com/repos/astroplanners/astroplan/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astroplanners/astroplan/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astroplanners/astroplan/git/refs{/sha}","trees_url":"https://api.github.com/repos/astroplanners/astroplan/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astroplanners/astroplan/statuses/{sha}","languages_url":"https://api.github.com/repos/astroplanners/astroplan/languages","stargazers_url":"https://api.github.com/repos/astroplanners/astroplan/stargazers","contributors_url":"https://api.github.com/repos/astroplanners/astroplan/contributors","subscribers_url":"https://api.github.com/repos/astroplanners/astroplan/subscribers","subscription_url":"https://api.github.com/repos/astroplanners/astroplan/subscription","commits_url":"https://api.github.com/repos/astroplanners/astroplan/commits{/sha}","git_commits_url":"https://api.github.com/repos/astroplanners/astroplan/git/commits{/sha}","comments_url":"https://api.github.com/repos/astroplanners/astroplan/comments{/number}","issue_comment_url":"https://api.github.com/repos/astroplanners/astroplan/issues/comments{/number}","contents_url":"https://api.github.com/repos/astroplanners/astroplan/contents/{+path}","compare_url":"https://api.github.com/repos/astroplanners/astroplan/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astroplanners/astroplan/merges","archive_url":"https://api.github.com/repos/astroplanners/astroplan/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astroplanners/astroplan/downloads","issues_url":"https://api.github.com/repos/astroplanners/astroplan/issues{/number}","pulls_url":"https://api.github.com/repos/astroplanners/astroplan/pulls{/number}","milestones_url":"https://api.github.com/repos/astroplanners/astroplan/milestones{/number}","notifications_url":"https://api.github.com/repos/astroplanners/astroplan/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astroplanners/astroplan/labels{/name}","releases_url":"https://api.github.com/repos/astroplanners/astroplan/releases{/id}","created_at":"2015-04-27T22:00:00Z","updated_at":"2015-07-09T05:17:38Z","pushed_at":"2015-07-16T21:02:45Z","git_url":"git://github.com/astroplanners/astroplan.git","ssh_url":"git@github.com:astroplanners/astroplan.git","clone_url":"https://github.com/astroplanners/astroplan.git","svn_url":"https://github.com/astroplanners/astroplan","homepage":"https://astroplan.readthedocs.org/","size":875,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":15,"forks":6,"open_issues":15,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/22"},"html":{"href":"https://github.com/astroplanners/astroplan/pull/22"},"issue":{"href":"https://api.github.com/repos/astroplanners/astroplan/issues/22"},"comments":{"href":"https://api.github.com/repos/astroplanners/astroplan/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/astroplanners/astroplan/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/astroplanners/astroplan/statuses/c7e7ea342498954b25c754d2edfaadc6cbf6f351"}}}}