def datetime2doy(dt):
    """Python datetime to (decimal) day of year
    
    Parameters
    ----------
    dt : datetime.datetime

    Returns
    -------
    doy : float
        
    """
    return dt.timetuple().tm_yday + dt.hour/24. + dt.minute/24./60. + dt.second/86400. + dt.microsecond/86400./1e6