{"action":"created","issue":{"url":"https://api.github.com/repos/astroplanners/astroplan/issues/26","labels_url":"https://api.github.com/repos/astroplanners/astroplan/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/astroplanners/astroplan/issues/26/comments","events_url":"https://api.github.com/repos/astroplanners/astroplan/issues/26/events","html_url":"https://github.com/astroplanners/astroplan/pull/26","id":95259179,"number":26,"title":"Sites","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},"labels":[{"url":"https://api.github.com/repos/astroplanners/astroplan/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/astroplanners/astroplan/labels/final-review","name":"final-review","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"eteq","id":346587,"avatar_url":"https://avatars.githubusercontent.com/u/346587?v=3","gravatar_id":"","url":"https://api.github.com/users/eteq","html_url":"https://github.com/eteq","followers_url":"https://api.github.com/users/eteq/followers","following_url":"https://api.github.com/users/eteq/following{/other_user}","gists_url":"https://api.github.com/users/eteq/gists{/gist_id}","starred_url":"https://api.github.com/users/eteq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eteq/subscriptions","organizations_url":"https://api.github.com/users/eteq/orgs","repos_url":"https://api.github.com/users/eteq/repos","events_url":"https://api.github.com/users/eteq/events{/privacy}","received_events_url":"https://api.github.com/users/eteq/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/astroplanners/astroplan/milestones/1","html_url":"https://github.com/astroplanners/astroplan/milestones/0.1%20release","labels_url":"https://api.github.com/repos/astroplanners/astroplan/milestones/1/labels","id":1087263,"number":1,"title":"0.1 release","description":"First release","creator":{"login":"cdeil","id":852409,"avatar_url":"https://avatars.githubusercontent.com/u/852409?v=3","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":7,"state":"open","created_at":"2015-04-28T11:35:13Z","updated_at":"2015-07-21T22:31:12Z","due_on":"2015-08-09T22:00:00Z","closed_at":null},"comments":17,"created_at":"2015-07-15T18:24:24Z","updated_at":"2015-07-22T15:46:47Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/astroplanners/astroplan/pulls/26","html_url":"https://github.com/astroplanners/astroplan/pull/26","diff_url":"https://github.com/astroplanners/astroplan/pull/26.diff","patch_url":"https://github.com/astroplanners/astroplan/pull/26.patch"},"body":"I've implemented here a simple site importing tool, as the basis for discussion amongst @astroplanners/astroplanners-contributors on what we want our site tool to look like. A user can get an `EarthLocation` object for known observatories with the following syntax: \r\n```python\r\n>>> from astroplan import get_site, Observer\r\n>>> keck = get_site('Keck')\r\n>>> obs = Observer(location=keck)\r\n>>> print(keck.to_geodetic())\r\n(<Longitude -155.47833333333332 deg>, <Latitude 19.828333333333326 deg>, \r\n <Quantity 4160.000000000752 m>)\r\n```\r\nThere are several aliases for each observatory, and if the queried name is not recognized, a `KeyError` is raised with an informative error message that suggests fuzzy matches (using `difflib`, thanks @adrn!). For example, searching for `'keck obs'` raises the following error:\r\n\r\n```python\r\nIn [1]: import astroplan; astroplan.get_site(str('keck obs'))\r\n---------------------------------------------------------------------------\r\nKeyError                                  Traceback (most recent call last)\r\n<ipython-input-1-7986be699dec> in <module>()\r\n----> 1 import astroplan; astroplan.get_site(str('keck obs'))\r\n\r\nastroplan/astroplan/core.py in get_site(site_name)\r\n    126             errmsg = ('Site not in database. `use get_site_names()` to see '\r\n    127                       'available sites.')\r\n--> 128         raise KeyError(errmsg)\r\n    129 \r\n    130     return _site_db[site_name.lower()]\r\n\r\nKeyError: u\"Site not in database. `use get_site_names()` to see available sites. \r\nDid you mean: 'keck observatory', 'keck'?\"\r\n```"},"comment":{"url":"https://api.github.com/repos/astroplanners/astroplan/issues/comments/123764513","html_url":"https://github.com/astroplanners/astroplan/pull/26#issuecomment-123764513","issue_url":"https://api.github.com/repos/astroplanners/astroplan/issues/26","id":123764513,"user":{"login":"eteq","id":346587,"avatar_url":"https://avatars.githubusercontent.com/u/346587?v=3","gravatar_id":"","url":"https://api.github.com/users/eteq","html_url":"https://github.com/eteq","followers_url":"https://api.github.com/users/eteq/followers","following_url":"https://api.github.com/users/eteq/following{/other_user}","gists_url":"https://api.github.com/users/eteq/gists{/gist_id}","starred_url":"https://api.github.com/users/eteq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eteq/subscriptions","organizations_url":"https://api.github.com/users/eteq/orgs","repos_url":"https://api.github.com/users/eteq/repos","events_url":"https://api.github.com/users/eteq/events{/privacy}","received_events_url":"https://api.github.com/users/eteq/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T15:46:46Z","updated_at":"2015-07-22T15:46:46Z","body":"@bmorris3 - the travis/sphinx problem is because you don't have an ``__all__`` in `sites.py`.  Without that , ``from .sites import *`` pulls in everything, including all of the imports you have at the top of the module.  So then sphinx tries to document all of those, but of course it gets confused because they aren't part of `astroplan`.  So if you add an ``__all__ = ['get_site', 'get_site_names', 'add_site']``, it should work.\r\n\r\nOn @adrn's bit about lat/lon/consistency... I was persuaded by @bmorris3's point about correct levels of precision that we should at least allow string-like formatting.  But I see your point about the inconsistency with `elevation_meters`.  Perhaps the thing to do is to allow `elevation` to be a unitful string as well?  This would be fairly straightforward: something like:\r\n```\r\nnumberstr, unit = db[site]['elevation'].split()\r\nelevation = u.Quantity(float(numberstr), unit)\r\n``` \r\n?\r\n\r\nRe @cdeil's suggestion: I'm :+1: on including info about where the data comes from - a natural place might be the docstring for the ``sites`` module.  In addition, I suggest adding a key-value pair to each entry called ``\"source\"`` or something like that, which just takes a string describing where that entry came from.  This wouldn't be used at all in the code, but works as a form of documentation for anyone reading the JSON file.\r\n\r\nBut I'm -0 on including the generating script - if I understand right it would only be useful for the one particular data source (it's the IRAF database, right?), and JSON's a pretty trivial format to work with."}}