- Timestamp:
- Jan 6, 2010, 9:23:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/test_data_manager.py
r7520 r7602 182 182 sww.store_connectivity() 183 183 184 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append184 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append 185 185 186 186 # Get the variables … … 214 214 sww.store_connectivity() 215 215 216 # Check contents217 # Get NetCDF218 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append216 # Check contents 217 # Get NetCDF 218 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append 219 219 220 220 # Get the variables … … 383 383 sww.store_connectivity() 384 384 385 # Check contents386 # Get NetCDF387 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append385 # Check contents 386 # Get NetCDF 387 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append 388 388 389 389 # Get the variables … … 424 424 sww.store_timestep() 425 425 426 # Check contents427 # Get NetCDF428 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append426 # Check contents 427 # Get NetCDF 428 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append 429 429 430 430 … … 475 475 476 476 477 # Check contents478 # Get NetCDF479 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append477 # Check contents 478 # Get NetCDF 479 fid = NetCDFFile(sww.filename, netcdf_mode_r) # Open existing file for append 480 480 481 481 # Get the variables … … 2371 2371 2372 2372 2373 # Export to ascii/prj files2373 # Export to ascii/prj files 2374 2374 sww2dem(domain.get_name(), 2375 2375 quantity = 'elevation', … … 2386 2386 2387 2387 2388 # Check prj (meta data)2388 # Check prj (meta data) 2389 2389 prjid = open(prjfile) 2390 2390 lines = prjid.readlines() … … 4220 4220 (228+229+230+246+247+248+264+265+266) / 9.0] 4221 4221 4222 # generate a stencil for computing the decimated values4222 # generate a stencil for computing the decimated values 4223 4223 stencil = num.ones((3,3), num.float) / 9.0 4224 4224 4225 4225 decimate_dem(root, stencil=stencil, cellsize_new=100) 4226 4226 4227 # Open decimated NetCDF file4227 # Open decimated NetCDF file 4228 4228 fid = NetCDFFile(root + '_100.dem', netcdf_mode_r) 4229 4229 … … 4231 4231 elevation = fid.variables['elevation'] 4232 4232 4233 # Check values4233 # Check values 4234 4234 assert num.allclose(elevation, ref_elevation) 4235 4235 4236 # Cleanup4236 # Cleanup 4237 4237 fid.close() 4238 4238 … … 4247 4247 from Scientific.IO.NetCDF import NetCDFFile 4248 4248 4249 # Write test dem file4249 # Write test dem file 4250 4250 root = 'decdemtest' 4251 4251 … … 4281 4281 elevation = fid.variables['elevation'] 4282 4282 4283 # generate initial elevation values4283 # Generate initial elevation values 4284 4284 elevation_tmp = (num.arange(nrows*ncols)) 4285 #add some NODATA values 4285 4286 # Add some NODATA values 4286 4287 elevation_tmp[0] = NODATA_value 4287 4288 elevation_tmp[95] = NODATA_value … … 4296 4297 fid.close() 4297 4298 4298 # generate the elevation values expected in the decimated file4299 # Generate the elevation values expected in the decimated file 4299 4300 ref_elevation = [NODATA_value, 4300 4301 ( 4+ 5+ 6+ 22+ 23+ 24+ 40+ 41+ 42) / 9.0, … … 4314 4315 (228+229+230+246+247+248+264+265+266) / 9.0] 4315 4316 4316 # generate a stencil for computing the decimated values4317 # Generate a stencil for computing the decimated values 4317 4318 stencil = num.ones((3,3), num.float) / 9.0 4318 4319 4319 4320 decimate_dem(root, stencil=stencil, cellsize_new=100) 4320 4321 4321 # Open decimated NetCDF file4322 # Open decimated NetCDF file 4322 4323 fid = NetCDFFile(root + '_100.dem', netcdf_mode_r) 4323 4324 … … 4325 4326 elevation = fid.variables['elevation'] 4326 4327 4327 # Check values4328 # Check values 4328 4329 assert num.allclose(elevation, ref_elevation) 4329 4330 4330 # Cleanup4331 # Cleanup 4331 4332 fid.close() 4332 4333 … … 4501 4502 # check the sww file 4502 4503 4503 fid = NetCDFFile(sww_file, netcdf_mode_r) # Open existing file for read4504 fid = NetCDFFile(sww_file, netcdf_mode_r) # Open existing file for read 4504 4505 x = fid.variables['x'][:] 4505 4506 y = fid.variables['y'][:] 4506 z = fid.variables[' z'][:]4507 z = fid.variables['elevation'][:] 4507 4508 stage = fid.variables['stage'][:] 4508 4509 xmomentum = fid.variables['xmomentum'][:] … … 4811 4812 # check the sww file 4812 4813 4813 fid = NetCDFFile(sww_file, netcdf_mode_r) # Open existing file for read4814 fid = NetCDFFile(sww_file, netcdf_mode_r) # Open existing file for read 4814 4815 x = fid.variables['x'][:] 4815 4816 y = fid.variables['y'][:] 4816 z = fid.variables[' z'][:]4817 z = fid.variables['elevation'][:] 4817 4818 stage = fid.variables['stage'][:] 4818 4819 xmomentum = fid.variables['xmomentum'][:] … … 5005 5006 # check the sww file 5006 5007 5007 fid = NetCDFFile(sww_file, netcdf_mode_r) # Open existing file for read5008 fid = NetCDFFile(sww_file, netcdf_mode_r) # Open existing file for read 5008 5009 x = fid.variables['x'][:] 5009 5010 y = fid.variables['y'][:] 5010 z = fid.variables[' z'][:]5011 z = fid.variables['elevation'][:] 5011 5012 stage = fid.variables['stage'][:] 5012 5013 xmomentum = fid.variables['xmomentum'][:] … … 7757 7758 7758 7759 # read in sts file for combined source 7759 fid = NetCDFFile(sts_name_out+'.sts', netcdf_mode_r) # Open existing file for read7760 x = fid.variables['x'][:]+fid.xllcorner # x-coordinates of vertices7761 y = fid.variables['y'][:]+fid.yllcorner # y-coordinates of vertices7760 fid = NetCDFFile(sts_name_out+'.sts', netcdf_mode_r) # Open existing file for read 7761 x = fid.variables['x'][:]+fid.xllcorner # x-coordinates of vertices 7762 y = fid.variables['y'][:]+fid.yllcorner # y-coordinates of vertices 7762 7763 elevation = fid.variables['elevation'][:] 7763 7764 time=fid.variables['time'][:]+fid.starttime … … 7771 7772 assert num.allclose(stored_permutation, permutation), msg 7772 7773 7773 # get quantity data from sts file7774 # Get quantity data from sts file 7774 7775 quantity_names=['stage','xmomentum','ymomentum'] 7775 7776 quantities = {}
Note: See TracChangeset
for help on using the changeset viewer.