예제 #1
0
def test_findSourceValues():
   """
   @summary: This test checks that source values can be found for proper inputs
   """
   myInstance = SingleTileLCP(M_INPUT_RASTER, '', 
                              seaLevelRiseCostFn)
   myInstance.findSourceCells()
   assert len(myInstance.sourceCells) > 0
예제 #2
0
def test_findSourceValues_underSeaLevel():
   """
   @summary: This test checks that things operate correctly when an input 
                surface is under sea level
   """
   myInstance = SingleTileLCP(BELOW_SEA_LEVEL_RASTER, '', 
                              seaLevelRiseCostFn)
   myInstance.findSourceCells()
   assert len(myInstance.sourceCells) == 10000
예제 #3
0
def test_findSourceValues_noSourceValues():
   """
   @summary: This test checks that things operate correctly when an input 
                surface does not have source values in it
   """
   myInstance = SingleTileLCP(M_INPUT_RASTER_NO_SOURCES, '', 
                              seaLevelRiseCostFn)
   myInstance.findSourceCells()
   print myInstance.sourceCells
   assert len(myInstance.sourceCells) == 0
예제 #4
0
"""
import numpy

from slr.singleTile.base import SingleTileLCP

if __name__ == "__main__":
   
   inFn = 'testSurface.asc'
   outFn = 'testOut.asc'
   
   costFn = lambda x,y,z: min(x,y)
   t1 = SingleTileLCP(inFn, outFn, costFn)
   t2 = SingleTileLCP(inFn, outFn, costFn)
   t3 = SingleTileLCP(inFn, outFn, costFn)
   
   t1.findSourceCells()
   
   v1 = numpy.array([5, 3, 1, 2, 5])
   v2 = numpy.array([8, 3, 4, 1, 2, 4])
   
   t2.addSourceVector(v1, 0)
   t3.addSourceVector(v2, 1)
   
   print "t1"
   print t1.sourceCells
   
   print
   print "t2"
   print t2.sourceCells
   print