====== Daylight hours ====== The maximum possible daylight hours can be calculated as: $$ N = \frac {24}{\pi}*\omega_s $$ where $\omega_s$ is the [[en:hydro:sunset-hour-angle|sunset hour angle]] in radians. The following Python code demonstrates the calculation of possible daylight hours based on the calculation of [[en:hydro:sunset-hour-angle|sunset hour angles]] that depend on the calculation of [[en:hydro:solar-declination|solar declination]] from pylab import * from numpy import * def daylighthours(latitude,J): ds=0.4093*sin(2*pi/365*J-1.405) # to be replaced by class sha=arccos(-tan(latitude)*tan(ds)) # to be replaced by class dh=24/pi*sha return dh latitude=23 J=arange(1,365,1) plot(J,daylighthours(latitude,J)) ytext = ylabel('daylight hours') xtext = xlabel('Julian day') show() ~~ODT~~