def find_nearest_gridpoint(grid_lat, grid_lon, olat, olon, nx, ny, dx, dy, data):
    """Find nearest gridpoint in a regular grid

    Parameters
    ----------
    grid_lat : list
        List of latitudes in regular grid
    grid_lon : list
        List of longitudes in regular grid
    olat : float
        Latitude of point of interest
    olon : float
        Longitude of point of interest
    nx : integer
        Number of gridpoints in x-direction
    ny : integer
        Number of gridpoints in y-direction
    dx : float
        Horisontal resolution in degrees in x-direction
    dy : float
        Horisontal resolution in degrees in y-direction
    data : list
        List of data

    Returns
    -------
    datapoint : float
        The nearest value from data
    """
    i = int((olon - grid_lon[0]) / dx)
    j = int((olat - grid_lat[0]) / dy * nx)

    nearest_index = int((i % nx) + (j - (j % nx)))
    return data[nearest_index]