skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.38k stars 208 forks source link

timescale With delta-T 0.0 Gives errors for the moon #976

Open sgbmzm opened 2 weeks ago

sgbmzm commented 2 weeks ago

Hello. For the Sun, I've been fine with setting delta-T to 0 on the time scale, but for the Moon, and probably other planets too, there are errors.

Note! The problems were discovered for the year 0094 where there is a large delta-t gap. It is possible that near the present the problem will not exist, but I deliberately brought the examples about the year 0094

Examples:

from skyfield.api import N, S, E, W, wgs84, load, load_file
from skyfield import almanac

eph = load('de441.bsp')
jerusalem = wgs84.latlon(31.776812 * N, 35.235694 * E)
observer = eph['Earth'] + jerusalem

ts = load.timescale()

t0 = ts.utc(94, 2, 2)
t1 = ts.utc(94, 2, 3)

print()
print("delta_t Default")

t, y = almanac.find_settings(observer, eph['SUN'], t0, t1, horizon_degrees=0.0)
print('Sunset (UT1):', t.ut1_strftime())
print('Sunset (UTC):', t.utc_strftime())

t, y = almanac.find_settings(observer, eph['Moon'], t0, t1, horizon_degrees=0.0)
print('Moonset (UT1):', t.ut1_strftime())
print('Moonset (UTC):', t.utc_strftime())

print()
print("delta_t=0.0")

ts = load.timescale(delta_t=0.0)

t0 = ts.utc(94, 2, 2)
t1 = ts.utc(94, 2, 3)

t, y = almanac.find_settings(observer, eph['SUN'], t0, t1, horizon_degrees=0.0)
print('Sunset (UT1):', t.ut1_strftime())
print('Sunset (UTC):', t.utc_strftime())

t, y = almanac.find_settings(observer, eph['Moon'], t0, t1, horizon_degrees=0.0)
print('Moonset (UT1):', t.ut1_strftime())
print('Moonset (UTC):', t.utc_strftime())

OUTPUT:

delta_t Default Sunset (UT1): ['0094-02-02 15:14:07 UT1'] Sunset (UTC): ['0094-02-02 17:51:09 UTC'] Moonset (UT1): ['0094-02-02 15:59:27 UT1'] Moonset (UTC): ['0094-02-02 18:36:29 UTC']

delta_t=0.0 Sunset (UT1): ['0094-02-02 15:13:35 UT1'] Sunset (UTC): ['0094-02-02 15:12:53 UTC'] Moonset (UT1): ['0094-02-02 15:51:16 UT1'] Moonset (UTC): ['0094-02-02 15:50:34 UTC']

Note that when it comes to the sun, there is a difference of about half a minute between: UT1 with normal delta-T and UT1 with delta-T 0.0 On the other hand, for the moon there is a difference of 8 minutes! Between: UT1 with normal delta-T and UT1 with delta-T 0.0

In both cases UTC moves back and almost reaches UT1 when delta-t is set to 0.0. And so it should be

another example:

from skyfield.api import N, S, E, W, wgs84, load, load_file
from skyfield import almanac

eph = load('de441.bsp')

ts = load.timescale()

print()
print("delta_t Default")

t0 = ts.utc(94, 1, 20)
t1 = ts.utc(94, 2, 8)

f = almanac.oppositions_conjunctions(eph, eph['moon'])
t, y = almanac.find_discrete(t0, t1, f)

print(t.ut1_strftime())
print(t.utc_strftime())
print(y)

print()
print("delta_t=0.0")

ts = load.timescale(delta_t=0.0)

t0 = ts.utc(94, 1, 20)
t1 = ts.utc(94, 2, 8)

f = almanac.oppositions_conjunctions(eph, eph['moon'])
t, y = almanac.find_discrete(t0, t1, f)

print(t.ut1_strftime())
print(t.utc_strftime())
print(y)

OUTPUT:

delta_t Default ['0094-02-01 23:45:50 UT1'] ['0094-02-02 02:22:52 UTC'] [1]

delta_t=0.0 ['0094-02-02 02:23:34 UT1'] ['0094-02-02 02:22:52 UTC'] [1]

In this case, the time of the conjunction of the moon with the sun according to UT1 is correct when delta-T is by default, but when delta-T is set to 0.0 there is a problem: UT1 has moved forward towards UTC which is not a good thing. The opposite should have happened: UTC should go back towards UT1.

These problems cause serious malfunctions in my software, and I would be very happy if the cause of these problems, and the solution, were revealed. Thank you