<p>I'm looking for two accurate calculations for the perceived angular diameter of the Moon and the Sun, for a given observer (of known latitude and longitude) at a given moment in time (UTC).</p>
<p>I currently have the following for J.L. Lawrence's &quot;Celestial Calculations: A Gentle Introduction to Computational Astronomy&quot;:</p>
<pre><code>function getSolarAngularDiameter(datetime: Date): number {
  // Get the true anomaly:
  const ν = getSolarTrueAnomaly(datetime)

  // Get the F orbital paramater which applies corrections
  // due to the Sun's orbital eccentricity:
  const F = getFOrbitalParameter(ν, 0.016708)

  return 0.533128 * F
}
</code></pre>
<p>and</p>
<pre><code>function getLunarAngularDiameter(datetime: Date): number {
  // Get the true anomaly:
  const ν = getLunarTrueAnomaly(datetime)

  // Get the F orbital paramater which applies corrections
  // due to the Moon's orbital eccentricity:
  const F = getFOrbitalParameter(ν, 0.0549)

  return 0.5181 * F
}
</code></pre>
<p><em><strong>These are to sufficient accuracy for most scenarios, except during a solar or lunar eclipse.</strong></em> (They usually give around 0.53 - 0.55 degrees of diameter for the Moon and the Sun, e.g., 31' arcminutes).</p>
<p>This means, when I go to calculate the magnitude for either a Total, Hybrid or Annular solar eclipse, for example, my magnitude values are either off by a few degrees for Total, or greater than 1 for an Annular eclipse, meaning that the Moon is &quot;bigger&quot; than the Sun in it's angular diameter.</p>
<p>This is, of course, wrong.</p>
<p>They also can't be used to calculate the duration of an eclipse and other such features, to great accuracy.</p>
<p>I have been trying to reference more accurate calculations of these values, e.,g., from Meeus, but to no avail.</p>
<p>Would anyone either know of a more accurate routine, or know of any literature I could reference that could give me more accurate angular diameter models...</p>
<p>I have made some amends to account for parallax of the observer, but alas, similar results:</p>
<pre><code>export const getLunarAngularDiameter = (
  datetime: Date,
  observer: GeographicCoordinate &amp; { elevation: number }
): number =&gt; {
  const k = 2 * 0.272481

  // Get the distance to the Moon, and convert to AU:
  const Δ = getLunarDistance(datetime) / (1.496e8 * 1000)

  // Get the lunar equatorial coordinates:
  const { ra, dec } = getLunarEquatorialCoordinate(datetime)

  // Get the hour angle of the Moon:
  const ha = getHourAngle(datetime, observer.longitude, ra)

  const π = 8.794 / Δ // in units of arcseconds

  // Get the parallax constants from the distance to the Moon:
  const sπ = Math.sin(radians(π / 3600)) // Convert arcseconds to radians

  const { sin: sδ, cos: cδ } = { sin: Math.sin(radians(dec)), cos: Math.cos(radians(dec)) }
  const { sin: sH, cos: cH } = { sin: Math.sin(radians(ha)), cos: Math.cos(radians(ha)) }

  const u = Math.atan(0.99664719 * Math.tan(radians(observer.latitude)))

  const ρsφ =
    0.99664719 * Math.sin(u) + (observer.elevation * Math.sin(radians(observer.latitude))) / earth.r

  const ρcφ = Math.cos(u) + (observer.elevation * Math.cos(radians(observer.latitude))) / earth.r

  const A = cδ * sH
  const B = cδ * cH - ρcφ * sπ
  const C = sδ - ρsφ * sπ

  const q = Math.sqrt(Math.pow(A, 2) + Math.pow(B, 2) + Math.pow(C, 2))

  return degrees((k / q) * sπ)
}
<span class="math-container">```</span>
</code></pre>

CC BY-SA 4.0
2024-07-25T16:04:38.747Z
Here's some data on the 2024 eclipse compared to various predictions.  Spoiler: many were off by 10-30 seconds.  The test was done near the edge where the differences have a bigger impact.  Less so near the centerline.  https://www.besselianelements.com/eclipse-maps-accuracy/
Greg Miller
CC BY-SA 4.0
2024-07-25T19:45:43.487Z
FWIW, you can check your diameter calculations against JPL data using my scripts in https://astronomy.stackexchange.com/a/57419/16685 Eg, here's a solar angular diameter plot, for the Greenwich Observatory. https://i.sstatic.net/UvOYtbED.png
PM 2Ring
CC BY-SA 4.0
2024-07-25T19:57:27.877Z
Solar diameter is easy enough to calculate with fairly high precision. ( I have Python code for the solar diameter, based on Meeus, if that's of interest). But the Moon is a bit trickier. You need a very good estimate of its true anomaly (which isn't easy), and you have to correct for parallax. I have some info (including graphs) on the variations in the Moon's orbit here: https://astronomy.stackexchange.com/a/55112/16685 However, that answer doesn't have the info you need to calculate the lunar diameter.
PM 2Ring
CC BY-SA 4.0
2024-07-26T10:52:14.777Z
Thanks @GregMiller, appreciate the links. However, what I am looking for is a very generalistic way to compute the properties of the solar / lunar eclipse for a given date. Everything else seems very accurate, except for the true anomaly for both objects.
Micheal J. Roberts
CC BY-SA 4.0
2024-07-26T10:55:18.133Z
@PM2Ring Thank you so much for this - it looks like the true anomaly calculation from J.L Lawrence is not to sufficient accuracy. I'm sure Meeus might have an answer for this .. I will look to amend my underlying calculations and see if that improves the magnitude to at least be closer to where it needs to be. I will see if I can also do the same for the Moon referencing any parallax corrections they provide there.
Micheal J. Roberts
CC BY-SA 4.0
2024-07-26T10:56:26.560Z
@GregMiller Your link is also really useful, I have been thinking about computing the Basselian elements ... food for though. Thank you.
Micheal J. Roberts
CC BY-SA 4.0
2024-07-26T12:38:58.783Z
@MichealJ.Roberts Here's an article on computing the Besselian Elements.  It uses the IAU diameters of the Sun and Moon, but they can be replaced with whatever "best practice" dictates.  https://www.celestialprogramming.com/eclipsesGeneratingBesselianElements/generatingBesselianPolynomials.html
Greg Miller
CC BY-SA 4.0
2024-07-26T15:02:08.673Z
@PM2Ring I have updated my question with an improved parallax calculation, alas, no luck on improving the accuracy. I assume it is now due to the parallax of the Sun?
Micheal J. Roberts
CC BY-SA 4.0
2024-07-26T16:45:38.063Z
Sorry, I'm not quite sure what your new Moon code is doing. Eclipse-grade calculations need to be pretty accurate, eg you can't use a fixed eccentricity. Accurate position is more important than accurate angular diameter, but if your position calculations are accurate then you should also get accurate angular diameters. Have you verified the accuracy of `getLunarDistance(datetime)` & `getLunarEquatorialCoordinate(datetime)`?
PM 2Ring
CC BY-SA 4.0
2024-07-26T16:47:31.673Z
I don't know what all your constants are, but you should probably be using the IAU defined value of the AU, 149597870.700 km. The parallax of the Sun's position due to the observer's location on Earth is quite small, ~1% of the Sun's angular radius.
PM 2Ring
CC BY-SA 4.0
2024-07-28T08:52:28.270Z
@PM2Ring Yeh, I assumed that the effect of parallax on the Sun was negligible when comparing the distances between the two.

Ok, so whilst I like the use of the AU to more precision, the difference seems to be negligible: 0.5417666941070021 degrees for the new precise value vs. 0.5417666941070021 from before. (Although this is definitely an improvement, so I will keep this).

I'm going to improve the accuracy on the Lunar distance calculation which is also from J.L Lawrence, but probably should be from Meeus for higher accuracy. Will amend this and update if I need any further help.
Micheal J. Roberts
CC BY-SA 4.0
2024-07-29T07:45:16.517Z
@PM2Ring I'm thinking at this point, improved accuracy of the Moon and Sun distance ... and correct the Moon diameter for parallax, and all should be good.
Micheal J. Roberts
<the-sun><the-moon><astrometry><angular-diameter>
Accurate angluar diameter calculations of the Moon and the Sun
Micheal J. Roberts
# Accurate angluar diameter calculations of the Moon and the Sun

(Asked by: username_0 on 2024-07-25)

I'm looking for two accurate calculations for the perceived angular diameter of the Moon and the Sun, for a given observer (of known latitude and longitude) at a given moment in time (UTC).
I currently have the following for J.L. Lawrence's "Celestial Calculations: A Gentle Introduction to Computational Astronomy":
function getSolarAngularDiameter(datetime: Date): number {
  // Get the true anomaly:
  const ν = getSolarTrueAnomaly(datetime)

  // Get the F orbital paramater which applies corrections
  // due to the Sun's orbital eccentricity:
  const F = getFOrbitalParameter(ν, 0.016708)

  return 0.533128 * F
}

and
function getLunarAngularDiameter(datetime: Date): number {
  // Get the true anomaly:
  const ν = getLunarTrueAnomaly(datetime)

  // Get the F orbital paramater which applies corrections
  // due to the Moon's orbital eccentricity:
  const F = getFOrbitalParameter(ν, 0.0549)

  return 0.5181 * F
}

These are to sufficient accuracy for most scenarios, except during a solar or lunar eclipse. (They usually give around 0.53 - 0.55 degrees of diameter for the Moon and the Sun, e.g., 31' arcminutes).
This means, when I go to calculate the magnitude for either a Total, Hybrid or Annular solar eclipse, for example, my magnitude values are either off by a few degrees for Total, or greater than 1 for an Annular eclipse, meaning that the Moon is "bigger" than the Sun in it's angular diameter.
This is, of course, wrong.
They also can't be used to calculate the duration of an eclipse and other such features, to great accuracy.
I have been trying to reference more accurate calculations of these values, e.,g., from Meeus, but to no avail.
Would anyone either know of a more accurate routine, or know of any literature I could reference that could give me more accurate angular diameter models...
I have made some amends to account for parallax of the observer, but alas, similar results:
export const getLunarAngularDiameter = (
  datetime: Date,
  observer: GeographicCoordinate & { elevation: number }
): number => {
  const k = 2 * 0.272481

  // Get the distance to the Moon, and convert to AU:
  const Δ = getLunarDistance(datetime) / (1.496e8 * 1000)

  // Get the lunar equatorial coordinates:
  const { ra, dec } = getLunarEquatorialCoordinate(datetime)

  // Get the hour angle of the Moon:
  const ha = getHourAngle(datetime, observer.longitude, ra)

  const π = 8.794 / Δ // in units of arcseconds

  // Get the parallax constants from the distance to the Moon:
  const sπ = Math.sin(radians(π / 3600)) // Convert arcseconds to radians

  const { sin: sδ, cos: cδ } = { sin: Math.sin(radians(dec)), cos: Math.cos(radians(dec)) }
  const { sin: sH, cos: cH } = { sin: Math.sin(radians(ha)), cos: Math.cos(radians(ha)) }

  const u = Math.atan(0.99664719 * Math.tan(radians(observer.latitude)))

  const ρsφ =
    0.99664719 * Math.sin(u) + (observer.elevation * Math.sin(radians(observer.latitude))) / earth.r

  const ρcφ = Math.cos(u) + (observer.elevation * Math.cos(radians(observer.latitude))) / earth.r

  const A = cδ * sH
  const B = cδ * cH - ρcφ * sπ
  const C = sδ - ρsφ * sπ

  const q = Math.sqrt(Math.pow(A, 2) + Math.pow(B, 2) + Math.pow(C, 2))

  return degrees((k / q) * sπ)
}
```

**Tags:** the-sun, the-moon, astrometry, angular-diameter
> **Comments:**
> **username_1**: Here's some data on the 2024 eclipse compared to various predictions.  Spoiler: many were off by 10-30 seconds.  The test was done near the edge where the differences have a bigger impact.  Less so near the centerline.  https://www.besselianelements.com/eclipse-maps-accuracy/  
> **username_2**: FWIW, you can check your diameter calculations against JPL data using my scripts in https://astronomy.stackexchange.com/a/57419/16685 Eg, here's a solar angular diameter plot, for the Greenwich Observatory. https://i.sstatic.net/UvOYtbED.png  
> **username_2**: Solar diameter is easy enough to calculate with fairly high precision. ( I have Python code for the solar diameter, based on Meeus, if that's of interest). But the Moon is a bit trickier. You need a very good estimate of its true anomaly (which isn't easy), and you have to correct for parallax. I have some info (including graphs) on the variations in the Moon's orbit here: https://astronomy.stackexchange.com/a/55112/16685 However, that answer doesn't have the info you need to calculate the lunar diameter.  
> **username_0**: Thanks @GregMiller, appreciate the links. However, what I am looking for is a very generalistic way to compute the properties of the solar / lunar eclipse for a given date. Everything else seems very accurate, except for the true anomaly for both objects.  
> **username_0**: @PM2Ring Thank you so much for this - it looks like the true anomaly calculation from J.L Lawrence is not to sufficient accuracy. I'm sure Meeus might have an answer for this .. I will look to amend my underlying calculations and see if that improves the magnitude to at least be closer to where it needs to be. I will see if I can also do the same for the Moon referencing any parallax corrections they provide there.  
> **username_0**: @GregMiller Your link is also really useful, I have been thinking about computing the Basselian elements ... food for though. Thank you.  
> **username_1**: @MichealJ.Roberts Here's an article on computing the Besselian Elements.  It uses the IAU diameters of the Sun and Moon, but they can be replaced with whatever "best practice" dictates.  https://www.celestialprogramming.com/eclipsesGeneratingBesselianElements/generatingBesselianPolynomials.html  
> **username_0**: @PM2Ring I have updated my question with an improved parallax calculation, alas, no luck on improving the accuracy. I assume it is now due to the parallax of the Sun?  
> **username_2**: Sorry, I'm not quite sure what your new Moon code is doing. Eclipse-grade calculations need to be pretty accurate, eg you can't use a fixed eccentricity. Accurate position is more important than accurate angular diameter, but if your position calculations are accurate then you should also get accurate angular diameters. Have you verified the accuracy of `getLunarDistance(datetime)` & `getLunarEquatorialCoordinate(datetime)`?  
> **username_2**: I don't know what all your constants are, but you should probably be using the IAU defined value of the AU, 149597870.700 km. The parallax of the Sun's position due to the observer's location on Earth is quite small, ~1% of the Sun's angular radius.  
> **username_0**: @PM2Ring Yeh, I assumed that the effect of parallax on the Sun was negligible when comparing the distances between the two.  Ok, so whilst I like the use of the AU to more precision, the difference seems to be negligible: 0.5417666941070021 degrees for the new precise value vs. 0.5417666941070021 from before. (Although this is definitely an improvement, so I will keep this).  I'm going to improve the accuracy on the Lunar distance calculation which is also from J.L Lawrence, but probably should be from Meeus for higher accuracy. Will amend this and update if I need any further help.  
> **username_0**: @PM2Ring I'm thinking at this point, improved accuracy of the Moon and Sun distance ... and correct the Moon diameter for parallax, and all should be good.  

---

## 0 answers

