from IPython.display import HTML
HTML('')
HTML('')
HTML('')
import time
nticks = time.time()
print "It is now %f ticks (seconds) past epoch" % nticks
print "Year (Min, Max): (%d, %d)" % (datetime.MINYEAR, datetime.MAXYEAR)
localtime = time.localtime(time.time())
print "local time is:\n\t", localtime
print "local time is:\n\t", time.asctime(localtime)
import datetime
# what timezone are you in
print time.tzname
The equation of time (EOT) is a formula used in the process of converting between solar time and clock time to compensate for the earth's elliptical orbit around the sun and its axial tilt. Essentially, the earth does not move perfectly smoothly in a perfectly circular orbit, so the EOT adjusts for that.
N=np.arange(361)
B=360*(N-81)/365.0 * np.pi/180.0
E=9.87*np.sin(2*B) - 7.53*np.cos(B) - 1.5*np.sin(B)
fig=plt.figure()
ax=fig.add_subplot(111)
ax.grid()
ax.set_xlim(-5,365)
ax.set_ylim(-17,20)
ax.set_xlabel('Day of Year')
ax.set_ylabel('Time Adjustment (min)')
ax.set_title('Equation of Time')
ax.plot(N,E,'ro')
plt.show()
The EOT can be approximated by the following formula:
import calendar
# set Sunday as 1st column
calendar.setfirstweekday(6)
# show calendar for a month
cal = calendar.month(2012,11)
print cal
# show calendar for a year
cal2 = calendar.calendar(2012)
print cal2
from IPython.display import YouTubeVideo
YouTubeVideo('MTx6ha6fRwo')