def ymd2jd(year, month, day):
    """
    Converts a year, month, and day to a Julian Date.
    This function uses an algorithm from the book "Practical Astronomy with your
    Calculator" by Peter Duffet-Smith (Page 7)

    Parameters
    ----------
    year : int
        A Gregorian year
    month : int
        A Gregorian month
    day : int
        A Gregorian day

    Returns
    -------
    jd : float
        A Julian Date computed from the input year, month, and day.

    """
    if month == 1 or month == 2:
        yprime = year - 1
        mprime = month + 12
    else:
        yprime = year
        mprime = month

    if year > 1582 or (year == 1582 and (month >= 10 and day >= 15)):
        A = int(yprime / 100)
        B = 2 - A + int(A / 4.0)
    else:
        B = 0

    if yprime < 0:
        C = int((365.25 * yprime) - 0.75)
    else:
        C = int(365.25 * yprime)

    D = int(30.6001 * (mprime + 1))

    return B + C + D + day + 1720994.5

    #def ymd2weekday(year, month, day):
    """ Returns the day of the week for the specified year, month, and day """
    jd = ymd2jd(year, month, day)
    A = (jd + 1.5) / 7.0
    return dayNames[round((A - int(A)) * 7.0)]