The number B is used in Section 14.3, “SiderealTime.utc(): Find Universal
Time” and Section 14.7, “SiderealTime.fromDatetime(): Convert
UTC to GST (static method)”. The
algorith is given in section 12 of Duffett-Smith. It is a
function of the year, and expresses the GST at 0:00 on
January 0 of the year.
# - - - S i d e r e a l T i m e . f a c t o r B
# @staticmethod
def factorB ( yyyy ):
"""Compute sidereal conversion factor B for a given year.
[ yyyy is a year number as an int ->
return the GST at time yyyy-01-00T00:00 ]
"""
Step 1: “Calculate the Julian date of January 0.0
of year in question.” Unfortunately, we can't just
blithely pass the datetime.datetime()
constructor that date, because it's not a proper date
(“ValueError: day is out of range for
month”). So we'll get around that by finding the
JD of Jan. 1, converting it to a float, and subtracting 1.0.
#-- 1 --
# [ janJD := the Julian date of January 0.0 of year
# (yyyy), as a float ]
janDT = datetime.datetime ( yyyy, 1, 1 )
janJD = float(JulianDate.fromDatetime(janDT)) - 1.0
Steps 2–4 are exactly as described in Duffett-Smith, except that we rearrange the polynomial (6.646 065 6+(2400.051 262×T)+(0.000 025 81×T2) to the computationally more straightforward form.
#-- 2 --
s = janJD - 2415020.0
#-- 3 --
t = s / 36525.0
#-- 4 --
r = ( 0.00002581 * t +
2400.051262 ) * t + 6.6460656
Step 5: “Calculate U=R-(24×(year-1900)).” Step 6: “Subtract U from 24. This is B.”
#-- 5 --
u = r - 24 * ( yyyy-1900)
#-- 6 --
return 24.0 - u
factorB = staticmethod(factorB)