Changeset 6711
 Timestamp:
 Apr 3, 2009, 12:11:24 PM (16 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
r6595 r6711 3571 3571 other_quantities.remove('z') 3572 3572 other_quantities.remove('volumes') 3573 #try:3574 #other_quantities.remove('stage_range')3575 #other_quantities.remove('xmomentum_range')3576 #other_quantities.remove('ymomentum_range')3577 #other_quantities.remove('elevation_range')3578 #except:3579 #pass3573 try: 3574 other_quantities.remove('stage_range') 3575 other_quantities.remove('xmomentum_range') 3576 other_quantities.remove('ymomentum_range') 3577 other_quantities.remove('elevation_range') 3578 except: 3579 pass 3580 3580 3581 3581 conserved_quantities.remove('time') … … 5338 5338 j += 1 5339 5339 5340 #if verbose: sww.verbose_quantities(outfile)5340 if verbose: sww.verbose_quantities(outfile) 5341 5341 5342 5342 outfile.close() … … 5938 5938 ('number_of_points',)) 5939 5939 q = 'elevation' 5940 #outfile.createVariable(q + Write_sww.RANGE, sww_precision,5941 #('numbers_in_range',))5942 5943 5944 # #Initialise ranges with small and large sentinels.5945 # #If this was in pure Python we could have used None sensibly5946 #outfile.variables[q+Write_sww.RANGE][0] = max_float # Min5947 #outfile.variables[q+Write_sww.RANGE][1] = max_float # Max5940 outfile.createVariable(q + Write_sww.RANGE, sww_precision, 5941 ('numbers_in_range',)) 5942 5943 5944 # Initialise ranges with small and large sentinels. 5945 # If this was in pure Python we could have used None sensibly 5946 outfile.variables[q+Write_sww.RANGE][0] = max_float # Min 5947 outfile.variables[q+Write_sww.RANGE][1] = max_float # Max 5948 5948 5949 5949 # FIXME: Backwards compatibility … … 5960 5960 outfile.createVariable(q, sww_precision, ('number_of_timesteps', 5961 5961 'number_of_points')) 5962 #outfile.createVariable(q + Write_sww.RANGE, sww_precision,5963 #('numbers_in_range',))5962 outfile.createVariable(q + Write_sww.RANGE, sww_precision, 5963 ('numbers_in_range',)) 5964 5964 5965 5965 # Initialise ranges with small and large sentinels. 5966 5966 # If this was in pure Python we could have used None sensibly 5967 #outfile.variables[q+Write_sww.RANGE][0] = max_float # Min5968 #outfile.variables[q+Write_sww.RANGE][1] = max_float # Max5967 outfile.variables[q+Write_sww.RANGE][0] = max_float # Min 5968 outfile.variables[q+Write_sww.RANGE][1] = max_float # Max 5969 5969 5970 5970 if type(times) is list or type(times) is num.ArrayType: … … 6075 6075 q = 'elevation' 6076 6076 # This updates the _range values 6077 #outfile.variables[q + Write_sww.RANGE][0] = min(elevation)6078 #outfile.variables[q + Write_sww.RANGE][1] = max(elevation)6077 outfile.variables[q + Write_sww.RANGE][0] = min(elevation) 6078 outfile.variables[q + Write_sww.RANGE][1] = max(elevation) 6079 6079 6080 6080 … … 6128 6128 q_values.astype(sww_precision) 6129 6129 6130 ## This updates the _range values6131 #q_range = outfile.variables[q + Write_sww.RANGE][:]6132 #q_values_min = min(q_values)6133 #if q_values_min < q_range[0]:6134 #outfile.variables[q + Write_sww.RANGE][0] = q_values_min6135 #q_values_max = max(q_values)6136 #if q_values_max > q_range[1]:6137 #outfile.variables[q + Write_sww.RANGE][1] = q_values_max6130 # This updates the _range values 6131 q_range = outfile.variables[q + Write_sww.RANGE][:] 6132 q_values_min = min(q_values) 6133 if q_values_min < q_range[0]: 6134 outfile.variables[q + Write_sww.RANGE][0] = q_values_min 6135 q_values_max = max(q_values) 6136 if q_values_max > q_range[1]: 6137 outfile.variables[q + Write_sww.RANGE][1] = q_values_max 6138 6138 6139 6139 ## 6140 6140 # @brief Print the quantities in the underlying file. 6141 6141 # @param outfile UNUSED. 6142 #def verbose_quantities(self, outfile):6143 #print ''6144 #print 'More Statistics:'6145 #for q in Write_sww.sww_quantities:6146 #print ' %s in [%f, %f]' % (q,6147 #outfile.variables[q+Write_sww.RANGE][0],6148 #outfile.variables[q+Write_sww.RANGE][1])6149 #print ''6142 def verbose_quantities(self, outfile): 6143 print '' 6144 print 'More Statistics:' 6145 for q in Write_sww.sww_quantities: 6146 print ' %s in [%f, %f]' % (q, 6147 outfile.variables[q+Write_sww.RANGE][0], 6148 outfile.variables[q+Write_sww.RANGE][1]) 6149 print '' 6150 6150 6151 6151 … … 6498 6498 6499 6499 # This updates the _range values 6500 #q_range = outfile.variables[q + Write_sts.RANGE][:]6501 #q_values_min = min(q_values)6502 #if q_values_min < q_range[0]:6503 #outfile.variables[q + Write_sts.RANGE][0] = q_values_min6504 #q_values_max = max(q_values)6505 #if q_values_max > q_range[1]:6506 #outfile.variables[q + Write_sts.RANGE][1] = q_values_max6500 q_range = outfile.variables[q + Write_sts.RANGE][:] 6501 q_values_min = min(q_values) 6502 if q_values_min < q_range[0]: 6503 outfile.variables[q + Write_sts.RANGE][0] = q_values_min 6504 q_values_max = max(q_values) 6505 if q_values_max > q_range[1]: 6506 outfile.variables[q + Write_sts.RANGE][1] = q_values_max 6507 6507 6508 6508 
anuga_core/source/anuga/shallow_water/test_data_manager.py
r6595 r6711 251 251 252 252 # Get the variables 253 #range = fid.variables['stage_range'][:]253 range = fid.variables['stage_range'][:] 254 254 #print range 255 #assert num.allclose(range,[0.93519, 0.15]) or\256 #num.allclose(range,[0.9352743, 0.15]) or\257 #num.allclose(range,[0.93522203, 0.15000001]) # Old slope limiters258 259 #range = fid.variables['xmomentum_range'][:]255 assert num.allclose(range,[0.93519, 0.15]) or\ 256 num.allclose(range,[0.9352743, 0.15]) or\ 257 num.allclose(range,[0.93522203, 0.15000001]) # Old slope limiters 258 259 range = fid.variables['xmomentum_range'][:] 260 260 ##print range 261 #assert num.allclose(range,[0,0.4695096]) or \262 #num.allclose(range,[0,0.47790655]) or\263 #num.allclose(range,[0,0.46941957]) or\264 #num.allclose(range,[0,0.47769409])265 266 267 #range = fid.variables['ymomentum_range'][:]261 assert num.allclose(range,[0,0.4695096]) or \ 262 num.allclose(range,[0,0.47790655]) or\ 263 num.allclose(range,[0,0.46941957]) or\ 264 num.allclose(range,[0,0.47769409]) 265 266 267 range = fid.variables['ymomentum_range'][:] 268 268 ##print range 269 #assert num.allclose(range,[0,0.02174380]) or\270 #num.allclose(range,[0,0.02174439]) or\271 #num.allclose(range,[0,0.02283983]) or\272 #num.allclose(range,[0,0.0217342]) or\273 #num.allclose(range,[0,0.0227564]) # Old slope limiters269 assert num.allclose(range,[0,0.02174380]) or\ 270 num.allclose(range,[0,0.02174439]) or\ 271 num.allclose(range,[0,0.02283983]) or\ 272 num.allclose(range,[0,0.0217342]) or\ 273 num.allclose(range,[0,0.0227564]) # Old slope limiters 274 274 275 275 fid.close()
Note: See TracChangeset
for help on using the changeset viewer.