[Tutor] Angles
Carlos
carloslara at web.de
Wed Nov 29 17:41:22 CET 2006
Thanks Terry and Roel,
I got it working now, the problem was a sign situation. I fixed it this way:
from math import *
def Az(Lat, Dec, H_Ang):
lat_R = radians(Lat)
decl_R = radians(Dec)
hour_R = radians(H_Ang)
x_azm = sin(hour_R) * cos(decl_R)
y_azm = (-(cos(hour_R))*cos(decl_R)*sin(lat_R))+(cos(lat_R)*
sin(decl_R))
if Lat > 0:
y_azm = y_azm * -1
Azimuth = degrees(atan2(x_azm, y_azm))
return Azimuth
The if conditional tells the system wether the sun is east or west.
Looks like this fixes it.
Cheers
More information about the Tutor
mailing list