def tmy_daily_average(datalist):
    """
    from a TMY list with 8760 hourly values calculate the day average

    attention when calculating solar values (ghi/dni/dhi), as the sum
    is averaged over the full 24 hours, night hours included

    input:
    - list with 8760 values, float

    returns:
    - list with 365 average values, float

    """
    day_average = []
    for d in range(0, 365):
        day_sum = 0
        for h in range(0, 24):
            h_idx = d * 24 + h
            day_sum = day_sum + datalist[h_idx]
        day_average.append(day_sum / 24)
    return day_average
