Source

dem_waters_extractor / test.py

Full commit
from demfunctions import (fill_sinks,lift,get_vect_martrix,count_water)

#data_const = [[1,1,3,4,5,5,7,5,4],
#        [1,2,4,4,4,4,6,5,3],
#        [4,4,3,4,3,3,6,7,5],
#        [3,3,2,3,2,2,4,6,7],
#        [1,2,2,2,1,2,3,4,5],
#        [3,3,2,1,1,2,3,6,6],
#        [2,3,3,1,1,2,5,7,8],
#        [1,2,3,3,3,3,4,8,6],
#        [1,1,2,3,3,4,5,7,8]
#        ]
#def test_fill_sinks():
#    data = [[1,1,3,4,5,5,7,5,4],
#            [1,2,4,4,4,4,6,5,3],
#            [4,4,3,4,3,3,6,7,5],
#            [3,3,2,3,2,2,4,6,7],
#            [1,2,2,2,1,2,3,4,5],
#            [3,3,2,1,1,2,3,6,6],
#            [2,3,3,1,1,2,5,7,8],
#            [1,2,3,3,3,3,4,8,6],
#            [1,1,2,3,3,4,5,7,8] ]
#    return fill_sinks(data)
#
#print test_fill_sinks()

def test_lift():
    data = [[1,1,3,4,5,5,7,5,4],
            [1,2,4,4,4,4,6,5,3],
            [4,4,3,4,3,3,6,7,5],
            [3,3,2,3,2,2,4,6,7],
            [1,2,2,2,1,2,3,4,5],
            [3,3,2,1,1,2,3,6,6],
            [2,3,3,1,1,2,5,7,8],
            [1,2,3,3,3,3,4,8,6],
            [1,1,2,3,3,4,5,7,8]]
    data_modified = fill_sinks(data)
    return lift(data,0.1)

print test_lift()

#def test_get_vect_martrix():
#    data = [[1,1,3,4,5,5,7,5,4],
#            [1,2,4,4,4,4,6,5,3],
#            [4,4,3,4,3,3,6,7,5],
#            [3,3,2,3,2,2,4,6,7],
#            [1,2,2,2,1,2,3,4,5],
#            [3,3,2,1,1,2,3,6,6],
#            [2,3,3,1,1,2,5,7,8],
#            [1,2,3,3,3,3,4,8,6],
#            [1,1,2,3,3,4,5,7,8]]
#    data_modified = fill_sinks(data)
#    data_lifted = lift(data,data_modified,1e-5)
#    return get_vect_martrix(data_lifted,1,1)
#
#print test_get_vect_martrix()

#def test_count_water():
#    data = [[1,1,3,4,5,5,7,5,4],
#            [1,2,4,4,4,4,6,5,3],
#            [4,4,3,4,3,3,6,7,5],
#            [3,3,2,3,2,2,4,6,7],
#            [1,2,2,2,1,2,3,4,5],
#            [3,3,2,1,1,2,3,6,6],
#            [2,3,3,1,1,2,5,7,8],
#            [1,2,3,3,3,3,4,8,6],
#            [1,1,2,3,3,4,5,7,8]]
#    data_modified = fill_sinks(data)
#    data_lifted = lift(data,data_modified,1e-5)
#    vect_martrix = get_vect_martrix(data_lifted,1,1)
#    return count_water(vect_martrix)
#print test_count_water()