def fun_smooth(x, y):
    return np.cos(np.pi * x) * np.sin(np.pi * y)

def fun_evil(x, y):
    return np.where(x ** 2 + y ** 2 > 1e-10, x * y / (x ** 2 + y ** 2), 0.5)
N_sparse = 6
x_sparse, y_sparse = gimme_mesh(N_sparse)
z_sparse_smooth = fun_smooth(x_sparse, y_sparse)
z_sparse_evil = fun_evil(x_sparse, y_sparse)
N_scattered = 10
x_scattered, y_scattered = np.random.rand(2, N_scattered ** 2) * 2 - 1
z_scattered_smooth = fun_smooth(x_scattered, y_scattered)
z_scattered_evil = fun_evil(x_scattered, y_scattered)
N_dense = 20
x_dense, y_dense = gimme_mesh(N_dense)
How can I perform two-dimensional interpolation using scipy?