Changeset 6440


Ignore:
Timestamp:
Mar 3, 2009, 9:34:00 PM (16 years ago)
Author:
ole
Message:

Added more test points for nonstandard projections and a new test.
Both non standard project tests are disabled and don't pass fully.

Also added license files.

Location:
anuga_core/source/anuga/coordinate_transforms
Files:
4 added
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/coordinate_transforms/test_redfearn.py

    r6424 r6440  
    274274
    275275
     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   
    276326    def Xtest_nonstandard_meridian(self):
    277327        """test_nonstandard_meridian
     
    301351            zone, easting, northing = redfearn(lat, lon,
    302352                                               central_meridian=137.5,
    303                                                scale_factor=0.9998154)
     353                                               scale_factor=0.9996)
    304354
    305355            print
     
    320370            zone, easting, northing = redfearn(lat, lon,
    321371                                               zone=50,
    322                                                central_meridian=137.5,
    323                                                scale_factor=0.968)
     372                                               central_meridian=137.5)
    324373        except:
    325374            pass
     
    328377            raise Exception, msg
    329378
     379           
    330380    def test_convert_lats_longs(self):
    331381
     
    475525
    476526    #mysuite = unittest.makeSuite(TestCase,'test_convert_latlon_to_UTM1')
    477     #mysuite = unittest.makeSuite(TestCase,'test_UTM_6_nonstandard_projection')
    478     mysuite = unittest.makeSuite(TestCase,'test')
     527    mysuite = unittest.makeSuite(TestCase,'test_nonstandard_meridian_coinciding_with_native')
     528    #mysuite = unittest.makeSuite(TestCase,'test')
    479529    runner = unittest.TextTestRunner()
    480530    runner.run(mysuite)
Note: See TracChangeset for help on using the changeset viewer.