<p>I want to know how to correctly calculate altitude and azimuth difference, separately,  between two points in the sky. The same way will be with icrs coordinates.
For the altitude difference, I simply subtracted altitude values of two points, but for the azimuth, the difference has to be multiplied with the cosine of altitude of one point, right?
I tried to reproduce the results with the astropy <a href="https://docs.astropy.org/en/stable/api/astropy.coordinates.SkyCoord.html#astropy.coordinates.SkyCoord.spherical_offsets_to" rel="nofollow noreferrer">spherical_offset_to()</a> method, which returns dAz and dAlt but get quite different results. I tried to find corresponding literature but couldn't. Can someone explain to me how it should be calculated?
Thanks</p>
<p>Here is reproducible example for two points, a and b.</p>
<pre><code>import numpy as np
from astropy.coordinates import SkyCoord
a = SkyCoord(az=0, alt=30, unit=&quot;deg&quot;, frame=&quot;altaz&quot;)
b = SkyCoord(az=90, alt=40, unit=&quot;deg&quot;, frame=&quot;altaz&quot;)
print(a.spherical_offsets_to(b))
print(b.spherical_offsets_to(a))
print(&quot;dAz:&quot;,((b.az - a.az)*np.cos(np.deg2rad(a.alt))).value, &quot;dAlt:&quot;, (b.alt - a.alt).value)
print(&quot;dAz:&quot;,((a.az - b.az)*np.cos(np.deg2rad(b.alt))).value, &quot;dAlt:&quot;, (a.alt - b.alt).value)
</code></pre>
<p>And here are the results:</p>
<pre><code>(&lt;Angle 67.23952373 deg&gt;, &lt;Angle 33.82584497 deg&gt;)
(&lt;Angle -69.63942512 deg&gt;, &lt;Angle 22.52101212 deg&gt;)
dAz: 77.94228634059948 dAlt: 10.0
dAz: -68.94399988070803 dAlt: -10.0
</code></pre>
<p>EDIT: More details regarding the purpose of my question/request.<br />
Two devices, located on the earth, separated with some fixed azimuth and altitude angle between them. Both devices point in the sky.
I have a series of RA &amp; Dec coordinates(or equally AltAz) of their pointings, during some time range.
Using that pointings data, I want to measure mentioned fixed angle offset between two devices.<br />
Why? If I know the angle offset, and the coordinates of one device, I can calculate the pointing for the second device and vice versa.</p>

CC BY-SA 4.0
2022-04-13T15:53:29.450Z
It's hard to imagine what you're trying to do.  90deg az at the horizon is still 90deg az near the zenith.  You seem to be mixing coordinate systems.  It might help if you provide info on the intended purpose.
Greg Miller
CC BY-SA 4.0
2022-04-14T11:13:56.780Z
@GregMiller Thanks, I will edit my post and provide more details. 
Lets say we have two lasers on the ground, melded together with some fixed azimuth difference between them, 90 deg. We turn on the lasers, and at the horizon their beams, or the coordinates where their beams are pointing, are separated by 90 deg in azimuth. If we now elevate those lasers, to the zenith(remember, we cannot change their az difference since they are melded), my question is, what would be azimuth difference between their beams, between two points in the sky where their beams are pointing? It won't be 90deg in az.
Falco Peregrinus
CC BY-SA 4.0
2022-04-14T15:56:10.743Z
It actually would still be 90 deg in az.  The arc length would be shorter, but the angle will be the same.
Greg Miller
CC BY-SA 4.0
2022-04-21T11:54:43.333Z
@GregMiller I still don't see it. I am confused. I thought that arc length would be the same, and the angle would be larger since the azimuth grid gets denser with increasing altitude
Falco Peregrinus
<observational-astronomy><coordinate><declination><right-ascension>
Azimuth and Altitude angle between two points in the sky
Falco Peregrinus
# Azimuth and Altitude angle between two points in the sky

(Asked by: username_0 on 2022-04-13)

I want to know how to correctly calculate altitude and azimuth difference, separately,  between two points in the sky. The same way will be with icrs coordinates.
For the altitude difference, I simply subtracted altitude values of two points, but for the azimuth, the difference has to be multiplied with the cosine of altitude of one point, right?
I tried to reproduce the results with the astropy spherical_offset_to() method, which returns dAz and dAlt but get quite different results. I tried to find corresponding literature but couldn't. Can someone explain to me how it should be calculated?
Thanks
Here is reproducible example for two points, a and b.
import numpy as np
from astropy.coordinates import SkyCoord
a = SkyCoord(az=0, alt=30, unit="deg", frame="altaz")
b = SkyCoord(az=90, alt=40, unit="deg", frame="altaz")
print(a.spherical_offsets_to(b))
print(b.spherical_offsets_to(a))
print("dAz:",((b.az - a.az)*np.cos(np.deg2rad(a.alt))).value, "dAlt:", (b.alt - a.alt).value)
print("dAz:",((a.az - b.az)*np.cos(np.deg2rad(b.alt))).value, "dAlt:", (a.alt - b.alt).value)

And here are the results:
(, )
(, )
dAz: 77.94228634059948 dAlt: 10.0
dAz: -68.94399988070803 dAlt: -10.0

EDIT: More details regarding the purpose of my question/request.
Two devices, located on the earth, separated with some fixed azimuth and altitude angle between them. Both devices point in the sky.
I have a series of RA & Dec coordinates(or equally AltAz) of their pointings, during some time range.
Using that pointings data, I want to measure mentioned fixed angle offset between two devices.
Why? If I know the angle offset, and the coordinates of one device, I can calculate the pointing for the second device and vice versa.

**Tags:** observational-astronomy, coordinate, declination, right-ascension

> **Comments:**
> **username_1**: It's hard to imagine what you're trying to do.  90deg az at the horizon is still 90deg az near the zenith.  You seem to be mixing coordinate systems.  It might help if you provide info on the intended purpose.  
> **username_0**: @GregMiller Thanks, I will edit my post and provide more details.  Lets say we have two lasers on the ground, melded together with some fixed azimuth difference between them, 90 deg. We turn on the lasers, and at the horizon their beams, or the coordinates where their beams are pointing, are separated by 90 deg in azimuth. If we now elevate those lasers, to the zenith(remember, we cannot change their az difference since they are melded), my question is, what would be azimuth difference between their beams, between two points in the sky where their beams are pointing? It won't be 90deg in az.  
> **username_1**: It actually would still be 90 deg in az.  The arc length would be shorter, but the angle will be the same.  
> **username_0**: @GregMiller I still don't see it. I am confused. I thought that arc length would be the same, and the angle would be larger since the azimuth grid gets denser with increasing altitude  

---

## 0 answers

