def find_nearest_datapoint(lat, lon, ds):
    """Find the point in the dataset closest to the given latitude and longitude"""
    datapoint_lats = ds.coords.indexes["latitude"]
    datapoint_lons = ds.coords.indexes["longitude"]
    lat_nearest = min(datapoint_lats, key=lambda x: abs(x - lat))
    lon_nearest = min(datapoint_lons, key=lambda x: abs(x - lon))
    return lat_nearest, lon_nearest