Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Is the sun up in Columbus? Using PyEphem to figure it out
import ephem
def is_the_sun_up():
columbus ='Columbus')
sun = ephem.Sun()
columbus.pressure = 0
twilight = -6 *
return sun.alt > twilight
# Civil Twilight is defined as ending / beginning when the sun is 6 degrees below the horizon.
# Setting the pressure to 0 is to turn off atmospheric scattering calculations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment