Changeset 2375 for inundation/utilities/test_polygon.py
- Timestamp:
- Feb 9, 2006, 2:37:57 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/utilities/test_polygon.py
r2311 r2375 56 56 57 57 58 def test_polygon_function_georef(self): 59 """Check that georeferencing works 60 """ 61 62 from coordinate_transforms.geo_reference import Geo_reference 63 64 geo = Geo_reference(56, 200, 1000) 65 66 #Make points 'absolute' 67 p1 = [[200,1000], [210,1000], [210,1010], [200,1010]] 68 p2 = [[200,1000], [210,1010], [215,1005], [220, 1010], [225,1000], 69 [230,1010], [240,990]] 70 71 f = Polygon_function( [(p1, 1.0)], geo_reference = geo ) 72 z = f([5, 5, 27, 35], [5, 9, 8, -5]) #Two first inside p1 73 74 assert allclose(z, [1,1,0,0]) 75 76 77 f = Polygon_function( [(p2, 2.0)], geo_reference = geo ) 78 z = f([5, 5, 27, 35], [5, 9, 8, -5]) #First and last inside p2 79 assert allclose(z, [2,0,0,2]) 80 81 82 #Combined 83 f = Polygon_function( [(p1, 1.0), (p2, 2.0)], geo_reference = geo ) 84 z = f([5, 5, 27, 35], [5, 9, 8, -5]) 85 assert allclose(z, [2,1,0,2]) 86 87 88 #Check that it would fail without geo 89 f = Polygon_function( [(p1, 1.0), (p2, 2.0)]) 90 z = f([5, 5, 27, 35], [5, 9, 8, -5]) 91 assert not allclose(z, [2,1,0,2]) 92 93 94 58 95 def test_polygon_function_callable(self): 59 96 """Check that values passed into Polygon_function can be callable … … 84 121 z = f([5, 5, 27, 35], [5, 9, 8, -5]) 85 122 assert allclose(z, [2,14,35,2]) 123 86 124 87 125
Note: See TracChangeset
for help on using the changeset viewer.