# Changeset 2622

Ignore:
Timestamp:
Mar 28, 2006, 2:36:03 PM (18 years ago)
Message:

Updated merimbula viewer

Files:
8 edited

Unmodified
Removed
• ## inundation/pyvolution/view_tsh.py

 r1363 from shallow_water import Domain from pmesh2domain import pmesh_to_domain_instance from util import file_function, Polygon_function, read_polygon from pyvolution.util import file_function from utilities.polygon import Polygon_function, read_polygon from Numeric import zeros, Float, maximum, minimum from realtime_visualisation_new import *
• ## inundation/utilities/polygon.py

 r2531 print 'Could not find scipy - using Numeric' from Numeric import Float, Int, zeros, ones, array, concatenate, reshape, dot from math import sqrt def inside_polygon(points, polygon, closed = True, verbose = False): """Determine points inside a polygon Functions inside_polygon and outside_polygon have been defined in terms af separate_by_polygon which will put all inside indices in terms af separate_by_polygon which will put all inside indices in the first part of the indices array and outside indices in the last See separate_points_by_polygon for documentation See separate_points_by_polygon for documentation """ if verbose: print 'Checking input to inside_polygon' try: points = ensure_numeric(points, Float) polygon = ensure_numeric(polygon, Float) except NameError, e: raise NameError, e raise NameError, e except: msg = 'Polygon %s could not be converted to Numeric array' %(str(polygon)) def outside_polygon(points, polygon, closed = True, verbose = False): """Determine points outside a polygon Functions inside_polygon and outside_polygon have been defined in terms af separate_by_polygon which will put all inside indices in terms af separate_by_polygon which will put all inside indices in the first part of the indices array and outside indices in the last See separate_points_by_polygon for documentation See separate_points_by_polygon for documentation """ points = ensure_numeric(points, Float) except NameError, e: raise NameError, e raise NameError, e except: msg = 'Points could not be converted to Numeric array' polygon = ensure_numeric(polygon, Float) except NameError, e: raise NameError, e raise NameError, e except: msg = 'Polygon could not be converted to Numeric array' # No points are outside return [] else: else: return indices[count:][::-1]  #return reversed #Input checks try: points = ensure_numeric(points, Float) except NameError, e: raise NameError, e raise NameError, e except: msg = 'Points could not be converted to Numeric array' polygon = ensure_numeric(polygon, Float) except NameError, e: raise NameError, e raise NameError, e except: msg = 'Polygon could not be converted to Numeric array' if verbose: print 'Checking input to separate_points_by_polygon' #Input checks assert isinstance(closed, bool), 'Keyword argument "closed" must be boolean' assert isinstance(verbose, bool), 'Keyword argument "verbose" must be boolean' assert isinstance(verbose, bool), 'Keyword argument "verbose" must be boolean' try: points = ensure_numeric(points, Float) except NameError, e: raise NameError, e raise NameError, e except: msg = 'Points could not be converted to Numeric array' polygon = ensure_numeric(polygon, Float) except NameError, e: raise NameError, e raise NameError, e except: msg = 'Polygon could not be converted to Numeric array' #Make points in polygons relative to geo_reference self.regions = [] self.regions = [] for polygon, value in regions: P = geo_reference.change_points_geo_ref(polygon) P = geo_reference.change_points_geo_ref(polygon) self.regions.append( (P, value) ) return z def read_polygon(filename): def read_polygon(filename,split=','): """Read points assumed to form a polygon. There must be exactly two numbers in each line separated by a comma. polygon = [] for line in lines: fields = line.split(',') fields = line.split(split) polygon.append( [float(fields[0]), float(fields[1])] ) number_of_points - (optional) number of points seed - seed for random number generator (default=None) exclude - list of polygons (inside main polygon) from where points should be excluded exclude - list of polygons (inside main polygon) from where points should be excluded Output: append = True #Check exclusions if exclude is not None: if inside_polygon( [x,y], ex_poly ): append = False if append is True: points.append([x,y]) if append is True: points.append([x,y]) return points else: x_delta = x+x_mult*x*delta if y == 0: y_delta = y_mult*delta else: y_delta = y+y_mult*y*delta point = [x_delta, y_delta] #print "point",point if inside_polygon( point, polygon, closed = False ): raise Found except Found: except Found: point_in = True else: delta = delta*0.1 delta = delta*0.1 return point
• ## inundation/zeus/Merimbula.zpi

 r2255 OffOff..\merimbula\prepare.py..\merimbula\project.py..\merimbula\run_cairns.py..\merimbula\run_least_squares_merimbula.py..\merimbula\run_merimbula_lake.py..\merimbula\run_merimbula_lake_checkpoint.py..\merimbula\run_new_meribula.py..\merimbula\view_sww.py..\..\production\merimbula_2005\prepare.py..\..\production\merimbula_2005\project.py..\..\production\merimbula_2005\run_merimbula_lake.py..\..\production\merimbula_2005\run_merimbula_lake_weed.py..\..\production\merimbula_2005\run_new_meribula.py..\..\production\merimbula_2005\run_new_meribula_weed.py
• ## inundation/zeus/anuga-workspace.zwi

 r2386 Debug pyvolution Merimbula analytic_solutions.zpi euler.zpi