@@ -0,0 +1,1474 @@
+from parcels import Grid%0Aimport numpy as np%0Aimport pytest%0A%0A%0A@pytest.fixture%0Adef grid(xdim=200, ydim=100):%0A    %22%22%22 Standard grid spanning the earth's coordinates with U and V%0A        equivalent to longitude and latitude.%0A    %22%22%22%0A    lon = np.linspace(-180, 180, xdim, dtype=np.float32)%0A    lat = np.linspace(-90, 90, ydim, dtype=np.float32)%0A    depth = np.zeros(1, dtype=np.float32)%0A    time = np.zeros(1, dtype=np.float64)%0A    U, V = np.meshgrid(lat, lon)%0A    return Grid.from_data(np.array(U, dtype=np.float32), lon, lat,%0A                          np.array(V, dtype=np.float32), lon, lat,%0A                          depth, time)%0A%0A%0Adef test_grid_sample(grid, xdim=120, ydim=80):%0A    %22%22%22 Sample the grid using indexing notation. %22%22%22%0A    lon = np.linspace(-170, 170, xdim, dtype=np.float32)%0A    lat = np.linspace(-80, 80, ydim, dtype=np.float32)%0A    v_s = np.array(%5Bgrid.V%5B0, x, 70.%5D for x in lon%5D)%0A    u_s = np.array(%5Bgrid.U%5B0, -45., y%5D for y in lat%5D)%0A    assert np.allclose(v_s, lon, rtol=1e-12)%0A    assert np.allclose(u_s, lat, rtol=1e-12)%0A%0A%0Adef test_grid_sample_eval(grid, xdim=60, ydim=60):%0A    %22%22%22 Sample the grid using the explicit eval function. %22%22%22%0A    lon = np.linspace(-170, 170, xdim, dtype=np.float32)%0A    lat = np.linspace(-80, 80, ydim, dtype=np.float32)%0A    v_s = np.array(%5Bgrid.V.eval(0, x, 70.) for x in lon%5D)%0A    u_s = np.array(%5Bgrid.U.eval(0, -45., y) for y in lat%5D)%0A    assert np.allclose(v_s, lon, rtol=1e-12)%0A    assert np.allclose(u_s, lat, rtol=1e-12)%0A

Add a simple set of tests for explicit grid sampling