Created
April 18, 2019 23:06
-
-
Save craigcalef/924cdd28475bc21e3f9319caf3b4b311 to your computer and use it in GitHub Desktop.
Calculate length of day change over the year
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 | |
import datetime | |
# ephem.localtime(ephem.next_summer_solstice('2019-1-1')) | |
s = ephem.Sun() | |
o = ephem.city('Boston') | |
yesterday_len = 0 | |
for i in range(0, 365): | |
d = datetime.datetime(2019,1,1,16,0) + datetime.timedelta(i) | |
o.date = d | |
daylen = o.next_setting(s) - o.previous_rising(s) | |
#print("{},{},{}".format(d, o.previous_rising(s), o.next_setting(s), (daylen-yesterday_len))) | |
print("{},{}".format(d, (daylen-yesterday_len))) | |
yesterday_len = daylen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment