Changeset 2590 for inundation/geospatial_data/test_geospatial_data.py
- Timestamp:
- Mar 24, 2006, 2:43:10 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/geospatial_data/test_geospatial_data.py
r2589 r2590 202 202 [1.0, 2.1], [3.0, 5.3]]) 203 203 204 def test_add 1(self):204 def test_add_with_geo (self): 205 205 """ 206 206 Difference in Geo_reference resolved … … 208 208 points1 = [[1.0, 2.1], [3.0, 5.3]] 209 209 points2 = [[5.0, 6.1], [6.0, 3.3]] 210 attributes1 = [2, 4]210 attributes1 = [2, 4] 211 211 attributes2 = [5, 76] 212 212 geo_ref1= Geo_reference(55, 1.0, 2.0) 213 geo_ref2 = Geo_reference(zone = 55, xllcorner = 0.1, 214 yllcorner = 3.0, datum = 'wgs84', 215 projection = 'UTM', units = 'm') 213 geo_ref2 = Geo_reference(zone=55, 214 xllcorner=0.1, 215 yllcorner=3.0, 216 datum='wgs84', 217 projection='UTM', 218 units='m') 216 219 217 220 G1 = Geospatial_data(points1, attributes1, geo_ref1) 218 221 G2 = Geospatial_data(points2, attributes2, geo_ref2) 219 222 223 #Check that absolute values are as expected 224 P1 = G1.get_data_points(absolute=True) 225 assert allclose(P1, [[2.0, 4.1], [4.0, 7.3]]) 226 227 P2 = G2.get_data_points(absolute=True) 228 assert allclose(P2, [[5.1, 9.1], [6.1, 6.3]]) 229 220 230 G = G1 + G2 221 231 222 232 assert allclose(G.get_geo_reference().get_xllcorner(), 0.1) 223 233 assert allclose(G.get_geo_reference().get_yllcorner(), 2.0) 224 # print 'G data points=', G.get_data_points() 225 assert allclose(G.get_data_points(), [[2.0, 4.1], [4.0, 7.3], [5.1, 9.1], [6.1, 6.3]]) 226 234 235 P = G.get_data_points(absolute=True) 236 assert allclose(P, concatenate( (P1,P2) )) 237 238 P_relative = G.get_data_points(absolute=False) 239 assert allclose(P_relative, P - [0.1, 2.0]) 240 assert allclose(P, [[2.0, 4.1], [4.0, 7.3], 241 [5.1, 9.1], [6.1, 6.3]]) 227 242 228 243
Note: See TracChangeset
for help on using the changeset viewer.