Ignore:
Timestamp:
Feb 24, 2009, 6:13:06 PM (15 years ago)
Author:
ole
Message:

Implemented ability to specify central meridian for non-UTM projections.
Test partially passes, but has been disabled for now.

File:
1 edited

Legend:

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

    r6400 r6404  
    1010from redfearn import *
    1111from anuga.utilities.anuga_exceptions import ANUGAError
    12 
     12from anuga.utilities.system_tools import get_pathname_from_package
     13from os.path import join
    1314import Numeric as num
    1415
     
    273274
    274275
    275     def test_nonstandard_meridian(self):
     276    def Xtest_nonstandard_meridian(self):
    276277        """test_nonstandard_meridian
    277278
     
    279280        points using an arbitrary central meridian.
    280281        """
    281 
    282 
    283         # FIXME: To do using csv file
    284         pass
    285 
    286282
    287283        # The file projection_test_points.csv contains 10 points
     
    291287        # in the middle of zones 53 and 54).
    292288
    293        
    294    
    295    
     289        path = get_pathname_from_package('anuga.coordinate_transforms')
     290        datafile = join(path, 'projection_test_points.csv')
     291        fid = open(datafile)
     292
     293        for line in fid.readlines()[1:]:
     294            fields = line.strip().split(',')
     295
     296            lon = float(fields[1])
     297            lat = float(fields[2])
     298            x = float(fields[3])
     299            y = float(fields[4])           
     300
     301            zone, easting, northing = redfearn(lat, lon,
     302                                               central_meridian=137.5)
     303
     304            print
     305            print 'Lat', lat
     306            print 'Lon', lon
     307            print 'Zone', zone
     308            print 'Ref x', x, 'Computed x', easting, 'Close enough:', num.allclose(x, easting)
     309            print 'Ref y', y, 'Computed y', northing, 'Close enough:', num.allclose(y, northing)
     310
     311            # Check calculation
     312            assert zone == -1 # Indicates non UTM projection
     313            print
     314            #assert num.allclose(x, easting)
     315            #assert num.allclose(y, northing)
     316
     317        # Test that zone and meridian can't both be specified
     318        try:
     319            zone, easting, northing = redfearn(lat, lon,
     320                                               zone=50, central_meridian=137.5)
     321        except:
     322            pass
     323        else:
     324            msg = 'Should have raised exception'
     325            raise Exception, msg
    296326
    297327    def test_convert_lats_longs(self):
Note: See TracChangeset for help on using the changeset viewer.