Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
S = radians(S)
plane_azimuth=radians(plane_azimuth)
n = d.timetuple().tm_yday
#delta = declination of the sun
delta = radians(-23.44) * cos((2*pi/365)*(n+10))
# phi = latitude
phi = radians(latitude)
#omega = hour angle
#crude hack
offset = 12
omega = (d.hour+offset)*15*(pi/180)
H = s.HourAngle(d,longitude)
#print "%s,%s,%s" % ( H, degrees(omega), H+degrees(omega))
#omega = - s.HourAngle(utc,longitude)
#H = v - longitude - right_ascention
#thetaZ = solar zenith
thetaZ = arccos(sin(phi)*sin(delta)+cos(phi)*cos(delta)*cos(omega))
Z = thetaZ
solar_azimuth = azimuth(phi,delta,omega)
#theta = incident angle
theta = arccos(sin(S)*sin(Z)*cos(solar_azimuth-plane_azimuth) + \
cos(S)*cos(Z))
return theta, Z #, zenith