Adaptado de la página de Celestrak del Dr. T.S. Kelso

Using Meeus' approach, the Python code for calculating the Julian Date of January 0.0 of any year would be:


In [1]:
def Julian_Date_of_Year(year):
    A, B = 0, 0
    year -=1
    A = int(year/100.0)
    B = 2 - A + int(A/4.0)
    return int(365.25 * year) \
            + int(30.6001 * 14) \
            + 1720994.5 + B

To calculate the Julian Date of any calendar date, we simply combine the Julian Date of that year with the day of the year, where the day of the year can be calculated as:


In [2]:
def DOY(yr, mo, dy):
    days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    day = 0
    for i in range(mo-1):
        day += days[i]
    day += dy
    if (yr % 4 == 0) and ( (yr % 100 != 0) or (yr % 400 == 0) ) and \
    (mo > 2):
        day += 1
    return day

As an example, the Julian Date of $0^h$ UTC on 1995 October 01 would be written as:


In [3]:
JD = Julian_Date_of_Year(1995) + DOY(1995, 10, 8)

with a result of:


In [4]:
Julian_Date_of_Year(1995)


Out[4]:
2449717.5

In [5]:
DOY(1995, 10, 1)


Out[5]:
274

In [6]:
JD


Out[6]:
2449998.5