- Timestamp:
- Mar 17, 2009, 4:02:54 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/coordinate_transforms/test_redfearn.py
r6517 r6533 122 122 123 123 def test_UTM_6_nonstandard_projection(self): 124 """test_UTM_6_nonstandard_projection 125 126 Test that projections can be forced to 127 use other than native zone. 128 129 Data is from Geraldton, WA 130 """ 131 132 133 # First test native projection (zone 50) 124 #Test 6 (Geraldton, WA) 125 126 #First test native projection (zone 50) 134 127 zone, easting, northing = redfearn(-29.233299999,114.05) 135 128 … … 274 267 # #assert allclose(northing, 6181725.1724276) 275 268 276 277 def Xtest_nonstandard_meridian_coinciding_with_native(self):278 """test_nonstandard_meridian_coinciding_with_native279 280 This test will verify that redfearn can be used to project281 points using an arbitrary central meridian that happens to282 coincide with the standard meridian at the center of a UTM zone.283 This is a preliminary test before testing this functionality284 with a truly arbitrary non-standard meridian.285 """286 287 # The file projection_test_points_z53.csv contains 10 points288 # which straddle the boundary between UTM zones 53 and 54.289 # They have been projected to zone 53 irrespective of where they290 # belong.291 292 path = get_pathname_from_package('anuga.coordinate_transforms')293 294 for forced_zone in [53, 54]:295 296 datafile = join(path, 'projection_test_points_z%d.csv' % forced_zone)297 fid = open(datafile)298 299 for line in fid.readlines()[1:]:300 fields = line.strip().split(',')301 302 lon = float(fields[1])303 lat = float(fields[2])304 x = float(fields[3])305 y = float(fields[4])306 307 zone, easting, northing = redfearn(lat, lon,308 zone=forced_zone)309 310 print311 print 'Lat', lat312 print 'Lon', lon313 print 'Zone', zone314 print 'Ref x', x, 'Computed x', easting, 'Close enough:', num.allclose(x, easting)315 print 'Ref y', y, 'Computed y', northing, 'Close enough:', num.allclose(y, northing)316 317 # Check calculation318 assert zone == forced_zone319 print320 #assert num.allclose(x, easting)321 #assert num.allclose(y, northing)322 323 324 325 326 def Xtest_nonstandard_meridian(self):327 """test_nonstandard_meridian328 329 This test will verify that redfearn can be used to project330 points using an arbitrary central meridian.331 """332 333 # The file projection_test_points.csv contains 10 points334 # which straddle the boundary between UTM zones 53 and 54.335 # They have been projected using a central meridian of 137.5336 # degrees (the boundary is 138 so it is pretty much right337 # in the middle of zones 53 and 54).338 339 path = get_pathname_from_package('anuga.coordinate_transforms')340 datafile = join(path, 'projection_test_points.csv')341 fid = open(datafile)342 343 for line in fid.readlines()[1:]:344 fields = line.strip().split(',')345 346 lon = float(fields[1])347 lat = float(fields[2])348 x = float(fields[3])349 y = float(fields[4])350 351 zone, easting, northing = redfearn(lat, lon,352 central_meridian=137.5,353 scale_factor=0.9996)354 355 print356 print 'Lat', lat357 print 'Lon', lon358 print 'Zone', zone359 print 'Ref x', x, 'Computed x', easting, 'Close enough:', num.allclose(x, easting)360 print 'Ref y', y, 'Computed y', northing, 'Close enough:', num.allclose(y, northing)361 362 # Check calculation363 assert zone == -1 # Indicates non UTM projection364 print365 #assert num.allclose(x, easting)366 #assert num.allclose(y, northing)367 368 # Test that zone and meridian can't both be specified369 try:370 zone, easting, northing = redfearn(lat, lon,371 zone=50,372 central_meridian=137.5)373 except:374 pass375 else:376 msg = 'Should have raised exception'377 raise Exception, msg378 379 380 269 def test_convert_lats_longs(self): 381 270
Note: See TracChangeset
for help on using the changeset viewer.