Skip to content

Instantly share code, notes, and snippets.

@drhirsch
Created September 2, 2016 05:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save drhirsch/6951e6e051510309b375614ca1bdc1ee to your computer and use it in GitHub Desktop.
Save drhirsch/6951e6e051510309b375614ca1bdc1ee to your computer and use it in GitHub Desktop.
import ephem
import datetime
now = datetime.datetime.now() #get current time
Boston=ephem.Observer()
Boston.pressure = 1010 # millibar
Boston.temp = 25 # deg. Celcius
Boston.horizon = 0
Boston.lat='42.3462'
Boston.lon='-71.0978'
Boston.elevation = 3 # meters
Boston.date = now
sun = ephem.Sun()
print("Next sunrise in Boston will be: ",ephem.localtime(Boston.next_rising(sun)))
print("Next sunset in Boston will be: ",ephem.localtime(Boston.next_setting(sun)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment