# Azimuth and Altitude angle between two points in the sky

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:

(<Angle 67.23952373 deg>, <Angle 33.82584497 deg>)
(<Angle -69.63942512 deg>, <Angle 22.52101212 deg>)
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.

• 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. Apr 13, 2022 at 15:53
• @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. Apr 14, 2022 at 11:13
• It actually would still be 90 deg in az. The arc length would be shorter, but the angle will be the same. Apr 14, 2022 at 15:56
• @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 Apr 21, 2022 at 11:54
{"ft_lang_label":"__label__en","ft_lang_prob":0.8284814,"math_prob":0.9467696,"size":1810,"snap":"2022-40-2023-06","text_gpt3_token_len":476,"char_repetition_ratio":0.09745293,"word_repetition_ratio":0.0,"special_character_ratio":0.2878453,"punctuation_ratio":0.20930232,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9897057,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-02-01T23:34:59Z\",\"WARC-Record-ID\":\"<urn:uuid:6f33e0c4-9c7f-4251-95d4-58d262c30819>\",\"Content-Length\":\"127602\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:fef305a2-9be9-40a8-931f-b40b73aa8312>\",\"WARC-Concurrent-To\":\"<urn:uuid:225dd87f-0dfb-4f8a-93e4-cb1f0481fb66>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://astronomy.stackexchange.com/questions/49078/azimuth-and-altitude-angle-between-two-points-in-the-sky\",\"WARC-Payload-Digest\":\"sha1:ZX6DAJOAFXO37IW3CMFNG3EMFNIG3SOE\",\"WARC-Block-Digest\":\"sha1:4PF332W6N6QIQGBB7OLVRT7OFSLB337K\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764499953.47_warc_CC-MAIN-20230201211725-20230202001725-00603.warc.gz\"}"}