skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.39k stars 209 forks source link

Add eclipse magnitude and use Danjon's method for shadow enlargement in lunar_eclipses #821

Closed BarryBalls closed 1 year ago

BarryBalls commented 1 year ago

I just have a couple of small additions to the lunar_eclipses function for your consideration which add functionality at negligible cost. You can see the code for both here: https://github.com/BarryBalls/python-skyfield/pull/1/files

  1. Add umbral and penumbral magnitude. This is information commonly found in eclipse catalogs and the variables are already calculated within the function so it might be nice to include the calculated values in the details array.

  2. Use Danjon's (1951) method for calculating the enlargement of the Earth's shadow in preference to Chauvenet (1891). It's actually a slightly simpler calculation and is used in Five Millennium Catalog of Lunar Eclipses: -1999 to +3000 (NASA TP-2009-214173), Meeus and Mucke (1979), Espenak (2006) and Connaissance des Temps. Several sources using Chauvenet's method are Espenak (1989), Liu and Fiala (1992), and Astronomical Almanac. See: https://eclipse.gsfc.nasa.gov/LEcat5/shadow.html

Danjon's method does return very slightly smaller results which could potentially move some eclipses from total to partial, or partial to penumbral, etc, but it does seem to be used more often in the sources that I have found.

Here's a table with the lunar eclipses 2020-2024 from the Five Millennium Catalog on the left, lunar_eclipses (DE440s) with Danjon's method in the middle and lunar_eclipses (DE440s) with Chauvenet's method on the right. It tracks pretty closely considering that they are using different ephemeris:

        Catalog   Danjon        Chauvenet
2020 Jan 10  -0.1160  -0.117800  -0.112583
2020 Jun 05  -0.4053  -0.405256  -0.399662
2020 Jul 05  -0.6436  -0.645758  -0.640408
2020 Nov 30  -0.2620  -0.261670  -0.257236
2021 May 26   1.0095   1.010313   1.016195
2021 Nov 19   0.9742   0.975139   0.979500
2022 May 16   1.4137   1.412692   1.418431
2022 Nov 08   1.3589   1.357695   1.362477
2023 May 05  -0.0457  -0.047381  -0.042142
2023 Oct 28   0.1220   0.120391   0.125762
2024 Mar 25  -0.1325  -0.132051  -0.127593
2024 Sep 18   0.0848   0.085219   0.091023
brandon-rhodes commented 1 year ago

@BarryBalls — Thank you for this contribution, I think it's a definite improvement to the routine! With the old method (and thanks for naming it, I didn't know its source or date!), the script design/eclipses_lunar.py in the repository prints:

Extra: 71 / 7238
Mismatch: 28 / 7238

But if I pull in your version of the routine, then the numbers are much smaller!

Extra: 3 / 7238
Mismatch: 14 / 7238
Missing: 2 / 7238

There is only one snag: the documentation currently makes the proud claim that ‘Skyfield does currently find every one of the 7,238 lunar eclipses' in the Canon. It looks like making this adjustment would mean missing two eclipses from the Canon:

                      - 859-05-20 13:38:04 TT N MISSING eclipse!
...
                       - 2791-02-11 02:59:35 TT N MISSING eclipse!

(That's from a slightly improved version of design/eclipses_lunar.py that I'm about to commit, that shows the actual dates of any missing eclipses; since there weren't any before, it wasn't written to print their dates.)

I'll go look up how significant those eclipses were. And I'll probably land your new code in any case; maybe I'll first adjust the docs, and see if the missing eclipses are easy to explain!