Changeset 9309
- Timestamp:
- Aug 31, 2014, 9:15:34 PM (10 years ago)
- Location:
- trunk/anuga_core
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/demos/channel3.py
r8728 r9309 20 20 domain = anuga.Domain(points, vertices, boundary) 21 21 domain.set_name('channel3') # Output name 22 domain.set_flow_algorithm('DE0') 22 23 print domain.statistics() 23 24 -
trunk/anuga_core/demos/channel3_parallel.py
r8728 r9309 9 9 import anuga 10 10 11 import anuga_parallel11 #import anuga_parallel 12 12 13 13 … … 46 46 47 47 48 if anuga _parallel.myid == 0:48 if anuga.myid == 0: 49 49 points, vertices, boundary = anuga.rectangular_cross(int(length/dx), 50 50 int(width/dy), len1=length, len2=width) 51 51 domain = anuga.Domain(points, vertices, boundary) 52 52 domain.set_name('channel3') # Output name 53 domain.set_flow_algorithm('DE0') 53 54 print domain.statistics() 54 55 … … 64 65 # Distribute domain on processor 0 to to other processors 65 66 #------------------------------------------------------------------------------ 66 parameters = dict(ghost_layer_width=3)67 domain = anuga _parallel.distribute(domain, verbose= True, parameters=parameters)67 #parameters = dict(ghost_layer_width=3) 68 domain = anuga.distribute(domain, verbose= True) 68 69 69 70 … … 81 82 #------------------------------------------------------------------------------ 82 83 for t in domain.evolve(yieldstep=0.1, finaltime=16.0): 83 if anuga _parallel.myid == 0:84 if anuga.myid == 0: 84 85 print domain.timestepping_statistics() 85 86 … … 93 94 domain.sww_merge(verbose=True) 94 95 95 anuga _parallel.finalize()96 anuga.finalize() 96 97 -
trunk/anuga_core/source/anuga/__init__.py
r9301 r9309 72 72 from anuga.utilities.file_utils import copy_code_files 73 73 from anuga.utilities.numerical_tools import safe_acos as acos 74 import anuga.utilities.plot_utils as plot_utils 74 75 75 76 -
trunk/anuga_core/source/anuga/damage_modelling/inundation_damage.py
r8831 r9309 42 42 from anuga.geospatial_data.geospatial_data import ensure_absolute 43 43 from anuga.utilities.numerical_tools import NAN 44 from anuga.config import epsilon 44 45 import anuga.utilities.log as log 45 from config import epsilon 46 46 47 depth_epsilon = epsilon 47 48 -
trunk/anuga_core/source/anuga/utilities/plot_utils.py
r9303 r9309 4 4 Functionality of note: 5 5 6 util.get_outputs -- read the data from a single sww file6 plot_utils.get_outputs -- read the data from a single sww file 7 7 into a single object 8 8 9 util.combine_outputs -- read the data from a list of sww9 plot_utils.combine_outputs -- read the data from a list of sww 10 10 files into a single object 11 11 12 util.near_transect -- for finding the indices of points12 plot_utils.near_transect -- for finding the indices of points 13 13 'near' to a given line, and 14 14 assigning these points a … … 18 18 transect (e.g. a channel cross-section) -- see example below 19 19 20 util.sort_sww_filenames -- match sww filenames by a wildcard, and order20 plot_utils.sort_sww_filenames -- match sww filenames by a wildcard, and order 21 21 them according to their 'time'. This means that 22 22 they can be stuck together using 23 23 'combine_outputs' correctly 24 24 25 util.triangle_areas -- compute the areas of every triangle25 plot_utils.triangle_areas -- compute the areas of every triangle 26 26 in a get_outputs object [ must be vertex-based] 27 27 28 util.water_volume -- compute the water volume at every28 plot_utils.water_volume -- compute the water volume at every 29 29 time step in an sww file (needs both 30 30 vertex and centroid value input). 31 31 32 util.Make_Geotiff -- convert sww centroids to a georeferenced tiff32 plot_utils.Make_Geotif -- convert sww centroids to a georeferenced tiff 33 33 34 34 Here is an example ipython session which uses some of these functions: 35 35 36 > import util36 > from anuga import plot_utils 37 37 > from matplotlib import pyplot as pyplot 38 > p= util.get_output('myfile.sww',minimum_allowed_height=0.01)39 > p2= util.get_centroids(p,velocity_extrapolation=True)40 > xxx= util.near_transect(p,[95., 85.], [120.,68.],tol=2.) # Could equally well use p238 > p=plot_utils.get_output('myfile.sww',minimum_allowed_height=0.01) 39 > p2=plot_utils.get_centroids(p,velocity_extrapolation=True) 40 > xxx=plot_utils.near_transect(p,[95., 85.], [120.,68.],tol=2.) # Could equally well use p2 41 41 > pyplot.ion() # Interactive plotting 42 42 > pyplot.scatter(xxx[1],p.vel[140,xxx[0]],color='red') # Plot along the transect … … 143 143 """Read in data from an .sww file in a convenient form 144 144 e.g. 145 p = util.get_output('channel3.sww', minimum_allowed_height=0.01)145 p = plot_utils.get_output('channel3.sww', minimum_allowed_height=0.01) 146 146 147 147 p then contains most relevant information as e.g., p.stage, p.elev, p.xmom, etc … … 153 153 self.xvel, self.yvel, self.vel, self.minimum_allowed_height,\ 154 154 self.xllcorner, self.yllcorner, self.timeSlices = \ 155 read_output(filename, minimum_allowed_height,copy.copy(timeSlices))155 _read_output(filename, minimum_allowed_height,copy.copy(timeSlices)) 156 156 self.filename = filename 157 157 self.verbose = verbose … … 197 197 ############################################################################ 198 198 199 def read_output(filename, minimum_allowed_height, timeSlices):199 def _read_output(filename, minimum_allowed_height, timeSlices): 200 200 """ 201 201 Purpose: To read the sww file, and output a number of variables as arrays that … … 314 314 Extract centroid values from the output of get_output, OR from a 315 315 filename 316 See read_output orget_centroid_values for further explanation of316 See _read_output or _get_centroid_values for further explanation of 317 317 arguments 318 318 e.g. 319 319 # Case 1 -- get vertex values first, then centroids 320 p = util.get_output('my_sww.sww', minimum_allowed_height=0.01)320 p = plot_utils.get_output('my_sww.sww', minimum_allowed_height=0.01) 321 321 pc=util.get_centroids(p, velocity_extrapolation=True) 322 322 323 323 # Case 2 -- get centroids directly 324 pc= util.get_centroids('my_sww.sww', velocity_extrapolation=True)324 pc=plot_utils.get_centroids('my_sww.sww', velocity_extrapolation=True) 325 325 326 326 NOTE: elevation is only stored once in the output, even if it was … … 337 337 self.ymom, self.height, self.elev, self.friction, self.xvel,\ 338 338 self.yvel, self.vel, self.xllcorner, self.yllcorner, self.timeSlices= \ 339 get_centroid_values(p, velocity_extrapolation,\339 _get_centroid_values(p, velocity_extrapolation,\ 340 340 timeSlices=copy.copy(timeSlices),\ 341 341 minimum_allowed_height=minimum_allowed_height,\ … … 343 343 344 344 345 def get_centroid_values(p, velocity_extrapolation, verbose, timeSlices,345 def _get_centroid_values(p, velocity_extrapolation, verbose, timeSlices, 346 346 minimum_allowed_height): 347 347 """ … … 363 363 364 364 timeSlices = list of integer indices when we want output for, or 365 'all' or 'last' or 'max'. See read_output366 367 minimum_allowed_height = height at which velocities are zeroed. See read_output365 'all' or 'last' or 'max'. See _read_output 366 367 minimum_allowed_height = height at which velocities are zeroed. See _read_output 368 368 369 369 Output: Values of x, y, Stage, xmom, ymom, elev, xvel, yvel, vel etc at centroids … … 820 820 def Make_Geotif(swwFile=None, 821 821 output_quantities=['depth'], 822 myTimeStep=0, CellSize= 5.0,822 myTimeStep=0, CellSize=100.0, 823 823 lower_left=None, upper_right=None, 824 824 EPSG_CODE=None, -
trunk/anuga_core/source/anuga/validation_utilities/__init__.py
r9164 r9309 11 11 from run_validation import run_validation_script 12 12 from produce_report import produce_report 13 from save_parameters_tex import save_parameters_tex 13 14 14 15
Note: See TracChangeset
for help on using the changeset viewer.