Skip to content

Instantly share code, notes, and snippets.

View jjstrydom's full-sized avatar
:octocat:

Jurgen Strydom jjstrydom

:octocat:
View GitHub Profile
@jgomezdans
jgomezdans / sun_position.py
Created December 8, 2010 19:12
Finding the position of the sun
def sun_position ( date, hour, longitude, latitude ):
"""
Calculates the position of the sun given a position and time.
Basically, all you need to know is here:
http://answers.google.com/answers/threadview/id/782886.html
"""
import time
from math import sin, cos, degrees, radians, acos
doy = int ( time.strftime( "%j", time.strptime( date, "%Y-%m-%d" ) ) )