Changeset 3975


Ignore:
Timestamp:
Nov 13, 2006, 5:51:05 PM (18 years ago)
Author:
duncan
Message:

extend tests of urs2sww.

Location:
anuga_core/source/anuga/shallow_water
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r3974 r3975  
    41824182                                         file_out,
    41834183                                         quantity)
     4184        #print "lonlatdep", lonlatdep
    41844185        if hashed_elevation == None:
    41854186            elevation_file = basename_out+'_e.nc'
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r3846 r3975  
    45694569        mux_names = ['-z-mux','-e-mux','-n-mux']
    45704570        quantities_init = [[],[],[]]
     4571        # urs binary is latitude fastest
    45714572        for i,lon in enumerate(longitudes):
    45724573            for j,lat in enumerate(latitudes):
     
    46574658        tide = 1
    46584659        base_name, files = self.create_mux()
    4659         urs2sww(base_name, mean_stage=tide)
     4660        urs2sww(base_name
     4661                #, origin=(0,0,0)
     4662                , mean_stage=tide
     4663                , remove_nc_files=False
     4664                )
    46604665        sww_file = base_name + '.sww'
    46614666       
    4662         #Let's interigate the sww file
     4667        #Let's interigate the sww file
     4668        # Note, the sww info is not gridded.  It is point data.
    46634669        fid = NetCDFFile(sww_file)
    46644670
     
    46664672        y = fid.variables['y'][:]
    46674673        geo_reference = Geo_reference(NetCDFObject=fid)
     4674
    46684675       
    46694676        #Check that first coordinate is correctly represented       
     
    46734680        assert allclose(geo_reference.get_absolute([[x[0],y[0]]]), [e,n])
    46744681
     4682        # Make x and y absolute
     4683        points = geo_reference.get_absolute(map(None, x, y))
     4684        points = ensure_numeric(points)
     4685        x = points[:,0]
     4686        y = points[:,1]
     4687       
    46754688        #Check first value
    46764689        stage = fid.variables['stage'][:]
    46774690        xmomentum = fid.variables['xmomentum'][:]
    46784691        ymomentum = fid.variables['ymomentum'][:]
    4679 
    4680         #print ymomentum
     4692        elevation = fid.variables['elevation'][:]
    46814693        assert allclose(stage[0,0], e +tide)  #Meters
    46824694
     
    46884700        answer = n*(e+tide+n)
    46894701        actual = xmomentum[0,0]
    4690         #print "answer",answer
    4691         #print "actual",actual
    46924702        assert allclose(answer, actual)  #Meters
     4703
     4704        # check the stage values, first time step.
     4705        # These arrays are equal since the Easting values were used as
     4706        # the stage
     4707        assert allclose(stage[0], x +tide)  #Meters
     4708
     4709        # check the elevation values.
     4710        # -ve since urs measures depth, sww meshers height,
     4711        # these arrays are equal since the northing values were used as
     4712        # the elevation
     4713        assert allclose(-elevation, y)  #Meters
     4714
    46934715       
    46944716        fid.close()
     
    46984720        os.remove(sww_file)
    46994721       
    4700     def bad_test_assuming_theres_a_mux_file(self):
    4701         # these mux files aren't in the repository, plus they are bad!
    4702         base_name = 'o-z-mux'
    4703         base_name = 'o-e-mux'
    4704         file_name = base_name + '.nc'
    4705         lonlatdep_numeric, lon, lat, depth = \
    4706                            _binary_c2nc(base_name, file_name, 'HA')
    4707        
    4708         #os.remove(file_name)
    47094722       
    47104723    def test_lon_lat2grid(self):
     
    47794792if __name__ == "__main__":
    47804793    #suite = unittest.makeSuite(Test_Data_Manager,'test_lon')
    4781     #suite = unittest.makeSuite(Test_Data_Manager,'trial')
     4794    #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sww')
    47824795    suite = unittest.makeSuite(Test_Data_Manager,'test')
    47834796    runner = unittest.TextTestRunner()
Note: See TracChangeset for help on using the changeset viewer.