<p>Here's my attempt at using SOFA to perform planetary reduction:
<a href="https://github.com/gmiller123456/sofa_examples/blob/master/reductiontest2.c" rel="nofollow noreferrer">https://github.com/gmiller123456/sofa_examples/blob/master/reductiontest2.c</a></p>
<p>It performs annual aberration correction, but that's the most accurate step it stops at.  It does not perform diurnal aberration, polar motion, etc.  It gets to the sub arc second accuracy.</p>
<p>From what I understand, SOFA was designed more for stars and objects outside the solar system, so there aren't any routines for easy computation of planet positions.  Also &quot;Astronomical Algorithms&quot; is a descent place to start with computational astronomy, but not good as your only source.  Meeus does not really try to explain what the equations in his book are doing, it makes a good cookbook, but it can be really hard to take something from the book and apply it to something else without some other source.  A good reference is &quot;The Explanatory Supplement to the Astronomical Almanac&quot;, but can be quite terse for non-astronomers, and a bit pricey.  And, unfortunately I haven't really seen an intermediate book, but there are cheaper sources.  A good place to start is an old used copy of the &quot;Astronomical Almanac&quot;, it will still have a lot of explanations, examples, and algorithms for positional astronomy.</p>

CC BY-SA 4.0
2021-11-25T05:38:47.053Z
2021-11-25T05:38:47.053Z
Greg Miller
<p>There are a number of answers on here that skirt the topic, but no concrete answers.</p>
<p>I currently have an implementation based on &quot;Astronomical Algorithms by Jean Meeus&quot; for stars, moon, and sun written ~2007. The stellar positioning is not accurate enough for my upcoming application so I switched that over to the SOFA library (very easy and straight-forward). Just take catalog data drop it into a magic function and BOOM you have RA and Dec.</p>
<p>I am currently attempting to replace the rest of the Meeus algorithms with the SOFA library and am finding my knowledge lacking and the size of the SOFA library overwhelming.</p>
<p>From what I have found, the epv00 heliocentric coords can be reversed somehow to get geocentric coords of the Sun. How would that be done and is that GCRS? Which I can then use for the standard GCRS-&gt;observed chain from the cookbook? If that is not GCRS, can I make it GCRS? Should I?</p>

CC BY-SA 4.0
2021-11-26T01:51:13.900Z
Download IERS Convention 2010 from: https://www.iers.org/IERS/EN/DataProducts/Conventions/conventions.html . It will give you all the technical details and which equations from the SOFA library to use. (I think the Technical Note 36 is the latest).
Huy Pham
<the-sun><the-moon><positional-astronomy><software>
How to I calcuate observed position of the Sun and Moon using the SOFA C library?
EndlessDex
# How to I calcuate observed position of the Sun and Moon using the SOFA C library?

(Asked by: username_0 on 2020-11-30)

There are a number of answers on here that skirt the topic, but no concrete answers.

I currently have an implementation based on "Astronomical Algorithms by Jean Meeus" for stars, moon, and sun written ~2007. The stellar positioning is not accurate enough for my upcoming application so I switched that over to the SOFA library (very easy and straight-forward). Just take catalog data drop it into a magic function and BOOM you have RA and Dec.

I am currently attempting to replace the rest of the Meeus algorithms with the SOFA library and am finding my knowledge lacking and the size of the SOFA library overwhelming.

From what I have found, the epv00 heliocentric coords can be reversed somehow to get geocentric coords of the Sun. How would that be done and is that GCRS? Which I can then use for the standard GCRS->observed chain from the cookbook? If that is not GCRS, can I make it GCRS? Should I?

**Tags:** the-sun, the-moon, positional-astronomy, software

> **Comments:**
> **username_1**: Download IERS Convention 2010 from: https://www.iers.org/IERS/EN/DataProducts/Conventions/conventions.html . It will give you all the technical details and which equations from the SOFA library to use. (I think the Technical Note 36 is the latest).  

---

## 1 answers

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

Here's my attempt at using SOFA to perform planetary reduction:
<https://github.com/gmiller123456/sofa_examples/blob/master/reductiontest2.c>

It performs annual aberration correction, but that's the most accurate step it stops at. It does not perform diurnal aberration, polar motion, etc. It gets to the sub arc second accuracy.

From what I understand, SOFA was designed more for stars and objects outside the solar system, so there aren't any routines for easy computation of planet positions. Also "Astronomical Algorithms" is a descent place to start with computational astronomy, but not good as your only source. Meeus does not really try to explain what the equations in his book are doing, it makes a good cookbook, but it can be really hard to take something from the book and apply it to something else without some other source. A good reference is "The Explanatory Supplement to the Astronomical Almanac", but can be quite terse for non-astronomers, and a bit pricey. And, unfortunately I haven't really seen an intermediate book, but there are cheaper sources. A good place to start is an old used copy of the "Astronomical Almanac", it will still have a lot of explanations, examples, and algorithms for positional astronomy.


---

