Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First: simply use proportionality, angular velocity of the sun moving is constant solution in Clear category for Sun Angle by leggewie
def sun_angle(time):
# minutes-after-6AM
hours, minutes = time.split(":") # returned values are str
ma6 = 60*(int(hours)-6) + int(minutes)
# advacing degrees-per-minute (angular velocity is constant)
dpm = 180/(12*60)
if ma6 >= 0 and ma6 <= 720:
# daytime
return ma6*dpm
else:
# night-time
return "I don't see the sun!"
May 31, 2021
Comments: