The sunset hour angle is given by:
where is the latitude of the site. The latitude is positive for the northern hermisphere and negative for the southern hemisphere. The symbol
is the solar declination in radians. The sunset hour angle is needed for the calculation of daylight hours.
For a given latitude and using the solar declination as a function of the Julian day number
the sunset hour angle can be calculated with the following Python code. Exampe: latitude = 48 degrees north.
from pylab import * from numpy import * def sunsetangle(latitude,J): ds=0.4093*sin(2*pi/365*J-1.405) # to be replaced by class sha=arccos(-tan(latitude)*tan(ds)) return sha latitude=48 J=arange(1,365,1) plot(J,sunsetangle(latitude,J)) ytext = ylabel('sunset hour angle') xtext = xlabel('Julian day') show()