Ignore:
Timestamp:
Jun 2, 2010, 1:15:38 PM (14 years ago)
Author:
hudson
Message:

File tests passing OK - extra module for .urs files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/file/test_mux.py

    r7762 r7766  
    1010from anuga.coordinate_transforms.geo_reference import Geo_reference
    1111
     12from mux import WAVEHEIGHT_MUX_LABEL, EAST_VELOCITY_LABEL, \
     13                            NORTH_VELOCITY_LABEL
     14
    1215from mux import WAVEHEIGHT_MUX2_LABEL, EAST_VELOCITY_MUX2_LABEL, \
    1316                NORTH_VELOCITY_MUX2_LABEL
     
    1518from mux import read_mux2_py
    1619from anuga.file_conversion.urs2sts import urs2sts
    17 
    18 class TestCase(unittest.TestCase):
     20from anuga.file.urs import Read_urs
     21
     22class Test_Mux(unittest.TestCase):
    1923    def setUp(self):
    2024        pass
     
    14871491       
    14881492        self.delete_mux(files)
    1489        
     1493 
     1494    def test_Urs_points(self):
     1495        time_step_count = 3
     1496        time_step = 2
     1497        lat_long_points =[(-21.5,114.5),(-21.5,115),(-21.,115)]
     1498        base_name, files = self.write_mux(lat_long_points,
     1499                                          time_step_count, time_step)
     1500        for file in files:
     1501            urs = Read_urs(file)
     1502            assert time_step_count == urs.time_step_count
     1503            assert time_step == urs.time_step
     1504
     1505            for lat_lon, dep in map(None, lat_long_points, urs.lonlatdep):
     1506                    _ , e, n = redfearn(lat_lon[0], lat_lon[1])
     1507                    assert num.allclose(n, dep[2])
     1508                       
     1509            count = 0
     1510            for slice in urs:
     1511                count += 1
     1512                #print slice
     1513                for lat_lon, quantity in map(None, lat_long_points, slice):
     1514                    _ , e, n = redfearn(lat_lon[0], lat_lon[1])
     1515                    #print "quantity", quantity
     1516                    #print "e", e
     1517                    #print "n", n
     1518                    if file[-5:] == WAVEHEIGHT_MUX_LABEL[-5:] or \
     1519                           file[-5:] == NORTH_VELOCITY_LABEL[-5:] :
     1520                        assert num.allclose(e, quantity)
     1521                    if file[-5:] == EAST_VELOCITY_LABEL[-5:]:
     1522                        assert num.allclose(n, quantity)
     1523            assert count == time_step_count
     1524                     
     1525        self.delete_mux(files)       
     1526
     1527
     1528
    14901529       
    14911530################################################################################
    14921531
    14931532if __name__ == "__main__":
    1494     suite = unittest.makeSuite(TestCase,'test')
     1533    suite = unittest.makeSuite(Test_Mux,'test')
    14951534    runner = unittest.TextTestRunner() #verbosity=2)
    14961535    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.