Skip to content

Commit

Permalink
#110 add nearest_cell test
Browse files Browse the repository at this point in the history
  • Loading branch information
debboutr committed Apr 10, 2020
1 parent 3dba26c commit 35baf17
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ def test_constructors():
def test_dtype():
assert(grid.dir.dtype == np.uint8)

def test_nearest_cell():
'''
corner: snaps to nearest top/left
center: snaps to index of cell that contains the geometry
'''
col, row = grid.nearest_cell(x, y, snap='corner')
assert (col, row) == (229, 101)
col, row = grid.nearest_cell(x, y, snap='center')
assert (col, row) == (228, 100)

def test_catchment():
# Reference routing
grid.catchment(x, y, data='dir', dirmap=dirmap, out_name='catch',
Expand Down

0 comments on commit 35baf17

Please sign in to comment.