# Eclipses with SkyField

I'm trying to compute solar eclipses for a long period of time, see Back-predicting solar eclipses

Initially, I wanted at several points on Earth whether an eclipse was visible at some point in time. I have since changed the approach and I will now compute whether an eclipse could be seen from the center of the Earth at a given moment. Later, after knowing roughly the time of the eclipse, I will iterate over a grid on Earth to check where it could be actually seen. So far, my first question is: is it right to check for eclipses at the center of the Earth?

Secondly, I wrote a small code in Python to test how good I am at predicting eclipses, checking against https://eclipse.gsfc.nasa.gov/SEsearch/SEsearchmap.php?Ecl=01501207 for these coordinates:

Lat.: 27.4782° N Long.: 109.9299° W

#!/usr/bin/python

from skyfield.positionlib import ICRF

earth = planets['earth']
sun = planets['sun']
moon = planets['moon']

time = ts.utc(150,12,06,23,49,21.9)
place = earth + Topos('27.4782 N','109.9299 W')

observe_moon = place.at(time).observe(moon).apparent().position.au
observe_sun = place.at(time).observe(sun).apparent().position.au
distance = ICRF(observe_moon).separation_from(ICRF(observe_sun))
distance = distance.degrees

print distance


The distance I obtain is above 10 degrees, while at the time provided, if I did things correctly, the eclipse was at its maximum at those coordinates. What is wrong in my code or my understanding?

I believe the differences here are caused by the different timescales that are being used by SkyField vs NASA.

It seems that SkyField uses the proleptic Gregorian calendar for dates in the past. However, NASA used the Julian Calendar for dates before 1582, so for example, the eclipse on 0150-12-06 (Julian) falls on 0150-12-05 in Gregorian. Also, I would use ts.ut1 instead of ts.utc, as ut1 is the timescale used by NASA.

Using the geocenter can be a efficient way to check for eclipses worldwide. When observing from the geocenter, the penumbral shadow cone touches the Earth when the following condition is true: $$\mu ≤ arcsin(\frac{r_m + r_e}{d_m}) + arcsin(\frac{R_s - r_e}{D_s})$$ Where $\mu$ is the angular separation between the Sun and the Moon, $D_s$ is the distance of the Sun, $d_m$ the distance of the Moon, and the three constant radii are:

Sun: $R_s = 695700 km$

Earth: $r_e = 6378 km$

Moon: $r_m = 1737.4 km$

This indicates that an eclipse, at least partial, is occuring somewhere on the Earth. The formula uses a spherical Earth as an approximation of its shape, so in some rare cases it can detect very near-misses by 20-25 km, but overall it is a good way to narrow down the search. Also, it is unnecessary to test this when the angular separation is outside the range 1.3° - 1.7°, since values below 1.3° always produce an eclipse, and values above 1.7° never produce one.

I would also like to point out that uncertainties, mostly in Earth's rotation speed, make it very difficult to know where eclipses occured on the surface of the Earth for dates in the far past. The uncertainty becomes very large outside the range BC2000 - AD3000. This is the reason why NASA hasn't computed eclipse paths outside that range. According to research, the uncertainty could be as large as over 4 hours (several thousands of kilometers for eclipse paths) for dates before BC4000. See this explanation on NASA's Eclipse Web Site.

• Note that you can tell SkyField to switch over to Julian at a date of your choosing. The usual date is even given as a constant: ts.julian_calendar_cutoff = GREGORIAN_START You do have to load that constant, though: from skyfield.api import GREGORIAN_START – L. Scott Johnson Oct 22 at 17:10

To answer your first question, you will rarely or never see a total eclipse at the center of the Earth because the moon's shadow isn't long enough. You would, however, see partial annular eclipses.

If you do see a partial annular eclipse at the center of the Earth, there will definitely be one (not necessarily total) somewhere on the surface of the Earth.

The opposite, however, is not true. It's quite possible for locations on Earth to see a solar eclipse, but the shadow not to pass through the Earth's center, so a center-of-Earth (geocentric) observer wouldn't see even an annular or partial eclipse.

Standard debugging tip: try with an eclipse closer to today to see if it's the code, inaccuracy of Skyfield, or just that the umbra didn't hit the Earth's center.

• It is a bit disappointing that the approach will not be successful. Do you have any advice regarding this? My goal was to compute whether eclipses were observable on a fine grid on Earth between years 6000BC and 5000BC (or some other time in the past); going grid-point by grid-point is not feasible in terms of time. A recent eclipse works and the code placed the observer at the coordinates of the greatest eclipse. Maybe ephemeris are not that precise further back. – Keizer Oct 4 '17 at 7:30
• Well, I did notice you were using DE422. For more precision, consider using DE431: it's bigger, but more precise: naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets – user21 Oct 4 '17 at 12:13
• In general I was using DE431T. I changed it to check if the problem was the ephemeris. It is quite weird. When I run an alternative code to compute the moon-sun separation at a given time and place; for the eclipse of 09283 1901 May 18 05:33:48 -1 -1220 136 T n- -0.3626 1.0680 2S 98E 69 238 06m29s, see eclipse.gsfc.nasa.gov/SEcat5/SE1901-2000.html I obtain a separation of 0.17 degrees Instead, for 05023 0101 Jan 17 10:44:09 9542 -23487 52 P -t 1.4885 0.1101 68N 47E 0, see eclipse.gsfc.nasa.gov/SEcat5/SE0101-0200.html I get: 12 degrees – Keizer Oct 4 '17 at 12:29
• Compare your results w/ HORIZONS ssd.jpl.nasa.gov/?horizons and they should match. If you can show HORIZONS is inconsistent with eclipse.gsfc.nasa.gov/SEcat5/SE0101-0200.html you can complain to NASA directly. Also, try looping through your time variable to see if it's maybe a timezone error or off-by-one-day error or something. – user21 Oct 4 '17 at 12:54