import requests


def check_data_online(adate):
    """ check data is online for a given date"""
    # total 136 AOIs
    # 5-day composite
    # https://floodlight.ssec.wisc.edu/composite/RIVER-FLDglobal-composite_*_000900.part*.tif
    # 1-day composite
    # https://floodlight.ssec.wisc.edu/composite/RIVER-FLDglobal-composite1_*_000000.part*.tif
    
    testurl = 'https://floodlight.ssec.wisc.edu/composite/RIVER-FLDglobal-composite_{}_000000.part001.tif'
    testurl = testurl.format(adate)
    r = requests.head(testurl)
    if r.status_code == 404:
        online = False
    else:
        online = True
    
    return online