To find the sun's position (elevation, azimuth) we can use many algorithms including the PSA algorithm.
These algorithm share the fact that the input is the local time, longitude and latitude and the output is the elevation and azimuth.
is there any algorithms that we can use to reverse this, the input would be the sun position and the output would be the local time ?
thanks
Best Answer
https://stackoverflow.com/questions/257717/position-of-the-sun-given-time-of-day-and-lat-long has a good set of descriptions of how to do approximately what you want. In short, you either want to use a code or look up the sun's ephemeris.
Using pyephem, for example:
But since you want the inverse, you can get the alt/az as a function of time:
You can then invert this data to find time as a function of alt/az. That doesn't quite answer your question, though - I'll keep an eye out for a direct answer.
Edit: A direct answer.
The Hour Angle
HA
is the current time referenced to Solar noon. It can be computed by:$$\cos(HA) = \frac{\sin(alt_\odot) - \sin(\delta_\odot) \sin(Latitude)}{cos(\delta_\odot)} $$ Where $alt_\odot$ is the altitude or elevation angle of the sun and $\delta_\odot$ is the declination of the sun and can be approximated by: $$\delta_\odot = -23.44^o \cos\left(\frac{360^o}{365} (N+10)\right)$$ where $N$ is the ordinal date and is 1 at January 1st