Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

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

share|improve this question
    
OK, If have the long and lat, how to get the local time ? –  Mina Samy Oct 20 '11 at 12:10

1 Answer 1

http://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:

import ephem
o = ephem.Observer()
# lon/lat for LA
o.lon = "118:15:00"    
o.lat = "34:03"
sun = ephem.Sun(o)
sun.alt
sun.az

But since you want the inverse, you can get the alt/az as a function of time:

import datetime
dt5 = datetime.timedelta(minutes=5)
time = datetime.datetime.now()
alt,az,times = [],[],[]
for ii in xrange(100): # do 100 steps of 5 minutes
    time = time+dt5
    o.date = time.strftime("%Y/%m/%d %H:%M:%S")
    sun.compute(o)
    alt.append(sun.alt)
    az.append(sun.az)
    times.append(o.date)

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

share|improve this answer
    
Thanks for the answer, but the altitude is calculated by this equation: sin theta=cos hcos DCos Lat+sin D*sin Lat, where h is the hour angle too, how to solve this –  Mina Samy Oct 22 '11 at 11:39
    
Altitude refers to the angle the sun appears at above the horizon. You have to have it as an input. The way your question was phrased, I assumed that the sun's position (i.e., altitude and azimuth) were known. –  keflavich Oct 23 '11 at 14:44
    
ok, thanks anyway –  Mina Samy Oct 23 '11 at 15:29
    
Could you clarify what you meant in your original question if my answer doesn't satisfy it? What did you mean by "the input would be the sun position" ? –  keflavich Oct 23 '11 at 15:35
    
The sun position is its azimuth and elevation, I was wondering if I can predict the time where the sun's Azimuth would be in a certain position (azimuth) regardless of the elevation. –  Mina Samy Oct 24 '11 at 12:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.