<p>Sean E. Urban and P. Kenneth Seidelmann, <em>Explanatory Supplemement to the Astronomical Almanac</em> 3rd ed. (Mill Valley, CA: University Science Books, 2013).</p>
<p>This book provides a detailed treatment, and describes the methods used to create the annual Astronomical Almanac issued by HM Nautical Almanac Office and the US Naval Observatory. Be sure to download the errata.</p>

CC BY-SA 4.0
2021-11-15T16:04:00.567Z
2021-11-15T16:04:00.567Z
Gerard Ashton
<p>The number of details involved depends on how accurate you want to be.  There are more than just rotations involved though, you also need to account for parallax, aberration, gravitational deflection, light time distance, non-uniform rotation of the Earth, etc.  There are some which are pure rotations, like the Earth Rotation angle, Precession, Nutation, and polar motion.  The Explanatory Supplement mentioned by Gerard goes through all of the gory details if you really need that level of accuracy.</p>
<p>But most people won't need that level of accuracy.  Below is a link to code I wrote which gets to sub-arc second accuracy for recent dates (compared to the results from JPL Horizons).  Accounting for the non-uniform rotation of the Earth more accurately, and the ephemeris used (VSOP87) are the current limits to its accuracy.</p>
<p><a href="https://www.celestialprogramming.com/vsop87-multilang/example_alt_az.html" rel="nofollow noreferrer">https://www.celestialprogramming.com/vsop87-multilang/example_alt_az.html</a></p>
<p>Going through every step would be very tedious, but I'll provide overview of the &quot;reduce&quot; function which applies the rotations and other corrections you are asking about.</p>
<p>It first converts a time in UTC to Terrestrial Time (TT), which accounts for leap seconds, and somewhat for the Earth's non-uniform rotation.  Next it gets the position of the Earth relative to the Sun, then gets the position of the requested planet relative to the sun.  The Earth's position is subtracted from the planet's position  to provide a geocentric position.  Then the observer's position relative to the center of the Earth is computed.  Rotation matrixes are created for the precession and nutation corrections.  The inverse of these matrixes are applied to the observer's location because the apparent effects of precession and nutation are actually caused by the observer moving in the opposite direction.  The result, is the XYZ position of the observer in the J2000/ICRF frame.  Subtracting this position from the planet's yeilds the astrometric J2000 RA/Dec of the planet.  Applying the precession and nutation matrix to the astrometric coordinates yields an &quot;of date&quot; position, and finally applying the affect of aberration yields an apparent position in RA/Dec.  The last step is to convert those RA/Dec coordinates into alt/az coordinates, which is a rotation about the Earth's axis based on the current sidereal time.</p>
<p>[I am currently working on an article which walks through all of the steps outlined in the Explanatory Supplement in much less terse terms, I will try to remember to update this when it's done.]</p>

CC BY-SA 4.0
2021-11-25T00:39:19.767Z
2021-11-25T00:39:19.767Z
Greg Miller
<p>I am writing some software, for my own learning experience, to convert astronomical coordinates to different frames of reference. An example of this would be conversion between ICRS which a lot of NASA data is supplied in automatically now, to Alt Azimuth, which is required for observation, based on the current time and geographic location.</p>
<p>From my prior studies of coordinate frames while I attended university, I know that all coordinate frames can be represented as a series of Matrix transformations from a &quot;base&quot; frame of reference. For instance, rotations around the X,Y,Z axis and a translation. For simplicity, these transformations are often all combined into a single affine transformation matrix like seen below where the blue section is the rotation matrix, the red is the translation, and the green is the scale.</p>
<p><a href="https://i.sstatic.net/XdMnH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XdMnH.png" alt="enter image description here" /></a></p>
<p>This leads me to believe that I should be able to represent conversions from ICRS to Alt Azimuth in much the same way, though the transformation matrix will change with time/location. Based on this, the transformation matrix should look something like below where each rotation needed to create the overall transformation is a function of time, latitude, and longitude.</p>
<pre><code>M = Rx(t, lat, lon) * Ry(t, lat, lon) * Rz(t, lat, lon)
</code></pre>
<p>However, in my googling of this topic all I can find is how to use AstroPy's built in functions to convert between different frames of reference. This is not all that useful to me as I actually want to learn about these transformations, not just be able to perform them. While I could study the AstroPy source code, it's such a massive library with a lot of interconnecting parts that understanding this one topic would take a huge time investment.</p>
<p>Does anyone have any experience with the mathematics involved in performing such a conversion,  references to articles, or recommended textbooks that discuss the topic of conversion between different coordinate systems specifically those using a matrix format for the context of astronomy?</p>

CC BY-SA 4.0
2021-11-14T03:39:18.770Z
See [Wikipedia: Astronomical coordinate systems: Converting coordinates](https://en.wikipedia.org/wiki/Astronomical_coordinate_systems#Converting_coordinates)
Mike G
CC BY-SA 4.0
2021-11-16T04:07:11.153Z
You're on the right track. ;) Transformations on the celestial sphere are a *little* simpler than general coord transformations because you only have to deal with rotations. It's good to know a bit of spherical trigonometry, but sadly it's not easy to find good modern texts on that topic. Sixty years ago, it was a major topic for navigators, but GPS has made it almost obsolete.
PM 2Ring
<coordinate><positional-astronomy>
Mathematics for Conversion between ICRS and AltAz
Hals
# Mathematics for Conversion between ICRS and AltAz

(Asked by: username_0 on 2021-11-13)

I am writing some software, for my own learning experience, to convert astronomical coordinates to different frames of reference. An example of this would be conversion between ICRS which a lot of NASA data is supplied in automatically now, to Alt Azimuth, which is required for observation, based on the current time and geographic location.
From my prior studies of coordinate frames while I attended university, I know that all coordinate frames can be represented as a series of Matrix transformations from a "base" frame of reference. For instance, rotations around the X,Y,Z axis and a translation. For simplicity, these transformations are often all combined into a single affine transformation matrix like seen below where the blue section is the rotation matrix, the red is the translation, and the green is the scale.

This leads me to believe that I should be able to represent conversions from ICRS to Alt Azimuth in much the same way, though the transformation matrix will change with time/location. Based on this, the transformation matrix should look something like below where each rotation needed to create the overall transformation is a function of time, latitude, and longitude.
M = Rx(t, lat, lon) * Ry(t, lat, lon) * Rz(t, lat, lon)

However, in my googling of this topic all I can find is how to use AstroPy's built in functions to convert between different frames of reference. This is not all that useful to me as I actually want to learn about these transformations, not just be able to perform them. While I could study the AstroPy source code, it's such a massive library with a lot of interconnecting parts that understanding this one topic would take a huge time investment.
Does anyone have any experience with the mathematics involved in performing such a conversion,  references to articles, or recommended textbooks that discuss the topic of conversion between different coordinate systems specifically those using a matrix format for the context of astronomy?

**Tags:** coordinate, positional-astronomy
> **Comments:**
> **username_1**: See [Wikipedia: Astronomical coordinate systems: Converting coordinates](https://en.wikipedia.org/wiki/Astronomical_coordinate_systems#Converting_coordinates)  
> **username_2**: You're on the right track. ;) Transformations on the celestial sphere are a *little* simpler than general coord transformations because you only have to deal with rotations. It's good to know a bit of spherical trigonometry, but sadly it's not easy to find good modern texts on that topic. Sixty years ago, it was a major topic for navigators, but GPS has made it almost obsolete.  

---

## 2 answers

### Answer by username_3 on 2021-11-15. Score: 1

Sean E. Urban and P. Kenneth Seidelmann, *Explanatory Supplemement to the Astronomical Almanac* 3rd ed. (Mill Valley, CA: University Science Books, 2013).

This book provides a detailed treatment, and describes the methods used to create the annual Astronomical Almanac issued by HM Nautical Almanac Office and the US Naval Observatory. Be sure to download the errata.


---

### Answer by username_4 on 2021-11-25. Score: 1

The number of details involved depends on how accurate you want to be. There are more than just rotations involved though, you also need to account for parallax, aberration, gravitational deflection, light time distance, non-uniform rotation of the Earth, etc. There are some which are pure rotations, like the Earth Rotation angle, Precession, Nutation, and polar motion. The Explanatory Supplement mentioned by Gerard goes through all of the gory details if you really need that level of accuracy.

But most people won't need that level of accuracy. Below is a link to code I wrote which gets to sub-arc second accuracy for recent dates (compared to the results from JPL Horizons). Accounting for the non-uniform rotation of the Earth more accurately, and the ephemeris used (VSOP87) are the current limits to its accuracy.

<https://www.celestialprogramming.com/vsop87-multilang/example_alt_az.html>

Going through every step would be very tedious, but I'll provide overview of the "reduce" function which applies the rotations and other corrections you are asking about.

It first converts a time in UTC to Terrestrial Time (TT), which accounts for leap seconds, and somewhat for the Earth's non-uniform rotation. Next it gets the position of the Earth relative to the Sun, then gets the position of the requested planet relative to the sun. The Earth's position is subtracted from the planet's position to provide a geocentric position. Then the observer's position relative to the center of the Earth is computed. Rotation matrixes are created for the precession and nutation corrections. The inverse of these matrixes are applied to the observer's location because the apparent effects of precession and nutation are actually caused by the observer moving in the opposite direction. The result, is the XYZ position of the observer in the J2000/ICRF frame. Subtracting this position from the planet's yeilds the astrometric J2000 RA/Dec of the planet. Applying the precession and nutation matrix to the astrometric coordinates yields an "of date" position, and finally applying the affect of aberration yields an apparent position in RA/Dec. The last step is to convert those RA/Dec coordinates into alt/az coordinates, which is a rotation about the Earth's axis based on the current sidereal time.

[I am currently working on an article which walks through all of the steps outlined in the Explanatory Supplement in much less terse terms, I will try to remember to update this when it's done.]


---

