<p>You can use the signs of the <span class="math-container">$ sin A $</span> and <span class="math-container">$ cos A $</span> to determine the proper quadrant:
<a href="https://i.sstatic.net/zzOmm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/zzOmm.png" alt="enter image description here" /></a></p>
<p>The equations in the Explanatory Supplement to the Astronomical Almanac are slightly different than the ones above.  These are recond with <span class="math-container">$0^\circ$</span> being North, and Western longitudes negative.</p>
<p><span class="math-container">$$
\begin{align*}
\cos \mathit{a} \sin A_{z} &amp;= -\cos \delta \sin \mathit{h} &amp; (eq 1)
\\
\cos \mathit{a} \cos A_{z} &amp;= \sin \delta \cos \phi - \cos \delta \cos \mathit{h} \sin \phi &amp; (eq 2)
\\
\sin \mathit{a} &amp;= \sin \delta \sin \phi + \cos \delta \cos \mathit{h} \cos \phi &amp; (eq 3)
\end{align*}
$$</span></p>
<p>Where <span class="math-container">$h$</span> is the hour angle, <span class="math-container">$\delta$</span> is the declination, <span class="math-container">$A_{z}$</span> is azimuth, <span class="math-container">$a$</span> is altitude, <span class="math-container">$\phi$</span> is the lattitude.
You will need to check the signs of <span class="math-container">$\cos A_z$</span> and <span class="math-container">$\sin A_z$</span> to determine the propper quadrant:</p>
<p>if <span class="math-container">$\cos A_z$</span> &gt; 0 and <span class="math-container">$\sin A_z$</span> &gt; 0: use either eq1 or eq2</p>
<p>if <span class="math-container">$\cos A_z$</span> &gt; 0 and <span class="math-container">$\sin A_z$</span> &lt; 0: use eq1</p>
<p>if <span class="math-container">$\cos A_z$</span> &lt; 0 and <span class="math-container">$\sin A_z$</span> &lt; 0: use <span class="math-container">$A_z$</span> = 360 - eq2</p>
<p>if <span class="math-container">$\cos A_z$</span> &lt; 0 and <span class="math-container">$\sin A_z$</span> &gt; 0: use eq2</p>
<p>Alternatively, I prefer to use the equations below, which allows the use of the <strong>atan2()</strong> function built in to most languages.  These are based on those in Meeus, but I have modified them so that Az=<span class="math-container">$0^\circ$</span> is North, and Western longitudes are negative (same as above), agreeing with what is in common use today.</p>
<p><span class="math-container">$$
\begin{aligned}
\tan A &amp;= \dfrac{\sin H}{\cos H \sin \phi  - \tan \delta \cos \phi}
\\~\\
\sin a &amp;= \sin \phi \sin \delta + \cos \phi \cos \delta \cos H
\end{aligned}
$$</span></p>
<p>The page <a href="https://www.celestialprogramming.com/convert_ra_dec_to_alt_az.html" rel="nofollow noreferrer">Convert RA/Dec to Alt/Az</a> has implementations of these, and two other alternate methods.  As well as test data to verify accuracy.</p>

CC BY-SA 4.0
2022-12-15T13:42:09.957Z
2022-12-15T13:42:09.957Z
Greg Miller
<p>Converting Hour angle to Azimuth, is there a simple way to know which result is correct (as the formulas and the arccosine give various results shifted by 180° etc.), or does one just have to figure it out visually with a drawing?</p>
<p><span class="math-container">$sin(A) = - \frac{\sin(H) \cos(\delta)}{\cos(a)}$</span></p>
<p><span class="math-container">$cos(A) = \frac{\sin(\delta) - \sin(\phi) \sin(a)}{ \cos(\phi) \cos(a) }$</span></p>
<p>If there is a rule, please indicate if the Azimuth is counted from the southern or northern cardinal point.</p>
<p>Sketch of the equatorial and horizontal coordinate systems (I use the hour angle positive to the west and azimuth 0° at north, positive to east; I just like this illustration):
<a href="https://i.sstatic.net/R9e7c.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/R9e7c.png" alt="equatorial and horizontal coordinates (I use hour angle positive to the west and Azimuth 0° at north, positive to east; I just like this illustration)" /></a></p>

<coordinate>
Transformation of hour angle to azimuth
MoritzMoreira
# Transformation of hour angle to azimuth

(Asked by: username_0 on 2022-12-15)

Converting Hour angle to Azimuth, is there a simple way to know which result is correct (as the formulas and the arccosine give various results shifted by 180° etc.), or does one just have to figure it out visually with a drawing?

$sin(A) = - \frac{\sin(H) \cos(\delta)}{\cos(a)}$

$cos(A) = \frac{\sin(\delta) - \sin(\phi) \sin(a)}{ \cos(\phi) \cos(a) }$

If there is a rule, please indicate if the Azimuth is counted from the southern or northern cardinal point.

Sketch of the equatorial and horizontal coordinate systems (I use the hour angle positive to the west and azimuth 0° at north, positive to east; I just like this illustration):
[![equatorial and horizontal coordinates (I use hour angle positive to the west and Azimuth 0° at north, positive to east; I just like this illustration)](https://i.sstatic.net/R9e7c.png)](https://i.sstatic.net/R9e7c.png)

**Tags:** coordinate


---

## 1 answers

### Answer by username_1 on 2022-12-15. Score: 3 | Accepted answer

You can use the signs of the $ sin A $ and $ cos A $ to determine the proper quadrant:
[![enter image description here](https://i.sstatic.net/zzOmm.png)](https://i.sstatic.net/zzOmm.png)

The equations in the Explanatory Supplement to the Astronomical Almanac are slightly different than the ones above. These are recond with $0^\circ$ being North, and Western longitudes negative.

$$
\begin{align\*}
\cos \mathit{a} \sin A\_{z} &= -\cos \delta \sin \mathit{h} & (eq 1)
\\
\cos \mathit{a} \cos A\_{z} &= \sin \delta \cos \phi - \cos \delta \cos \mathit{h} \sin \phi & (eq 2)
\\
\sin \mathit{a} &= \sin \delta \sin \phi + \cos \delta \cos \mathit{h} \cos \phi & (eq 3)
\end{align\*}
$$

Where $h$ is the hour angle, $\delta$ is the declination, $A\_{z}$ is azimuth, $a$ is altitude, $\phi$ is the lattitude.
You will need to check the signs of $\cos A\_z$ and $\sin A\_z$ to determine the propper quadrant:

if $\cos A\_z$ > 0 and $\sin A\_z$ > 0: use either eq1 or eq2

if $\cos A\_z$ > 0 and $\sin A\_z$ < 0: use eq1

if $\cos A\_z$ < 0 and $\sin A\_z$ < 0: use $A\_z$ = 360 - eq2

if $\cos A\_z$ < 0 and $\sin A\_z$ > 0: use eq2

Alternatively, I prefer to use the equations below, which allows the use of the **atan2()** function built in to most languages. These are based on those in Meeus, but I have modified them so that Az=$0^\circ$ is North, and Western longitudes are negative (same as above), agreeing with what is in common use today.

$$
\begin{aligned}
\tan A &= \dfrac{\sin H}{\cos H \sin \phi - \tan \delta \cos \phi}
\\~\\
\sin a &= \sin \phi \sin \delta + \cos \phi \cos \delta \cos H
\end{aligned}
$$

The page [Convert RA/Dec to Alt/Az](https://www.celestialprogramming.com/convert_ra_dec_to_alt_az.html) has implementations of these, and two other alternate methods. As well as test data to verify accuracy.


---

