Created
May 21, 2016 22:04
-
-
Save brennv/bbf5c94407e304309e0438e74727eba6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ephem | |
def is_daytime(city): | |
sun = ephem.Sun() | |
locale = ephem.city(city) | |
sun.compute(locale) | |
twilight = -12 * ephem.degree | |
is_sunlight = sun.alt > twilight | |
return is_sunlight |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment