When the true Sun has just passed the Spring equinox but the 'mean' Sun has not, equation_of_time() returns an incorrect value. E.g. entering 21.0 March 2023 returns e=352 minutes 37.7 seconds where the correct value should be -7 minutes 22.3 seconds.
The fix is to convert all values in the calculation of e to float before assigning it, to avoid e being assigned as an Angle() object (which causes reduction to 0..360 range):
e = l0() - 0.0057183 - alpha() + deltapsi() * cos(epsilon.rad())
# FIX: in cases where alpha was just past the spring equinox but l0
# was still < 360, e was incorrectly calculated.
# We keep e now as a float and reduce to range -180 .. +180
e = e - 360.0 * round(e / 360.0)
e *= 4.0
# Extract seconds
s = (abs(e) % 1) * 60.0
m = int(e)
return m, s
When the true Sun has just passed the Spring equinox but the 'mean' Sun has not,
equation_of_time()
returns an incorrect value. E.g. entering 21.0 March 2023 returnse
=352 minutes 37.7 seconds where the correct value should be -7 minutes 22.3 seconds.The fix is to convert all values in the calculation of
e
to float before assigning it, to avoide
being assigned as an Angle() object (which causes reduction to 0..360 range):