Sun & Moon Rise and Set Accuracy Comparisons

Copy Markdown View Source

Comparisons of Astro.sunrise/3, Astro.sunset/3, Astro.moonrise/3, and Astro.moonset/3 against Skyfield (JPL DE440s), USNO (DE430), and timeanddate.com were run to confirm accuracy. They were run against Astro 2.8.0 and Skyfield 1.55, with both libraries reading the same de440s.bsp file.

Sunrise / Sunset

Both Astro and Skyfield use the JPL DE440s ephemeris, which explains their close agreement. The remaining difference of about a second comes from the horizon: Astro uses a fixed solar semi-diameter of 16′, while Skyfield uses the Sun's apparent semi-diameter, which is slightly larger in December when the Earth is nearest the Sun. The timeanddate.com data (used in the CSV test files) agrees with both to within ±1 minute; the 3 cases just over 60 seconds are a minute-rounding artefact.

The comparison uses test dates from December 2019 across 5 cities (Sydney, Moscow, NYC, São Paulo, Beijing) for a total of 310 comparisons.

Overall

ComparisonMax diffMean diffWithin ±1 min
Astro vs Skyfield1.6 s0.95 s310/310 (100%)
Astro vs timeanddate.com (CSV)61 s28.8 s307/310 (99.0%)
timeanddate.com vs Skyfield61 s28.5 s308/310 (99.4%)

Per-city (Astro vs Skyfield)

CityRise maxRise avgSet maxSet avg
Sydney1.0 s1.0 s0.7 s0.7 s
Moscow1.6 s1.6 s1.3 s1.3 s
NYC1.1 s1.1 s0.7 s0.7 s
São Paulo0.9 s0.9 s0.6 s0.6 s
Beijing1.1 s1.1 s0.7 s0.7 s

Moonrise / Moonset

The ~16 s mean difference against USNO is explained by two factors: USNO uses DE430 (vs the JPL DE440s that Astro uses), and USNO rounds to the nearest minute. Skyfield shows the same ~16 s offset against USNO, suggesting this is an ephemeris version difference rather than an algorithmic error.

The Skyfield comparison covers every moonrise and moonset in March 2026 across 4 cities (NYC, London, Sydney, Tokyo), a total of 240 comparisons. The USNO comparison uses the 67 cases in the test suite.

Overall

ComparisonMax diffMean diffWithin ±1 min
Astro vs Skyfield0.1 s0.08 s240/240 (100%)
Astro vs USNO29 s15.5 s67/67 (100%)
Skyfield vs USNO35 s15.6 s67/67 (100%)

Per-city (Astro vs Skyfield)

CityMax diffAvg diff
NYC0.1 s0.08 s
London0.1 s0.08 s
Sydney0.1 s0.08 s
Tokyo0.1 s0.08 s

Per-city (Astro vs USNO)

CityMax diffAvg diff
NYC29 s15.8 s
London29 s16.7 s
Sydney27 s11.9 s
Tokyo27 s17.8 s