def sst_data(x, y):
    return x * (1 - x) * np.cos(4 * np.pi * x) * np.sin(4 * np.pi * y ** 2
        ) ** 2
x = np.random.rand(1000)
y = np.random.rand(1000)
sst = sst_data(x, y)
grid_x, grid_y = np.mgrid[0:1:100j, 0:1:200j]
grid_z = griddata((x, y), sst, (grid_x, grid_y), method='cubic')
Contour irregular data within polygon