def julian_date(date):
    """Returns the julian day of a date and includes the decimal portion. These
    calculations were taken from section 6.1.1 of Radiometric Use of WorldView-2
    Imagery. See references.txt for more information."""
    year = date.year
    month = date.month
    day = date.day
    UT = date.hour + date.minute/60.0 + date.second/3600.0
    if year <= 2:
        year = year - 1
        month += 12
    A = year // 100
    B = 2 - A + A // 4
    JD = int( 365.25 * (year + 4716) ) + int( 30.6001 * (month + 1) ) + day + UT / 24.0 + B - 1524.5
    return JD