def METHOD_NAME(site_id, api_key=None):
    cycle_point = os.environ['CYLC_TASK_CYCLE_POINT']
    # Try to get the information from SYNOPS.
    dist = 0.0
    badsites = []
    fails = True
    obs = None
    while dist < 1 and fails:
        try:
            obs = synop_grab(site_id, cycle_point)
            fails = False
        except NoDataException:
            badsites.append(f'{int(site_id):05d}')
            site_id, dist = get_nearby_site(site_id, badsites)
    if obs is None:
        if api_key:
            print('Attempting to get weather data from DataPoint...')
            data = get_datapoint_data(site_id, cycle_point, api_key)
        else:
            print('No API key provided, falling back to archived data')
            data = get_archived_data(site_id, cycle_point)
        obs = extract_observations(data)
    # Write observations.
    with open('wind.csv', 'w+') as data_file:
        data_file.write(', '.join(obs))