Changeset 9309


Ignore:
Timestamp:
Aug 31, 2014, 9:15:34 PM (10 years ago)
Author:
steve
Message:

small changes plot_utils

Location:
trunk/anuga_core
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/demos/channel3.py

    r8728 r9309  
    2020domain = anuga.Domain(points, vertices, boundary)
    2121domain.set_name('channel3')                  # Output name
     22domain.set_flow_algorithm('DE0')
    2223print domain.statistics()
    2324
  • trunk/anuga_core/demos/channel3_parallel.py

    r8728 r9309  
    99import anuga
    1010
    11 import anuga_parallel
     11#import anuga_parallel
    1212
    1313
     
    4646
    4747
    48 if anuga_parallel.myid == 0:
     48if anuga.myid == 0:
    4949    points, vertices, boundary = anuga.rectangular_cross(int(length/dx),
    5050                                         int(width/dy), len1=length, len2=width)
    5151    domain = anuga.Domain(points, vertices, boundary)
    5252    domain.set_name('channel3')                  # Output name
     53    domain.set_flow_algorithm('DE0')
    5354    print domain.statistics()
    5455
     
    6465# Distribute domain on processor 0 to to other processors
    6566#------------------------------------------------------------------------------
    66 parameters = dict(ghost_layer_width=3)
    67 domain = anuga_parallel.distribute(domain, verbose= True, parameters=parameters)
     67#parameters = dict(ghost_layer_width=3)
     68domain = anuga.distribute(domain, verbose= True)
    6869
    6970
     
    8182#------------------------------------------------------------------------------
    8283for t in domain.evolve(yieldstep=0.1, finaltime=16.0):
    83     if anuga_parallel.myid == 0:
     84    if anuga.myid == 0:
    8485        print domain.timestepping_statistics()
    8586
     
    9394domain.sww_merge(verbose=True)
    9495
    95 anuga_parallel.finalize()
     96anuga.finalize()
    9697       
  • trunk/anuga_core/source/anuga/__init__.py

    r9301 r9309  
    7272from anuga.utilities.file_utils import copy_code_files
    7373from anuga.utilities.numerical_tools import safe_acos as acos
     74import anuga.utilities.plot_utils as plot_utils
    7475
    7576
  • trunk/anuga_core/source/anuga/damage_modelling/inundation_damage.py

    r8831 r9309  
    4242from anuga.geospatial_data.geospatial_data import ensure_absolute
    4343from anuga.utilities.numerical_tools import NAN
     44from anuga.config import epsilon
    4445import anuga.utilities.log as log
    45 from config import epsilon
     46
    4647depth_epsilon = epsilon
    4748
  • trunk/anuga_core/source/anuga/utilities/plot_utils.py

    r9303 r9309  
    44    Functionality of note:
    55
    6     util.get_outputs -- read the data from a single sww file
     6    plot_utils.get_outputs -- read the data from a single sww file
    77    into a single object
    88   
    9     util.combine_outputs -- read the data from a list of sww
     9    plot_utils.combine_outputs -- read the data from a list of sww
    1010    files into a single object
    1111   
    12     util.near_transect -- for finding the indices of points
     12    plot_utils.near_transect -- for finding the indices of points
    1313                          'near' to a given line, and
    1414                          assigning these points a
     
    1818    transect (e.g. a channel cross-section) -- see example below
    1919
    20     util.sort_sww_filenames -- match sww filenames by a wildcard, and order
     20    plot_utils.sort_sww_filenames -- match sww filenames by a wildcard, and order
    2121                               them according to their 'time'. This means that
    2222                               they can be stuck together using
    2323                               'combine_outputs' correctly
    2424
    25     util.triangle_areas -- compute the areas of every triangle
     25    plot_utils.triangle_areas -- compute the areas of every triangle
    2626                           in a get_outputs object [ must be vertex-based]
    2727
    28     util.water_volume -- compute the water volume at every
     28    plot_utils.water_volume -- compute the water volume at every
    2929                         time step in an sww file (needs both
    3030                         vertex and centroid value input).
    3131
    32     util.Make_Geotiff -- convert sww centroids to a georeferenced tiff
     32    plot_utils.Make_Geotif -- convert sww centroids to a georeferenced tiff
    3333 
    3434    Here is an example ipython session which uses some of these functions:
    3535
    36     > import util
     36    > from anuga import plot_utils
    3737    > 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 p2
     38    > 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
    4141    > pyplot.ion() # Interactive plotting
    4242    > pyplot.scatter(xxx[1],p.vel[140,xxx[0]],color='red') # Plot along the transect
     
    143143    """Read in data from an .sww file in a convenient form
    144144       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)
    146146       
    147147       p then contains most relevant information as e.g., p.stage, p.elev, p.xmom, etc
     
    153153                self.xvel, self.yvel, self.vel, self.minimum_allowed_height,\
    154154                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))
    156156        self.filename = filename
    157157        self.verbose = verbose
     
    197197############################################################################
    198198
    199 def read_output(filename, minimum_allowed_height, timeSlices):
     199def _read_output(filename, minimum_allowed_height, timeSlices):
    200200    """
    201201     Purpose: To read the sww file, and output a number of variables as arrays that
     
    314314    Extract centroid values from the output of get_output, OR from a
    315315        filename 
    316     See read_output or get_centroid_values for further explanation of
     316    See _read_output or _get_centroid_values for further explanation of
    317317        arguments
    318318    e.g.
    319319        # 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)
    321321        pc=util.get_centroids(p, velocity_extrapolation=True)
    322322
    323323        # 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)
    325325
    326326    NOTE: elevation is only stored once in the output, even if it was
     
    337337             self.ymom, self.height, self.elev, self.friction, self.xvel,\
    338338             self.yvel, self.vel, self.xllcorner, self.yllcorner, self.timeSlices= \
    339              get_centroid_values(p, velocity_extrapolation,\
     339             _get_centroid_values(p, velocity_extrapolation,\
    340340                         timeSlices=copy.copy(timeSlices),\
    341341                         minimum_allowed_height=minimum_allowed_height,\
     
    343343                                 
    344344
    345 def get_centroid_values(p, velocity_extrapolation, verbose, timeSlices,
     345def _get_centroid_values(p, velocity_extrapolation, verbose, timeSlices,
    346346                        minimum_allowed_height):
    347347    """
     
    363363   
    364364           timeSlices = list of integer indices when we want output for, or
    365                         'all' or 'last' or 'max'. See read_output
    366    
    367            minimum_allowed_height = height at which velocities are zeroed. See read_output
     365                        'all' or 'last' or 'max'. See _read_output
     366   
     367           minimum_allowed_height = height at which velocities are zeroed. See _read_output
    368368   
    369369     Output: Values of x, y, Stage, xmom, ymom, elev, xvel, yvel, vel etc at centroids
     
    820820def Make_Geotif(swwFile=None,
    821821             output_quantities=['depth'],
    822              myTimeStep=0, CellSize=5.0,
     822             myTimeStep=0, CellSize=100.0,
    823823             lower_left=None, upper_right=None,
    824824             EPSG_CODE=None,
  • trunk/anuga_core/source/anuga/validation_utilities/__init__.py

    r9164 r9309  
    1111from run_validation import run_validation_script
    1212from produce_report import produce_report
     13from save_parameters_tex import save_parameters_tex
    1314
    1415
Note: See TracChangeset for help on using the changeset viewer.