Ignore:
Timestamp:
Mar 17, 2009, 4:02:54 PM (14 years ago)
Author:
rwilson
Message:

Revert back to 6481, prior to auto-merge of trunk and numpy branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/coordinate_transforms/test_redfearn.py

    r6517 r6533  
    122122
    123123    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)
    134127        zone, easting, northing = redfearn(-29.233299999,114.05)
    135128
     
    274267    #    #assert allclose(northing, 6181725.1724276)
    275268
    276    
    277     def Xtest_nonstandard_meridian_coinciding_with_native(self):
    278         """test_nonstandard_meridian_coinciding_with_native
    279 
    280         This test will verify that redfearn can be used to project
    281         points using an arbitrary central meridian that happens to
    282         coincide with the standard meridian at the center of a UTM zone.
    283         This is a preliminary test before testing this functionality
    284         with a truly arbitrary non-standard meridian.
    285         """
    286 
    287         # The file projection_test_points_z53.csv contains 10 points
    288         # which straddle the boundary between UTM zones 53 and 54.
    289         # They have been projected to zone 53 irrespective of where they
    290         # 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                 print
    311                 print 'Lat', lat
    312                 print 'Lon', lon
    313                 print 'Zone', zone
    314                 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 calculation
    318                 assert zone == forced_zone
    319                 print
    320                 #assert num.allclose(x, easting)
    321                 #assert num.allclose(y, northing)
    322 
    323    
    324    
    325    
    326     def Xtest_nonstandard_meridian(self):
    327         """test_nonstandard_meridian
    328 
    329         This test will verify that redfearn can be used to project
    330         points using an arbitrary central meridian.
    331         """
    332 
    333         # The file projection_test_points.csv contains 10 points
    334         # which straddle the boundary between UTM zones 53 and 54.
    335         # They have been projected using a central meridian of 137.5
    336         # degrees (the boundary is 138 so it is pretty much right
    337         # 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             print
    356             print 'Lat', lat
    357             print 'Lon', lon
    358             print 'Zone', zone
    359             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 calculation
    363             assert zone == -1 # Indicates non UTM projection
    364             print
    365             #assert num.allclose(x, easting)
    366             #assert num.allclose(y, northing)
    367 
    368         # Test that zone and meridian can't both be specified
    369         try:
    370             zone, easting, northing = redfearn(lat, lon,
    371                                                zone=50,
    372                                                central_meridian=137.5)
    373         except:
    374             pass
    375         else:
    376             msg = 'Should have raised exception'
    377             raise Exception, msg
    378 
    379            
    380269    def test_convert_lats_longs(self):
    381270
Note: See TracChangeset for help on using the changeset viewer.