def slice_3d_grid(grid, n):
    """
    Takes a three dimensional array and an integer (n) and returns a 2d array
    containing the Nth value from the 3rd dimension at each location in the
    grid.
    """
    phen_grid = initialize_grid((len(grid[0]), len(grid)), 0)

    for i in range(len(grid)):
        for j in range(len(grid[i])):
            phen_grid[i][j] = grid[i][j][n]

    return phen_grid