====== Sunset hour angle ====== The sunset hour angle is given by: $$ \omega_s = arccos(-tan(\phi)*tan(\delta))$$ where $\phi$ is the latitude of the site. The latitude is positive for the northern hermisphere and negative for the southern hemisphere. The symbol $\delta$ is the [[en:hydro:solar-declination|solar declination]] in radians. The sunset hour angle is needed for the calculation of [[en:hydro:daylight-hours|daylight hours]]. For a given latitude $\phi$ and using the [[en:hydro:solar-declination|solar declination]] as a function of the Julian day number $J$ 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()