Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

[sci.astro] Time (Astronomy Frequently Asked Questions) (3/9)
Section - C.03 How do I compute astronomical phenomena for my location?

( Part0 - Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Houses ]


Top Document: [sci.astro] Time (Astronomy Frequently Asked Questions) (3/9)
Previous Document: C.02 What are all those different kinds of time?
Next Document: C.04 What's a Julian date? modified Julian date?
See reader questions & answers on this topic! - Help others by sharing your knowledge

	COMPUTING AZIMUTH AND ELEVATION
	-------------------------------

To compute the azimuth and elevation of an object, you first must
compute the Local Sidereal Time of the place and time in question.
First convert your local time to UT (Universal Time), with the date
adjusted if needed.  Now suppose that the time is Y,M,D,UT where Y,M,D
is the calendar Year, Month (1--12) and Date (1--31), and UT is the
Universal Time in hours+fractions.  Also suppose your position is
lat,long, where lat is counted as + if north and - if south, and long
is counted as + if east and - if west.  Now, first compute a "day
number", d:

                7*(Y + INT((M+9)/12))
d = 367*Y - INT(---------------------) + INT(275*M/9) + D - 730530 + UT/24
                         4

where INT is a function that discards the fractional part and returns the
integer part of a function.  d is zero at 2000 Jan 0.0

Now compute the Local Sidereal Time, LST:

   LST  =  98.9818  +  0.985647352 * d  +  UT*15  +  long

(east long. positive).  Note that LST is here expressed in degrees,
where 15 degrees corresponds to one hour.  Since LST really is an angle,
it's convenient to use one unit---degrees---throughout.

Now, suppose your object resides at a known RA (Right Ascension) and
Dec (Declination).  Convert both RA and Dec to degrees + decimals,
remembering that 1 hour of RA corresponds to 15 degrees of RA.

Next, compute the Hour Angle:

   HA  =  LST - RA

Now you can compute the Altitude, h, and the Azimuth, az:

  sin(h)   =  sin(lat) * sin(Dec)  +  cos(lat) * cos(Dec) * cos(HA)

                                sin(HA)
  tan(az)  =  --------------------------------------------
              cos(HA) * sin(lat)  -  tan(Dec) * cos(Lat)

Here az is 0 deg in the south, 90 deg in the west etc.  If you prefer
0 deg in the north and 90 deg in the east, add 180 degrees to az.


	A NOTE ON TRIGONOMETRIC FUNCTIONS ON YOUR COMPUTER
	--------------------------------------------------

If you have an atan2() function (or equivalent) available on your
computer, compute the numerator and denominator separately and feed
them both to your atan2() function, instead of dividing and feeding
them to your atan() function---then you'll get the correct quadrant
immediately.  In the "C" language you would thus write:

  az = atan2( sin(HA), cos(HA)*sin(lat)-tan(Dec)*cos(Lat) );

instead of:

  az = atan( sin(HA) / (cos(HA)*sin(lat)-tan(Dec)*cos(Lat)) );

On a scientific calculator, there is often a "rectangular to polar"
coordinate conversion function that does the same thing.

Users of Pascal and other programming languages that lack an atan2()
function are strongly encouraged to write such a function of their
own.  In Pascal it would be (pi is assumed to have been assigned an
appropriate value---one way is to compute: pi := 4.0*arctan(1) ):

   function atan2( y : real, x : real ) real;
   (* Compute arctan(y/x), selecting the correct quadrant *)
   begin
     if x > 0
       atan2 := arctan(y/x)
     else if x < 0
       atan2 := arctan(y/x) + pi
     (* Below x is zero *)
     else if y > 0
       atan2 := pi/2
     else if y < 0
       atan2 := -pi/2
     /* Below both x and y are zero *)
     else
       atan2 := 0.0     (* atan2( 0.0, 0.0 )  is really an error though.. *)
   end

Another trick I also use is to add a set of trig functions that work
in degrees instead of radians to my function library---that will make
life a lot easier when you're working in degrees as the basic unit.  I
name them sind, cosd, atan2d, etc.  If you don't do that, you'll have
to convert between degrees and radians when calling the standard trig
functions.

	COMPUTING RISE AND SET TIMES
	----------------------------

To compute when an object rises or sets, you must compute when it
passes the meridian and the HA of rise/set.  Then the rise time is
the meridian time minus HA for rise/set, and the set time is the
meridian time plus the HA for rise/set.

To find the meridian time, compute the Local Sidereal Time at 0h local
time (or 0h UT if you prefer to work in UT) as outlined above---name
that quantity LST0.  The Meridian Time, MT, will now be:

    MT  =  RA - LST0

where "RA" is the object's Right Ascension (in degrees!).  If negative,
add 360 deg to MT.  If the object is the Sun, leave the time as it is,
but if it's stellar, multiply MT by 365.2422/366.2422, to convert from
sidereal to solar time.  Now, compute HA for rise/set, name that
quantity HA0:

                sin(h0)  -  sin(lat) * sin(Dec)
cos(HA0)  =  ---------------------------------
                     cos(lat) * cos(Dec)

where h0 is the altitude selected to represent rise/set.  For a purely
mathematical horizon, set h0 = 0 and simplify to:

	cos(HA0)  =  - tan(lat) * tan(Dec)

If you want to account for refraction on the atmosphere, set h0 = -35/60
degrees (-35 arc minutes), and if you want to compute the rise/set times
for the Sun's upper limb, set h0 = -50/60 (-50 arc minutes).

When HA0 has been computed, leave it as it is for the Sun but multiply
by 365.2422/366.2422 for stellar objects, to convert from sidereal to
solar time.  Finally compute:

   Rise time  =  MT - HA0
   Set  time  =  MT + HA0

convert the times from degrees to hours by dividing by 15.

If you'd like to check that your calculations are accurate or just
need a quick result, check the USNO's Sun or Moon Rise/Set Table,
<URL:http://aa.usno.navy.mil/AA/data/docs/RS_OneYear.html>.

	COMPUTING THE SUN'S POSITION
	----------------------------

To be able to compute the Sun's rise/set times, you need to be able to
compute the Sun's position at any time.  First compute the "day
number" d as outlined above, for the desired moment.  Next compute:

   oblecl = 23.4393 - 3.563E-7 * d

   w  =  282.9404  +  4.70935E-5   * d
   M  =  356.0470  +  0.9856002585 * d
   e  =  0.016709  -  1.151E-9     * d

This is the obliquity of the ecliptic, plus some of the elements of
the Sun's apparent orbit (i.e., really the Earth's orbit): w =
argument of perihelion, M = mean anomaly, e = eccentricity.
Semi-major axis is here assumed to be exactly 1.0 (while not strictly
true, this is still an accurate approximation).  Next compute E, the
eccentric anomaly:

   E = M + e*(180/pi) * sin(M) * ( 1.0 + e*cos(M) )

where E and M are in degrees.  This is it---no further iterations are
needed because we know e has a sufficiently small value.  Next compute
the true anomaly, v, and the distance, r:

     r * cos(v)  =  A  =  cos(E) - e
     r * sin(v)  =  B  =  sqrt(1 - e*e) * sin(E)

and

     r  =  sqrt( A*A + B*B )
     v  =  atan2( B, A )

The Sun's true longitude, slon, can now be computed:

    slon  =  v + w

Since the Sun is always at the ecliptic (or at least very very close to
it), we can use simplified formulae to convert slon (the Sun's ecliptic
longitude) to sRA and sDec (the Sun's RA and Dec):

                  sin(slon) * cos(oblecl)
    tan(sRA)  =  -------------------------
			cos(slon)

    sin(sDec) =  sin(oblecl) * sin(slon)

As was the case when computing az, the Azimuth, if possible use an
atan2() function to compute sRA.

	REFERENCES
	----------

"Practical Astronomy with your Calculator", Peter Duffet-Smith, 3rd
edition.  Cambridge University Press 1988. ISBN 0-521-35699-7.

A good introduction to basic concepts plus many useful algorithms.
The third edition is much better than the two previous editions.  This
book is also preferable to Duffet-Smith's "Practical Astronomy with
your Computer", which has degenerated into being filled with Basic
program listings.

"Astronomical Formulae for Calculators", Jean Meeus, 4th ed,
Willmann-Bell 1988, ISBN 0-943396-22-0 

"Astronomical Algorithms", Jean Meeus, 1st ed, Willmann-Bell 1991,
ISBN 0-943396-35-2

Two standard references for many kinds of astronomical computations.
Meeus' is an undisputed authority here---many other authors quote his
books. "Astronomical Algorithms" is the more accurate and more modern
of the two, and one can also buy a floppy disk containing software
implementations (in Basic or C) to that book.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: [sci.astro] Time (Astronomy Frequently Asked Questions) (3/9)
Previous Document: C.02 What are all those different kinds of time?
Next Document: C.04 What's a Julian date? modified Julian date?

Part0 - Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
jlazio@patriot.net





Last Update March 27 2014 @ 02:11 PM