Changeset 3975
- Timestamp:
- Nov 13, 2006, 5:51:05 PM (18 years ago)
- 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 4182 4182 file_out, 4183 4183 quantity) 4184 #print "lonlatdep", lonlatdep 4184 4185 if hashed_elevation == None: 4185 4186 elevation_file = basename_out+'_e.nc' -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r3846 r3975 4569 4569 mux_names = ['-z-mux','-e-mux','-n-mux'] 4570 4570 quantities_init = [[],[],[]] 4571 # urs binary is latitude fastest 4571 4572 for i,lon in enumerate(longitudes): 4572 4573 for j,lat in enumerate(latitudes): … … 4657 4658 tide = 1 4658 4659 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 ) 4660 4665 sww_file = base_name + '.sww' 4661 4666 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. 4663 4669 fid = NetCDFFile(sww_file) 4664 4670 … … 4666 4672 y = fid.variables['y'][:] 4667 4673 geo_reference = Geo_reference(NetCDFObject=fid) 4674 4668 4675 4669 4676 #Check that first coordinate is correctly represented … … 4673 4680 assert allclose(geo_reference.get_absolute([[x[0],y[0]]]), [e,n]) 4674 4681 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 4675 4688 #Check first value 4676 4689 stage = fid.variables['stage'][:] 4677 4690 xmomentum = fid.variables['xmomentum'][:] 4678 4691 ymomentum = fid.variables['ymomentum'][:] 4679 4680 #print ymomentum 4692 elevation = fid.variables['elevation'][:] 4681 4693 assert allclose(stage[0,0], e +tide) #Meters 4682 4694 … … 4688 4700 answer = n*(e+tide+n) 4689 4701 actual = xmomentum[0,0] 4690 #print "answer",answer4691 #print "actual",actual4692 4702 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 4693 4715 4694 4716 fid.close() … … 4698 4720 os.remove(sww_file) 4699 4721 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)4709 4722 4710 4723 def test_lon_lat2grid(self): … … 4779 4792 if __name__ == "__main__": 4780 4793 #suite = unittest.makeSuite(Test_Data_Manager,'test_lon') 4781 #suite = unittest.makeSuite(Test_Data_Manager,'t rial')4794 #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sww') 4782 4795 suite = unittest.makeSuite(Test_Data_Manager,'test') 4783 4796 runner = unittest.TextTestRunner()
Note: See TracChangeset
for help on using the changeset viewer.