Пример #1
0
def test_get_neighbours_grid(mocker, bathygrid):
    
    # Mock the variables class
    variables = mocker.Mock()
    variables.bathygriddeltax = 10.
    variables.bathygriddeltay = 10.
    variables.bathygrid = bathygrid
    
    sysorig = (20, 21)
    closest_point = (20, 20, -20)
    
    test = Loads(variables)
    indexes, points = test._get_neighbours(sysorig,
                                           closest_point)
        
    assert set(indexes) == set([6, 8, 16, 18])
    assert np.isclose(points, bathygrid[indexes, :]).all()
Пример #2
0
def test_get_neighbours_local(mocker, bathygrid):
    
    # Mock the variables class
    variables = mocker.Mock()
    variables.bathygriddeltax = 10.
    variables.bathygriddeltay = 10.
    variables.bathygrid = bathygrid
    
    sysorig = (21, 21)
    local = (8, 8)
    closest_point = (30, 30, -30)
    
    test = Loads(variables)
    indexes, points = test._get_neighbours(sysorig,
                                           closest_point,
                                           local)
            
    assert set(indexes) == set([12, 13, 17, 18])
    assert np.isclose(points, bathygrid[indexes, :]).all()