Index: /anuga_work/development/MISG_2008/sensitivity_study.py
===================================================================
--- /anuga_work/development/MISG_2008/sensitivity_study.py	(revision 5065)
+++ /anuga_work/development/MISG_2008/sensitivity_study.py	(revision 5066)
@@ -3,4 +3,6 @@
 Water driven up a linear slope and time varying boundary,
 similar to a beach environment
+
+Test case for MISG 2008, University of Wollongong
 """
 
@@ -16,4 +18,7 @@
 from anuga.shallow_water import Time_boundary
 from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
 
 from Numeric import zeros, Float
@@ -25,14 +30,28 @@
 # Setup computational domain
 #------------------------------------------------------------------------------
-
-points, vertices, boundary = rectangular_cross(90, 30,
-                                               len1=3.0,
-                                               len2=1.0) # Basic mesh
-
-domain = Domain(points, vertices, boundary) # Create domain
+y_extent=2000.0
+bounding_polygon = [[0,0],[2000,0],[2000,2000],[0,2000]]
+beach_polygon = [[5,900],[225,900],[225,1100],[5,1100]]
+interior_regions = [[beach_polygon, 50]]
+create_mesh_from_regions(bounding_polygon,
+                         boundary_tags={'bottom':[0],
+                                        'right':[1],
+                                        'top':[2],
+                                        'left':[3]},
+                         maximum_triangle_area=2000,
+                         interior_regions= interior_regions,
+                         filename='misg.msh',
+                         use_cache=False,
+                         verbose=True)
+domain = Domain('misg.msh',use_cache=False, verbose=True)
+
+
 domain.set_name('sensitivity')              # Output to file runup.sww
 domain.set_datadir('.')                     # Use current directory for output
 domain.tight_slope_limiters = 1
 domain.beta_h = 0
+domain.set_minimum_storable_height(0.01)
+
+print 'number of elements: ', len(domain)
 
 #------------------------------------------------------------------------------
@@ -44,19 +63,17 @@
     N = len(x)
     z = zeros(N, Float)
-
-
+    
     for i in range(N):
-        # linear bed slope            
-        z[i] = -x[i]/15
-
-        # IID noise
-        z[i] += normal(0.0, 0.01)
+        if x[i] <= (depth-c)/m:
+            z[i] = m*x[i]+c
+        else:
+        # linear bed slope           
+            #z[i] = slope*x[i] + depth-(slope)*(depth-c)/m
+            z[i] = slope*x[i] + depth-(slope)*(depth-c)/m + 1.0*sin((x[i]-(depth-c)/m)/T) + 1.0*sin((y[i]-(depth-c)/m)/T)
+
+            # IID noise
+            #z[i] += normal(-100.0, 5.0)
         
     return z
-
-domain.set_quantity('elevation', topography) # Use function for elevation
-domain.set_quantity('friction', 0.01)        # Constant friction 
-domain.set_quantity('stage', -.4)            # Constant negative initial stage
-
 
 #------------------------------------------------------------------------------
@@ -69,19 +86,124 @@
 Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values
 Bw = Time_boundary(domain=domain,     # Time dependent boundary  
-                   f=lambda t: [(.1*sin(t*2*pi)-0.1) , 0.0, 0.0])
-
-# Associate boundary tags with boundary objects
-domain.set_boundary({'left': Br, 'right': Bw, 'top': Br, 'bottom': Br})
-
-
-import time
-t0 = time.time()
-#------------------------------------------------------------------------------
-# Evolve system through time
-#------------------------------------------------------------------------------
-
-for t in domain.evolve(yieldstep = 0.1, finaltime = 50.0):
-    domain.write_time()
-
-print 'That took %.2f seconds' %(time.time()-t0)
-
+                   f=lambda t: [0.0, 0.0, 0.0])
+
+from Numeric import zeros, Float, arange
+start=-1.0/40.0
+finish=-1.8/40.0
+n_vec=arange(start,finish,-2.0/400.0)
+N=len(n_vec)
+#N=1 # use for 2.5% and 5% change tests
+max0=zeros(N, Float)
+max1=zeros(N, Float)
+max2=zeros(N, Float)
+max3=zeros(N, Float)
+mmax0=zeros(N, Float)
+mmax1=zeros(N, Float)
+mmax2=zeros(N, Float)
+mmax3=zeros(N, Float)
+output_file ='misg_influence_data.csv'
+domain.store=True
+fid_out = open(output_file, 'w')
+s = 'variable, h0, h1, h2, h3, v0, v1, v2, v3\n'
+fid_out.write(s)
+
+for i in range(N):
+    manning = 0.01*1.0
+    A=1.0*1.0
+    w=1.0/100.0
+    m=-1.0/20.0
+    depth=-10.0
+    c=10.0
+    T=100.0*1.0
+    #slope=-1.0/40.0*1.0
+    slope = n_vec[i]
+
+    var = slope
+    domain.set_quantity('elevation', topography) # Use function for elevation
+    domain.set_quantity('friction', manning)
+    domain.set_quantity('stage', 0.0)            # Constant negative initial stage
+    domain.set_quantity('xmomentum', 0.0) # Use function for elevation
+    domain.set_quantity('ymomentum', 0.0) # Use function for elevation
+    swwname = 'sensitivity_2d_wavey_bottom'#+str(i)
+    domain.set_name(swwname)
+    Btd = Transmissive_Momentum_Set_Stage_boundary(domain=domain,
+                                                   function=lambda t: [(0<t<pi/w)*A*sin(w*t), 0.0, 0.0])
+    domain.set_boundary({'left': Br, 'right': Btd, 'top': Br, 'bottom': Br})
+
+    # locations to record wave height and velocity
+    tri_id0 = domain.get_triangle_containing_point([-c/m,y_extent*0.5])
+    tri_id1 = domain.get_triangle_containing_point([-c/m-10,y_extent*0.5])
+    tri_id2 = domain.get_triangle_containing_point([-c/m-20,y_extent*0.5])
+    tri_id3 = domain.get_triangle_containing_point([-c/m+50,y_extent*0.5])
+      
+    stage_centroid     = domain.quantities['stage'].centroid_values
+    xmom_centroid      = domain.quantities['xmomentum'].centroid_values
+    elevation_centroid = domain.quantities['elevation'].centroid_values
+    
+    elev0 = elevation_centroid[tri_id0]
+    elev1 = elevation_centroid[tri_id1]
+    elev2 = elevation_centroid[tri_id2]
+    elev3 = elevation_centroid[tri_id3]
+
+    import time
+    t0 = time.time()
+    #------------------------------------------------------------------------------
+    # Evolve system through time
+    #------------------------------------------------------------------------------
+    domain.time=0.0
+    finaltime=4.0 #pi/w+150.0
+    max=0
+    for t in domain.evolve(yieldstep = 1.0, finaltime = finaltime):
+
+        if  stage_centroid[tri_id0]-elev0>max0[i]: 
+            max0[i]=stage_centroid[tri_id0]-elev0
+        if  stage_centroid[tri_id1]-elev1>max1[i]:
+            max1[i]=stage_centroid[tri_id1]-elev1
+        if  stage_centroid[tri_id2]-elev2>max2[i]:
+            max2[i]=stage_centroid[tri_id2]-elev2
+        if  stage_centroid[tri_id3]-elev3>max3[i]:
+            max3[i]=stage_centroid[tri_id3]-elev3
+            
+        if  abs(xmom_centroid[tri_id0])>mmax0[i]: 
+            mmax0[i]=abs(xmom_centroid[tri_id0])
+        if  abs(xmom_centroid[tri_id1])>mmax1[i]:
+            mmax1[i]=abs(xmom_centroid[tri_id1])
+        if  abs(xmom_centroid[tri_id2])>mmax2[i]:
+            mmax2[i]=abs(xmom_centroid[tri_id2])
+        if  abs(xmom_centroid[tri_id3])>mmax3[i]:
+            mmax3[i]=abs(xmom_centroid[tri_id3])
+
+    print 'finished cycle: ', i
+    print 'That took %.2f seconds' %(time.time()-t0)
+
+
+    s = '%.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f\n' %(var, max0[i], max1[i], max2[i], max3[i], mmax0[i], mmax1[i], mmax2[i], mmax3[i])
+    fid_out.write(s)    
+
+from pylab import plot, ion, savefig, xlabel, ylabel, title, close, legend,hist,subplot
+ion()
+plot(n_vec,max2,'bo-',n_vec,max1,'go-',n_vec,max0,'ro-',n_vec,max3,'co-')
+title('MISG testing: varying slope')
+xlabel('slope')
+ylabel('depth (m)')
+#legend(['loc2','loc1','loc0','loc3'])
+name='bed_slope'
+savefig(name)
+'''
+#title('MISG testing: varying slope PDF')
+subplot(2,2,1)
+[h0,bins,patches]=hist(max0,10)
+subplot(2,2,2)
+[h1,bins,pa3ches]=hist(max1,10)
+subplot(2,2,3)
+[h2,bins,patches]=hist(max2,10)
+subplot(2,2,4)
+[h3,bins,patches]=hist(max3,10)
+#plot(bins,h0,'bo-',bins,h1,'ro-',bins,h2,'go-',bins,h3,'co-')
+xlabel('Runup')
+ylabel('Frequency')
+name='bed_slope_PDF'
+savefig(name)
+'''
+
+close('all')
Index: /anuga_work/development/continental_margin_0708/con_900.py
===================================================================
--- /anuga_work/development/continental_margin_0708/con_900.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/con_900.py	(revision 5066)
@@ -0,0 +1,186 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'con_wave_900'
+shelf = [300000]
+slope = [50000, 150000]
+wave = [0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+##            output_dir = 'C:'+sep+'anuga_data'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'wave_type_tester'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=5000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            def waveform(t):
+                  return wave[l]*1.258*sin(2*pi*t/900)*exp(-t/(900))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/curved_down_slope.py
===================================================================
--- /anuga_work/development/continental_margin_0708/curved_down_slope.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/curved_down_slope.py	(revision 5066)
@@ -0,0 +1,193 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'curved_down_slope'
+shelf = [500000]
+slope = [250000]
+wave = [-0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 800.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/curved_down_slope_large.py
===================================================================
--- /anuga_work/development/continental_margin_0708/curved_down_slope_large.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/curved_down_slope_large.py	(revision 5066)
@@ -0,0 +1,193 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'curved_down_slope_2'
+shelf = [300000]
+slope = [250000]
+wave = [0.5, -0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -2000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500): 
+                domain.write_time()
+                
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500,
+                                    skip_initial_step = True):
+                domain.write_time()
+                
+            for t in domain.evolve(yieldstep = 120, finaltime = -10000+(length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500, 
+                                   skip_initial_step = True):
+                domain.write_time() 
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/curved_linear.py
===================================================================
--- /anuga_work/development/continental_margin_0708/curved_linear.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/curved_linear.py	(revision 5066)
@@ -0,0 +1,190 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'Curved_Linear'
+shelf = [20000, 300000]
+slope = [50000, 150000]
+wave = [0.5, -0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 800.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'T_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                z = (-5000/slope[k])*x-135+((5000/slope[k])*(shelf[i]))
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+                        
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                        z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/curved_up_slope.py
===================================================================
--- /anuga_work/development/continental_margin_0708/curved_up_slope.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/curved_up_slope.py	(revision 5066)
@@ -0,0 +1,189 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'curved_up_slope'
+shelf = [500000]
+slope = [250000]
+wave = [-0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 800.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+            #output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) #Order of spatial approximation
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len(x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = 125/(shelf[i]*shelf[i])*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 302000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/continental_margin_0708/curved_up_slope_large.py
===================================================================
--- /anuga_work/development/continental_margin_0708/curved_up_slope_large.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/curved_up_slope_large.py	(revision 5066)
@@ -0,0 +1,194 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'curved_up_slope_2'
+shelf = [300000]
+slope = [250000]
+wave = [0.5, -0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+            #output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) #Order of spatial approximation
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len(x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = 125/(shelf[i]*shelf[i])*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+   
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -2000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500): 
+                domain.write_time()
+                
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500,
+                                    skip_initial_step = True):
+                domain.write_time()
+                
+            for t in domain.evolve(yieldstep = 120, finaltime = -10000+(length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500, 
+                                   skip_initial_step = True):
+                domain.write_time() 
+
+
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/continental_margin_0708/export_results.py
===================================================================
--- /anuga_work/development/continental_margin_0708/export_results.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/export_results.py	(revision 5066)
@@ -0,0 +1,74 @@
+
+from anuga.shallow_water.data_manager import sww2dem
+from os import sep
+wave = [-0.5]
+B = len(wave)
+for l in range(B):
+    name = 'curved_down_slope_2'
+ 
+    
+    time_dir = str(name)+'_'+str(wave[l])+'_300000_150000'
+    cellsize = 50
+    timestep = None
+    output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep
+    directory = output_dir
+    name = directory+time_dir+sep+str(name)
+    is_parallel = False
+    if is_parallel == True: nodes = 4
+    print 'output dir:', name
+
+    #var = [0,2,3] # stage, depth and speed
+    var = [0]
+
+    for which_var in var:
+        if which_var == 0:  # Stage
+            outname = name + '_stage'
+            quantityname = 'stage'
+
+        if which_var == 1:  # Absolute Momentum
+            outname = name + '_momentum_i1'
+            quantityname = '(xmomentum**2 + ymomentum**2)**0.5'  
+
+        if which_var == 2:  # Depth
+            outname = name + '_depth'
+            quantityname = 'stage-elevation'  
+
+        if which_var == 3:  # Speed
+            outname = name + '_speed'
+            quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
+
+        if which_var == 4:  # Elevation
+            outname = name + '_elevation'
+            quantityname = 'elevation'  #Elevation
+
+        if is_parallel == True:
+        #    print 'is_parallel',is_parallel
+            for i in range(0,nodes):
+                namei = name + '_P%d_%d' %(i,nodes)
+                outnamei = outname + '_P%d_%d' %(i,nodes)
+                print 'start sww2dem for sww file %d' %(i)
+                sww2dem(namei, basename_out = outnamei,
+                            quantity = quantityname,
+                            timestep = timestep,
+                            cellsize = cellsize,      
+                            easting_min = 0,
+                            easting_max = 150000,
+                            northing_min = 0,
+                            northing_max = 400,        
+                            reduction = max, 
+                            verbose = True,
+                            format = 'asc')
+        else:
+            print 'start sww2dem'
+            sww2dem(name, basename_out = outname,
+                        quantity = quantityname,
+                        timestep = timestep,
+                        cellsize = cellsize,      
+    ##                    easting_min = 0,
+    ##                    easting_max = 150000,
+    ##                    northing_min = 0,
+    ##                    northing_max = 400,     
+                        reduction = max, 
+                        verbose = True,
+                        format = 'asc')
+
Index: /anuga_work/development/continental_margin_0708/friction_0.02.py
===================================================================
--- /anuga_work/development/continental_margin_0708/friction_0.02.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/friction_0.02.py	(revision 5066)
@@ -0,0 +1,192 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'friction_0.02'
+shelf = [300000]
+slope = [150000]
+wave = [-0.5] #postive returns leading depression N-wave
+               #negative returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'friction'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=5000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0.02)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/gauges.csv
===================================================================
--- /anuga_work/development/continental_margin_0708/gauges.csv	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/gauges.csv	(revision 5066)
@@ -0,0 +1,28 @@
+easting,northing,name,elevation
+20,200,20m End,0
+100,200,100m End,0
+1000,200,1000m End,0
+4000,200,5km Middle,0
+19000,200,20km  Middle,0
+99000,200,100k Middle,0
+299000,200,300k Middle,0
+499000,200,500k Middle,0
+54000,200,55km Start,0
+104000,200,105km Start,0
+154000,200,155km Start,0
+254000,200,255km start,0
+69000,200,70km start,0
+119000,200,120km start,0
+169000,200,170km start,0
+269000,200,270km start,0
+149000,200,150km start,0
+199000,200,200km start,0
+249000,200,250km start,0
+349000,200,350km start,0
+399000,200,400km start,0
+449000,200,450km start,0
+549000,200,550km start,0
+599000,200,600km start,0
+649000,200,650km start,0
+749000,200,750km start,0
+49000,200,50k Middle,0
Index: /anuga_work/development/continental_margin_0708/gettimeseriesfrict.py
===================================================================
--- /anuga_work/development/continental_margin_0708/gettimeseriesfrict.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/gettimeseriesfrict.py	(revision 5066)
@@ -0,0 +1,191 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'friction_0.0'
+shelf = [300000]
+slope = [150000]
+wave = [0.5, -0.5]                
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'friction'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+
+            sww_file = 'unwanted'
+##            copy_code_files(output_dir,__file__,__file__)
+##            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = 'unwanted'+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=5000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145 
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return 0.5*offshore_depth*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 0.1, finaltime = 0.1): 
+                    domain.write_time()
+    
+##            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+##                domain.write_time()     
+####            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+####                                   skip_initial_step = True):
+####                domain.write_time()   
+####            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+####                                   skip_initial_step = True):
+####                domain.write_time()
+
+##                """
+##            Generate time series of nominated "gauges" 
+##            Note, this script will only work if pylab is installed on the platform
+##
+##            Inputs:
+##
+##            production dirs: dictionary of production directories with a
+##                             association to that simulation run, eg high tide,
+##                             magnitude, etc.
+##                                
+##            Outputs:
+##
+##            * figures stored in same directory as sww file
+##            * time series data stored in csv files in same directory as sww file
+##            * elevation at nominated gauges (elev_output)
+##            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+            print (output_dir+sep+str(name)+'.sww')
+            remove(output_dir+sep+'unwanted'+'.sww')
+
+
Index: /anuga_work/development/continental_margin_0708/linear.py
===================================================================
--- /anuga_work/development/continental_margin_0708/linear.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/linear.py	(revision 5066)
@@ -0,0 +1,188 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'curved_down_slope_linear_slope'
+shelf = [300000]
+slope = [150000]
+wave = [0.5, -0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 800.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'T_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+    
+                z = (-5000/slope[k])*x-135+((5000/slope[k])*(shelf[i]))
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/linear_curved.py
===================================================================
--- /anuga_work/development/continental_margin_0708/linear_curved.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/linear_curved.py	(revision 5066)
@@ -0,0 +1,191 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'Linear_Curved'
+shelf = [20000, 300000]
+slope = [50000, 150000]
+wave = [0.5, -0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 800.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'T_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                         z[j] = (-5000/slope[k])*x[j]-135+((5000/slope[k])*(shelf[i]))
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/linear_slope.py
===================================================================
--- /anuga_work/development/continental_margin_0708/linear_slope.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/linear_slope.py	(revision 5066)
@@ -0,0 +1,189 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'linear_slope'
+shelf = [500000]
+slope = [250000]
+wave = [-0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+            ##output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125*x[j]/shelf[i]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5000
+            H_d_ratio = 0.0004
+            Xo = 299000
+            po = 12 
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()
+                print   domain.timestepping_statistics(track_speeds=True)
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/continental_margin_0708/linear_slope_large.py
===================================================================
--- /anuga_work/development/continental_margin_0708/linear_slope_large.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/linear_slope_large.py	(revision 5066)
@@ -0,0 +1,191 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'linear_slope_2'
+shelf = [300000]
+slope = [250000]
+wave = [0.5, -0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+            ##output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125*x[j]/shelf[i]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+            for t in domain.evolve(yieldstep = 45, finaltime = -2000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500): 
+                domain.write_time()
+                
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500,
+                                    skip_initial_step = True):
+                domain.write_time()
+                
+            for t in domain.evolve(yieldstep = 120, finaltime = -10000+(length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)+1500, 
+                                   skip_initial_step = True):
+                domain.write_time() 
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/continental_margin_0708/mesh_80000_curved_down_slope.py
===================================================================
--- /anuga_work/development/continental_margin_0708/mesh_80000_curved_down_slope.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/mesh_80000_curved_down_slope.py	(revision 5066)
@@ -0,0 +1,193 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'mesh_80000'
+shelf = [50000]
+slope = [250000]
+wave = [0.5, -0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 1600.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'mesh'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=80000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/neg_con_900.py
===================================================================
--- /anuga_work/development/continental_margin_0708/neg_con_900.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/neg_con_900.py	(revision 5066)
@@ -0,0 +1,186 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'con_wave_900'
+shelf = [5000, 50000, 300000]
+slope = [50000, 150000]
+wave = [-0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 800.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+##            output_dir = 'C:'+sep+'anuga_data'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'wave_type_tester'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            def waveform(t):
+                  return wave[l]*2.1*sin(2*pi*t/900)*exp(-t/(900))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/shelftimeseries.py
===================================================================
--- /anuga_work/development/continental_margin_0708/shelftimeseries.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/shelftimeseries.py	(revision 5066)
@@ -0,0 +1,37 @@
+
+from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+name = 'wave_value_tester_1800a'
+shelf = [300000]
+slope = [150000]
+wave = [0.25]
+output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'wave_value_testers'+sep+str(name)+'_0.25_300000_150000'+sep
+# nominate directory location of sww file with associated attribute
+production_dirs = {output_dir: str(name)}
+
+# Generate figures
+swwfiles = {}
+for label_id in production_dirs.keys():
+    file_loc = label_id
+    swwfile = file_loc + str(name)+'.sww'
+    swwfiles[swwfile] = label_id
+    print 'hello', swwfile
+texname, elev_output = sww2timeseries(swwfiles,
+                                      sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                      production_dirs,
+                                      report = False,
+                                      reportname = '',
+                                      plot_quantity = ['stage', 'speed'],
+                                      generate_fig = False,
+                                      surface = False,
+                                      time_min = None,
+                                      time_max = None,
+                                      #time_unit = 'secs',
+                                      title_on = True,
+                                      verbose = True)
+print (output_dir+sep+str(name)+'.sww')
+remove(output_dir+sep+'unwanted'+'.sww')
+
+
+
Index: /anuga_work/development/continental_margin_0708/sin_wave_900.py
===================================================================
--- /anuga_work/development/continental_margin_0708/sin_wave_900.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/sin_wave_900.py	(revision 5066)
@@ -0,0 +1,186 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'sin_wave_900'
+shelf = [50000, 300000]
+slope = [50000, 150000]
+wave = [0.5, -0.5] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 800.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'wave_type_tester'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+    
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            def waveform(t):
+                return wave[l]*sin(pi*2*t/900)
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+            
+
+
Index: /anuga_work/development/continental_margin_0708/sol_900.py
===================================================================
--- /anuga_work/development/continental_margin_0708/sol_900.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/sol_900.py	(revision 5066)
@@ -0,0 +1,188 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'sol_900'
+shelf = [300000]
+slope = [150000]
+wave = [0.5]                
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'wave_type_tester'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=5000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145 
+            H_d_ratio = 0.0004
+            Xo = 100000
+            po = 130
+            def waveform(t):
+                 return 0.25*offshore_depth*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+                                   skip_initial_step = True):
+                domain.write_time()   
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/continental_margin_0708/timeseriessol.py
===================================================================
--- /anuga_work/development/continental_margin_0708/timeseriessol.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/timeseriessol.py	(revision 5066)
@@ -0,0 +1,191 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'wave_value_tester_2700a'
+shelf = [300000]
+slope = [150000]
+wave = [0.25]                
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 400.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'wave_value_testers'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+
+            sww_file = 'unwanted'
+##            copy_code_files(output_dir,__file__,__file__)
+##            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = 'unwanted'+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=5000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145 
+            H_d_ratio = 0.0004
+            Xo = 303000
+            po = 12
+            def waveform(t):
+                return 0.5*offshore_depth*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+
+            for t in domain.evolve(yieldstep = 0.1, finaltime = 0.1): 
+                    domain.write_time()
+    
+##            for t in domain.evolve(yieldstep = 45, finaltime = -1000+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+##                domain.write_time()     
+####            for t in domain.evolve(yieldstep = 45, finaltime = 2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000),
+####                                   skip_initial_step = True):
+####                domain.write_time()   
+####            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+####                                   skip_initial_step = True):
+####                domain.write_time()
+
+##                """
+##            Generate time series of nominated "gauges" 
+##            Note, this script will only work if pylab is installed on the platform
+##
+##            Inputs:
+##
+##            production dirs: dictionary of production directories with a
+##                             association to that simulation run, eg high tide,
+##                             magnitude, etc.
+##                                
+##            Outputs:
+##
+##            * figures stored in same directory as sww file
+##            * time series data stored in csv files in same directory as sww file
+##            * elevation at nominated gauges (elev_output)
+##            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                  sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'continental_shelves'+sep+'gauges.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+            print (output_dir+sep+str(name)+'.sww')
+            remove(output_dir+sep+'unwanted'+'.sww')
+
+
Index: /anuga_work/development/continental_margin_0708/wave_value_tester_900.py
===================================================================
--- /anuga_work/development/continental_margin_0708/wave_value_tester_900.py	(revision 5066)
+++ /anuga_work/development/continental_margin_0708/wave_value_tester_900.py	(revision 5066)
@@ -0,0 +1,207 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division 
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name = 'wave_value_tester_900a'
+shelf = [50000]
+slope = [150000]
+wave = [-0.5]
+N = len (shelf)
+for i in range(N):
+    M = len (slope)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (shelf[i]+slope[k])
+            width = 800.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+           ## output_dir = 'C:'+sep+'anuga_data'+sep+'topography'+sep+str(name)+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'wave_value_testers'+sep+str(name)+'_'+str(wave[l])+'_'+str(shelf[i])+'_'+str(slope[k])+sep
+
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+            start_screen_catcher(output_dir)
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=20000,
+                                     filename=meshname,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2)
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+                o = 2500/(slope[k]*slope[k]/4)
+                print str(2500/(slope[k]*slope[k]/4))
+                
+                z = o*(x-(shelf[i]+slope[k]))*(x-(shelf[i]+slope[k]))-5125-10
+                S = len (x)
+                for j in range(S):
+
+                    if x[j] < shelf[i]:
+                        z[j] = -125/(shelf[i]*shelf[i])*x[j]*x[j]-10
+
+                    elif shelf[i] <= x[j] < (shelf[i]+slope[k]*0.5) :
+                          z[j] = (-o)*(x[j]-shelf[i])*(x[j]-shelf[i])-125-10
+                        
+                return z
+                
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+            domain.set_quantity('friction', 0)         # Constant friction    
+            domain.set_quantity('stage', 0)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, sqrt, cosh 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.])   # Constant boundary values
+        
+            g = 9.81
+            offshore_depth = 5145 
+            H_d_ratio = 0.0004
+            Xo = 100000
+            po = 130
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+          
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 45, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000)): 
+                domain.write_time()     
+            for t in domain.evolve(yieldstep = 120, finaltime = (length/25)+2700+((length/50000)+1)*600+((shelf[i]/25000+1)*1000), 
+                                   skip_initial_step = True):
+                domain.write_time()
+
+            from anuga.shallow_water.data_manager import sww2dem
+            from os import sep
+
+            name = 'wave_value_tester_900a' 
+            time_dir = str(name)+'_'+str(wave[l])+'_50000_150000'
+            cellsize = 50
+            timestep = None
+            output_dir = sep+'d'+sep+'sim'+sep+'1'+sep+'mpittard'+sep+'idealised_bathymetry_study'+sep+'wave_value_testers'+sep
+            directory = output_dir
+            name = directory+time_dir+sep+str(name)
+            is_parallel = False
+            if is_parallel == True: nodes = 4
+            print 'output dir:', name
+
+            #var = [0,2,3] # stage, depth and speed
+            var = [0]
+
+            for which_var in var:
+                if which_var == 0:  # Stage
+                    outname = name + '_stage'
+                    quantityname = 'stage'
+
+                if which_var == 1:  # Absolute Momentum
+                    outname = name + '_momentum_i1'
+                    quantityname = '(xmomentum**2 + ymomentum**2)**0.5'  
+
+                if which_var == 2:  # Depth
+                    outname = name + '_depth'
+                    quantityname = 'stage-elevation'  
+
+                if which_var == 3:  # Speed
+                    outname = name + '_speed'
+                    quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
+
+                if which_var == 4:  # Elevation
+                    outname = name + '_elevation'
+                    quantityname = 'elevation'  #Elevation
+
+                if is_parallel == True:
+                #    print 'is_parallel',is_parallel
+                    for i in range(0,nodes):
+                        namei = name + '_P%d_%d' %(i,nodes)
+                        outnamei = outname + '_P%d_%d' %(i,nodes)
+                        print 'start sww2dem for sww file %d' %(i)
+                        sww2dem(namei, basename_out = outnamei,
+                                    quantity = quantityname,
+                                    timestep = timestep,
+                                    cellsize = cellsize,      
+                                    easting_min = 0,
+                                    easting_max = 150000,
+                                    northing_min = 0,
+                                    northing_max = 400,        
+                                    reduction = max, 
+                                    verbose = True,
+                                    format = 'asc')
+                else:
+                    print 'start sww2dem'
+                    sww2dem(name, basename_out = outname,
+                                quantity = quantityname,
+                                timestep = timestep,
+                                cellsize = cellsize,      
+            ##                    easting_min = 0,
+            ##                    easting_max = 150000,
+            ##                    northing_min = 0,
+            ##                    northing_max = 400,     
+                                reduction = max, 
+                                verbose = True,
+                                format = 'asc')
+
Index: /anuga_work/development/reef_0708/Flatgap_10000.py
===================================================================
--- /anuga_work/development/reef_0708/Flatgap_10000.py	(revision 5066)
+++ /anuga_work/development/reef_0708/Flatgap_10000.py	(revision 5066)
@@ -0,0 +1,214 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_smflat_gap'
+crest =[50, 450]
+A = [0.5, 2, -0.5, -2]
+gap = [10000]
+E = len (crest)
+for i in range(E):
+    M = len (gap)
+    for k in range (M):
+        B = len(A)
+        for l in range(B): 
+            length = (crest[i]+2500)
+            width = (gap[k]*3)
+            crestdepth = (-3)         
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+##            output_dir = 'c:'+sep+'anuga_data'+sep
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'gap'+sep+str(length)+'_'+str(A[l])+'_'+str(gap[k])+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],width],[140,width]]
+            interior_polygon2 = [[810+crest[i],0],[2499+crest[i],0],[2499+crest[i],width],[810+crest[i],width]]
+            interior_polygon3 = [[700,0], [700,gap[k]], [700+crest[i],gap[k]], [700+crest[i],0]]
+            interior_polygon4 = [[700,2*gap[k]], [700,width], [700+crest[i],width], [700+crest[i],2*gap[k]]]                     
+##            interior_regions = [[interior_polygon, 400], [interior_polygon2, 2500], [interior_polygon3, 400], [interior_polygon4, 400]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=1250,
+                                     filename=meshname,
+##                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z = (-81/(820+crest[i]-180)*x)+crestdepth-7+(180*(81/(820+crest[i]-180)))     
+                N = len (x)
+                for j in range(N):
+                    ##Lagoon
+                    if x[j] < 180:
+                        z[j] = -7+crestdepth
+
+                     ##gap
+                    elif 179 < x[j] < (821+crest[i]) and (gap[k]) < y[j] < (2*gap[k]):
+                        z[j] = (-81/(820+crest[i]-180)*x[j])+crestdepth-7+(180*(81/(820+crest[i]-180))) 
+##                      ##back of gap      
+##                    elif 180 < x[j] < 200 and (gap[k]) < y[j] < (2*gap[k]):
+##                        z[j] = -x[j]+173+crestdepth
+##                      ##Side of Gap Right  
+##                    elif 179< x[j] < (821+crest[i]) and (gap[k]*2)-4 < y[j] < (2*gap[k])+1:
+##                        z[j] = x[j]*20+crestdepth
+##                        ####                    ##Side of Gap left
+##                    elif 179 < x[j] < (821+crest[i]) and ((gap[k])-1) < y[j] < (gap[k]+4):
+##                        z[j] = -x[j]*20+crestdepth 
+                    #crest to lagoon
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth
+                        #Flat
+                    elif 199 < x[j] < 700:
+                        z[j] = -0.5+crestdepth
+                    ##Crest
+                    elif 699 < x[j] < (700+crest[i]):
+                        z[j] = +crestdepth
+                     #Curve down
+                    elif (699+crest[i]) < x[j] < (720+crest[i]):
+                        z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth
+                       ##steep slope 
+                    elif (719+crest[i]) < x[j] < (820+crest[i]):
+                        z[j] =(-0.84*x[j])+(0.84*(720+crest[i]))+crestdepth-4
+                    
+                return z
+
+
+
+
+                    
+               
+
+
+            domain.set_quantity('elevation', topography, alpha=0.1) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon, 0.05), (interior_polygon2, 0.05), (interior_polygon3, 0.2), (interior_polygon4, 0.2)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 288
+            H_d_ratio = 0.008
+            Xo = 71700
+            po = 0.036
+            def waveform(t):
+                return A[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'gap'+sep+'gauges_smflat_gap.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage','speed','bearing'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            remove(output_dir+sep+str(name)+'.sww')
Index: /anuga_work/development/reef_0708/GetTimeseries.py
===================================================================
--- /anuga_work/development/reef_0708/GetTimeseries.py	(revision 5066)
+++ /anuga_work/development/reef_0708/GetTimeseries.py	(revision 5066)
@@ -0,0 +1,45 @@
+"""
+Generate time series of nominated "gauges" 
+Note, this script will only work if pylab is installed on the platform
+
+Inputs:
+
+production dirs: dictionary of production directories with a
+                 association to that simulation run, eg high tide,
+                 magnitude, etc.
+                    
+Outputs:
+
+* figures stored in same directory as sww file
+* time series data stored in csv files in same directory as sww file
+* elevation at nominated gauges (elev_output)
+"""
+
+from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+# nominate directory location of sww file with associated attribute
+production_dirs = {'': 'gradual_lgflat'}
+
+# Generate figures
+swwfiles = {}
+for label_id in production_dirs.keys():
+    file_loc = label_id
+    swwfile = file_loc + 'gradual_lgflat'+'.sww'
+    swwfiles[swwfile] = label_id
+    print 'hello', swwfile
+texname, elev_output = sww2timeseries(swwfiles,
+                                       sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_lgflat.csv',
+                                      production_dirs,
+                                      report = False,
+                                      reportname = '',
+                                      plot_quantity = ['stage', 'speed'],
+                                      generate_fig = False,
+                                      surface = False,
+                                      time_min = None,
+                                      time_max = None,
+                                      #time_unit = 'secs',
+                                      title_on = True,
+                                      verbose = True)
+
+
Index: /anuga_work/development/reef_0708/export_results.py
===================================================================
--- /anuga_work/development/reef_0708/export_results.py	(revision 5066)
+++ /anuga_work/development/reef_0708/export_results.py	(revision 5066)
@@ -0,0 +1,82 @@
+import os
+import sys
+
+from anuga.shallow_water.data_manager import sww2dem
+from os import sep
+
+name2= 'gap'
+time_dir = '2550_1_2700_20000gap' # sww file location
+
+cellsize = 5
+#cellsize = 150
+timestep = None
+output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'gap'+sep+'transect'+sep
+directory = output_dir
+
+name = directory+time_dir+sep+str(name2)
+
+
+from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
+
+is_parallel = False
+#is_parallel = True
+if is_parallel == True: nodes = 4
+print 'output dir:', name
+
+#var = [2,3,4] # depth and speed
+#var = [2] # depth
+#var = [4]
+var = [0]
+
+for which_var in var:
+    if which_var == 0:  # Stage
+        outname = name + '_stage'
+        quantityname = 'stage'
+
+    if which_var == 1:  # Absolute Momentum
+        outname = name + '_momentum'
+        quantityname = '(xmomentum**2 + ymomentum**2)**0.5'  
+
+    if which_var == 2:  # Depth
+        outname = name + '_depth'
+        quantityname = 'stage-elevation'  
+
+    if which_var == 3:  # Speed
+        outname = name + '_speed'
+        quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))'  #Speed
+
+    if which_var == 4:  # Elevation
+        outname = name + '_elevation'
+        quantityname = 'elevation'  #Elevation
+
+    if is_parallel == True:
+    #    print 'is_parallel',is_parallel
+        for i in range(0,nodes):
+            namei = name + '_P%d_%d' %(i,nodes)
+            outnamei = outname + '_P%d_%d' %(i,nodes)
+            print 'start sww2dem for sww file %d' %(i)
+            sww2dem(namei, basename_out = outnamei,
+                        quantity = quantityname,
+                        timestep = timestep,
+                        cellsize = cellsize,      
+                        easting_min = project_grad.e_min_area,
+                        easting_max = project_grad.e_max_area,
+                        northing_min = project_grad.n_min_area,
+                        northing_max = project_grad.n_max_area,        
+                        reduction = max, 
+                        verbose = True,
+                        format = 'asc')
+    else:
+        print 'start sww2dem'
+        sww2dem(name, basename_out = outname,
+                    quantity = quantityname,
+                    timestep = timestep,
+                    cellsize = cellsize,      
+                    #easting_min = project_grad.e_min_area,
+                    #easting_max = project_grad.e_max_area,
+                    #northing_min = project_grad.n_min_area,
+                    #northing_max = project_grad.n_max_area,        
+                    reduction = max, 
+                    verbose = True,
+                    format = 'asc')
+
Index: /anuga_work/development/reef_0708/gauges_lagoon.csv
===================================================================
--- /anuga_work/development/reef_0708/gauges_lagoon.csv	(revision 5066)
+++ /anuga_work/development/reef_0708/gauges_lagoon.csv	(revision 5066)
@@ -0,0 +1,23 @@
+easting,northing,name,elevation
+50,10,end,0
+150,10,after_backreef,0
+212.5,10,qtr_crest(50),0
+225,10,half_crest(50),0
+237.5,10,3qtr_crest(50),0
+262.5,10,qtr_crest(250),0
+325,10,half_crest(250),0
+387.5,10,3qtr_crest(250),0
+312.5,10,qtr_crest(450),0
+425,10,half_crest(450),0
+537.5,10,3qtr_crest(450),0
+362.5,10,qtr_crest(650),0
+525,10,half_crest(650),0
+687.5,10,3qtr_crest(650),0
+320,10,before_crest(50),0
+520,10,before_crest(250),0
+720,10,before_crest(450),0
+920,10,before_crest(650),0
+530,10,start(50),0
+730,10,start(250),0
+930,10,start(450),0
+1130,10,start(650),0
Index: /anuga_work/development/reef_0708/gauges_lgflat.csv
===================================================================
--- /anuga_work/development/reef_0708/gauges_lgflat.csv	(revision 5066)
+++ /anuga_work/development/reef_0708/gauges_lgflat.csv	(revision 5066)
@@ -0,0 +1,26 @@
+easting,northing,name,elevation
+50,10,end,0
+150,10,after_backreef,0
+220,10,20m before flat end,0
+1200,10,midway flat,0
+2180,10,20m onto flat,0
+2212.5,10,qtr_crest(50),0
+2225,10,half_crest(50),0
+2237.5,10,3qtr_crest(50),0
+2262.5,10,qtr_crest(250),0
+2325,10,half_crest(250),0
+2387.5,10,3qtr_crest(250),0
+2312.5,10,qtr_crest(450),0
+2425,10,half_crest(450),0
+2537.5,10,3qtr_crest(450),0
+2362.5,10,qtr_crest(650),0
+2525,10,half_crest(650),0
+2687.5,10,3qtr_crest(650),0
+2320,10,before_crest(50),0
+2520,10,before_crest(250),0
+2720,10,before_crest(450),0
+2920,10,before_crest(650),0
+2530,10,start(50),0
+2730,10,start(250),0
+2930,10,start(450),0
+3130,10,start(650),0
Index: /anuga_work/development/reef_0708/gauges_mesh.csv
===================================================================
--- /anuga_work/development/reef_0708/gauges_mesh.csv	(revision 5066)
+++ /anuga_work/development/reef_0708/gauges_mesh.csv	(revision 5066)
@@ -0,0 +1,15 @@
+easting,northing,name,elevation
+50,5,0,0
+150,5,1,0
+225,5,2,0
+251,5,3,0
+270,5,4,0
+375,5,5,0
+401,5,6,0
+420,5,7,0
+575,5,8,0
+601,5,9,0
+620,5,10,0
+875,5,11,0
+901,5,12,0
+920,5,13,0
Index: /anuga_work/development/reef_0708/gauges_smflat.csv
===================================================================
--- /anuga_work/development/reef_0708/gauges_smflat.csv	(revision 5066)
+++ /anuga_work/development/reef_0708/gauges_smflat.csv	(revision 5066)
@@ -0,0 +1,26 @@
+easting,northing,name,elevation
+50,10,end,0
+150,10,after_backreef,0
+220,10,20m before flat end,0
+450,10,midway flat,0
+680,10,20m onto flat,0
+712.5,10,qtr_crest(50),0
+725,10,half_crest(50),0
+737.5,10,3qtr_crest(50),0
+762.5,10,qtr_crest(250),0
+825,10,half_crest(250),0
+887.5,10,3qtr_crest(250),0
+812.5,10,qtr_crest(450),0
+925,10,half_crest(450),0
+1037.5,10,3qtr_crest(450),0
+862.5,10,qtr_crest(650),0
+1025,10,half_crest(650),0
+1187.5,10,3qtr_crest(650),0
+820,10,before_crest(50),0
+1020,10,before_crest(250),0
+1220,10,before_crest(450),0
+1420,10,before_crest(650),0
+1030,10,start(50),0
+1230,10,start(250),0
+1430,10,start(450),0
+1630,10,start(650),0
Index: /anuga_work/development/reef_0708/gauges_smflat_gap.csv
===================================================================
--- /anuga_work/development/reef_0708/gauges_smflat_gap.csv	(revision 5066)
+++ /anuga_work/development/reef_0708/gauges_smflat_gap.csv	(revision 5066)
@@ -0,0 +1,376 @@
+easting,northing,name,elevation
+50,250,end_midcrest1(500mgap),0
+50,500,end_midcrest1(1kmgap),0
+50,2500,end_midcrest1(5kmgap),0
+50,5000,end_midcrest1(10kmgap),0
+50,10000,end_midcrest1(20kmgap),0
+50,750,end_midgap(500gap),0
+50,1500,end_midgap(1kmgap),0
+50,7500,end_midgap(5kmgap),0
+50,15000,end_midgap(10kmgap),0
+50,30000,end_midgap(20kmgap),0
+50,1250,end_midcrest2(500mgap),0
+50,2500,end_midcrest2(1kmgap),0
+50,12500,end_midcrest2(5kmgap),0
+50,25000,end_midcrest2(10kmgap),0
+50,50000,end_midcrest2(20kmgap),0
+150,250,after_backreef_midcrest1(500mgap),0
+150,500,after_backreef_midcrest1(1kmgap),0
+150,2500,after_backreef_midcrest1(5kmgap),0
+150,5000,after_backreef_midcrest1(10kmgap),0
+150,10000,after_backreef_midcrest1(20kmgap),0
+150,750,after_backreef_midgap(500mgap),0
+150,1500,after_backreef_midgap(1kmgap),0
+150,7500,after_backreef_midgap(5kmgap),0
+150,15000,after_backreef_midgap(10kmgap),0
+150,30000,after_backreef_midgap(20kmgap),0
+150,1250,after_backreef_midcrest2(500mgap),0
+150,2500,after_backreef_midcrest2(1kmgap),0
+150,12500,after_backreef_midcrest2(5kmgap),0
+150,25000,after_backreef_midcrest2(10kmgap),0
+150,50000,after_backreef_midcrest2(20kmgap),0
+220,250,20m before flat end_midcrest1(500mgap),0
+220,500,20m before flat end_midcrest1(5kmgap),0
+220,2500,20m before flat end_midcrest1(10kmgap),0
+220,5000,20m before flat end_midcrest1(1kmgap),0
+220,10000,20m before flat end_midcrest1(20kmgap),0
+220,750,20m before flat end_midgap(500mgap),0
+220,1500,20m before flat end_midgap(1kmgap),0
+220,7500,20m before flat end_midgap(5kmgap),0
+220,15000,20m before flat end_midgap(10kmgap),0
+220,30000,20m before flat end_midgap(20kmgap),0
+220,1250,20m before flat end_midcrest2(500mgap),0
+220,2500,20m before flat end_midcrest2(1kmgap),0
+220,12500,20m before flat end_midcrest2(5kmgap),0
+220,25000,20m before flat end_midcrest2(10kmgap),0
+220,50000,20m before flat end_midcrest2(20kmgap),0
+450,250,midway flat_midcrest1(500mgap),0
+450,500,midway flat_midcrest1(1kmgap),0
+450,2500,midway flat_midcrest1(5kmgap),0
+450,5000,midway flat_midcrest1(10kmgap),0
+450,10000,midway flat_midcrest1(20kmgap),0
+450,750,midway flat_midgap(500mgap),0
+450,1500,midway flat_midgap(1kmgap),0
+450,7500,midway flat_midgap(5kmgap),0
+450,15000,midway flat_midgap(10kmgap),0
+450,30000,midway flat_midgap(20kmgap),0
+450,1250,midway flat_midcrest2(500mgap),0
+450,2500,midway flat_midcrest2(1kmgap),0
+450,12500,midway flat_midcrest2(5kmgap),0
+450,25000,midway flat_midcrest2(10kmgap),0
+450,50000,midway flat_midcrest2(20kmgap),0
+680,250,20m onto flat_midcrest1(500mgap),0
+680,500,20m onto flat_midcrest1(1kmgap),0
+680,2500,20m onto flat_midcrest1(5kmgap),0
+680,5000,20m onto flat_midcrest1(10kmgap),0
+680,10000,20m onto flat_midcrest1(20kmgap),0
+680,750,20m onto flat_midgap(500mgap),0
+680,1500,20m onto flat_midgap(1kmgap),0
+680,7500,20m onto flat_midgap(5kmgap),0
+680,15000,20m onto flat_midgap(10kmgap),0
+680,30000,20m onto flat_midgap(20kmgap),0
+680,1250,20m onto flat_midcrest2(500mgap),0
+680,2500,20m onto flat_midcrest2(1kmgap),0
+680,12500,20m onto flat_midcrest2(5kmgap),0
+680,25000,20m onto flat_midcrest2(10kmgap),0
+680,50000,20m onto flat_midcrest2(20kmgap),0
+712.5,250,qtr_crest(50)_midcrest1(500mgap),0
+712.5,500,qtr_crest(50)_midcrest1(1kmgap) ,0
+712.5,2500,qtr_crest(50)_midcrest1(5kmgap) ,0
+712.5,5000,qtr_crest(50)_midcrest1(10kmgap),0
+712.5,10000,qtr_crest(50)_midcrest1(20kmgap),0
+712.5,750,qtr_crest(50)_midgap(500gap)    ,0
+712.5,1500,qtr_crest(50)_midgap(1kmgap)    ,0
+712.5,7500,qtr_crest(50)_midgap(5kmgap)    ,0
+712.5,15000,qtr_crest(50)_midgap(10kmgap)   ,0
+712.5,30000,qtr_crest(50)_midgap(20kmgap)   ,0
+712.5,1250,qtr_crest(50)_midcrest2(500mgap),0
+712.5,2500,qtr_crest(50)_midcrest2(1kmgap) ,0
+712.5,12500,qtr_crest(50)_midcrest2(5kmgap) ,0
+712.5,25000,qtr_crest(50)_midcrest2(10kmgap),0
+712.5,50000,qtr_crest(50)_midcrest2(20kmgap),0
+725,250,half_crest(50)_midcrest1(500mgap),0
+725,500,half_crest(50)_midcrest1(1kmgap) ,0
+725,2500,half_crest(50)_midcrest1(5kmgap) ,0
+725,5000,half_crest(50)_midcrest1(10kmgap),0
+725,10000,half_crest(50)_midcrest1(20kmgap),0
+725,750,half_crest(50)_midgap(500gap)    ,0
+725,1500,half_crest(50)_midgap(1kmgap)    ,0
+725,7500,half_crest(50)_midgap(5kmgap)    ,0
+725,15000,half_crest(50)_midgap(10kmgap)   ,0
+725,30000,half_crest(50)_midgap(20kmgap)   ,0
+725,1250,half_crest(50)_midcrest2(500mgap),0
+725,2500,half_crest(50)_midcrest2(1kmgap) ,0
+725,12500,half_crest(50)_midcrest2(5kmgap) ,0
+725,25000,half_crest(50)_midcrest2(10kmgap),0
+725,50000,half_crest(50)_midcrest2(20kmgap),0
+737.5,250,3qtr_crest(50)_midcrest1(500mgap),0
+737.5,500,3qtr_crest(50)_midcrest1(1kmgap) ,0
+737.5,2500,3qtr_crest(50)_midcrest1(5kmgap) ,0
+737.5,5000,3qtr_crest(50)_midcrest1(10kmgap),0
+737.5,10000,3qtr_crest(50)_midcrest1(20kmgap),0
+737.5,750,3qtr_crest(50)_midgap(500gap)    ,0
+737.5,1500,3qtr_crest(50)_midgap(1kmgap)    ,0
+737.5,7500,3qtr_crest(50)_midgap(5kmgap)    ,0
+737.5,15000,3qtr_crest(50)_midgap(10kmgap)   ,0
+737.5,30000,3qtr_crest(50)_midgap(20kmgap)   ,0
+737.5,1250,3qtr_crest(50)_midcrest2(500mgap),0
+737.5,2500,3qtr_crest(50)_midcrest2(1kmgap) ,0
+737.5,12500,3qtr_crest(50)_midcrest2(5kmgap) ,0
+737.5,25000,3qtr_crest(50)_midcrest2(10kmgap),0
+737.5,50000,3qtr_crest(50)_midcrest2(20kmgap),0
+762.5,250,qtr_crest(250)_midcrest1(500mgap),0
+762.5,500,qtr_crest(250)_midcrest1(1kmgap) ,0
+762.5,2500,qtr_crest(250)_midcrest1(5kmgap) ,0
+762.5,5000,qtr_crest(250)_midcrest1(10kmgap),0
+762.5,10000,qtr_crest(250)_midcrest1(20kmgap),0
+762.5,750,qtr_crest(250)_midgap(500gap)    ,0
+762.5,1500,qtr_crest(250)_midgap(1kmgap)    ,0
+762.5,7500,qtr_crest(250)_midgap(5kmgap)    ,0
+762.5,15000,qtr_crest(250)_midgap(10kmgap)   ,0
+762.5,30000,qtr_crest(250)_midgap(20kmgap)   ,0
+762.5,1250,qtr_crest(250)_midcrest2(500mgap),0
+762.5,2500,qtr_crest(250)_midcrest2(1kmgap) ,0
+762.5,12500,qtr_crest(250)_midcrest2(5kmgap) ,0
+762.5,25000,qtr_crest(250)_midcrest2(10kmgap),0
+762.5,50000,qtr_crest(250)_midcrest2(20kmgap),0
+825,250,half_crest(250)_midcrest1(500mgap),0
+825,500,half_crest(250)_midcrest1(1kmgap) ,0
+825,2500,half_crest(250)_midcrest1(5kmgap) ,0
+825,5000,half_crest(250)_midcrest1(10kmgap),0
+825,10000,half_crest(250)_midcrest1(20kmgap),0
+825,750,half_crest(250)_midgap(500gap)    ,0
+825,1500,half_crest(250)_midgap(1kmgap)    ,0
+825,7500,half_crest(250)_midgap(5kmgap)    ,0
+825,15000,half_crest(250)_midgap(10kmgap)   ,0
+825,30000,half_crest(250)_midgap(20kmgap)   ,0
+825,1250,half_crest(250)_midcrest2(500mgap),0
+825,2500,half_crest(250)_midcrest2(1kmgap) ,0
+825,12500,half_crest(250)_midcrest2(5kmgap) ,0
+825,25000,half_crest(250)_midcrest2(10kmgap),0
+825,50000,half_crest(250)_midcrest2(20kmgap),0
+887.5,250,3qtr_crest(250)_midcrest1(500mgap),0
+887.5,500,3qtr_crest(250)_midcrest1(1kmgap) ,0
+887.5,2500,3qtr_crest(250)_midcrest1(5kmgap) ,0
+887.5,5000,3qtr_crest(250)_midcrest1(10kmgap),0
+887.5,10000,3qtr_crest(250)_midcrest1(20kmgap),0
+887.5,750,3qtr_crest(250)_midgap(500gap)    ,0
+887.5,1500,3qtr_crest(250)_midgap(1kmgap)    ,0
+887.5,7500,3qtr_crest(250)_midgap(5kmgap)    ,0
+887.5,15000,3qtr_crest(250)_midgap(10kmgap)   ,0
+887.5,30000,3qtr_crest(250)_midgap(20kmgap)   ,0
+887.5,1250,3qtr_crest(250)_midcrest2(500mgap),0
+887.5,2500,3qtr_crest(250)_midcrest2(1kmgap) ,0
+887.5,12500,3qtr_crest(250)_midcrest2(5kmgap) ,0
+887.5,25000,3qtr_crest(250)_midcrest2(10kmgap),0
+887.5,50000,3qtr_crest(250)_midcrest2(20kmgap),0
+812.5,250,qtr_crest(450)_midcrest1(500mgap),0
+812.5,500,qtr_crest(450)_midcrest1(1kmgap) ,0
+812.5,2500,qtr_crest(450)_midcrest1(5kmgap) ,0
+812.5,5000,qtr_crest(450)_midcrest1(10kmgap),0
+812.5,10000,qtr_crest(450)_midcrest1(20kmgap),0
+812.5,750,qtr_crest(450)_midgap(500gap)    ,0
+812.5,1500,qtr_crest(450)_midgap(1kmgap)    ,0
+812.5,7500,qtr_crest(450)_midgap(5kmgap)    ,0
+812.5,15000,qtr_crest(450)_midgap(10kmgap)   ,0
+812.5,30000,qtr_crest(450)_midgap(20kmgap)   ,0
+812.5,1250,qtr_crest(450)_midcrest2(500mgap),0
+812.5,2500,qtr_crest(450)_midcrest2(1kmgap) ,0
+812.5,12500,qtr_crest(450)_midcrest2(5kmgap) ,0
+812.5,25000,qtr_crest(450)_midcrest2(10kmgap),0
+812.5,50000,qtr_crest(450)_midcrest2(20kmgap),0
+925,250,half_crest(450)_midcrest1(500mgap),0
+925,500,half_crest(450)_midcrest1(1kmgap) ,0
+925,2500,half_crest(450)_midcrest1(5kmgap) ,0
+925,5000,half_crest(450)_midcrest1(10kmgap),0
+925,10000,half_crest(450)_midcrest1(20kmgap),0
+925,750,half_crest(450)_midgap(500gap)    ,0
+925,1500,half_crest(450)_midgap(1kmgap)    ,0
+925,7500,half_crest(450)_midgap(5kmgap)    ,0
+925,15000,half_crest(450)_midgap(10kmgap)   ,0
+925,30000,half_crest(450)_midgap(20kmgap)   ,0
+925,1250,half_crest(450)_midcrest2(500mgap),0
+925,2500,half_crest(450)_midcrest2(1kmgap) ,0
+925,12500,half_crest(450)_midcrest2(5kmgap) ,0
+925,25000,half_crest(450)_midcrest2(10kmgap),0
+925,50000,half_crest(450)_midcrest2(20kmgap),0
+1037.5,250,3qtr_crest(450)_midcrest1(500mgap),0
+1037.5,500,3qtr_crest(450)_midcrest1(1kmgap) ,0
+1037.5,2500,3qtr_crest(450)_midcrest1(5kmgap) ,0
+1037.5,5000,3qtr_crest(450)_midcrest1(10kmgap),0
+1037.5,10000,3qtr_crest(450)_midcrest1(20kmgap),0
+1037.5,750,3qtr_crest(450)_midgap(500gap)    ,0
+1037.5,1500,3qtr_crest(450)_midgap(1kmgap)    ,0
+1037.5,7500,3qtr_crest(450)_midgap(5kmgap)    ,0
+1037.5,15000,3qtr_crest(450)_midgap(10kmgap)   ,0
+1037.5,30000,3qtr_crest(450)_midgap(20kmgap)   ,0
+1037.5,1250,3qtr_crest(450)_midcrest2(500mgap),0
+1037.5,2500,3qtr_crest(450)_midcrest2(1kmgap) ,0
+1037.5,12500,3qtr_crest(450)_midcrest2(5kmgap) ,0
+1037.5,25000,3qtr_crest(450)_midcrest2(10kmgap),0
+1037.5,50000,3qtr_crest(450)_midcrest2(20kmgap),0
+862.5,250,qtr_crest(650)_midcrest1(500mgap),0
+862.5,500,qtr_crest(650)_midcrest1(1kmgap) ,0
+862.5,2500,qtr_crest(650)_midcrest1(5kmgap) ,0
+862.5,5000,qtr_crest(650)_midcrest1(10kmgap),0
+862.5,10000,qtr_crest(650)_midcrest1(20kmgap),0
+862.5,750,qtr_crest(650)_midgap(500gap)    ,0
+862.5,1500,qtr_crest(650)_midgap(1kmgap)    ,0
+862.5,7500,qtr_crest(650)_midgap(5kmgap)    ,0
+862.5,15000,qtr_crest(650)_midgap(10kmgap)   ,0
+862.5,30000,qtr_crest(650)_midgap(20kmgap)   ,0
+862.5,1250,qtr_crest(650)_midcrest2(500mgap),0
+862.5,2500,qtr_crest(650)_midcrest2(1kmgap) ,0
+862.5,12500,qtr_crest(650)_midcrest2(5kmgap) ,0
+862.5,25000,qtr_crest(650)_midcrest2(10kmgap),0
+862.5,50000,qtr_crest(650)_midcrest2(20kmgap),0
+1025,250,half_crest(650)_midcrest1(500mgap),0
+1025,500,half_crest(650)_midcrest1(1kmgap) ,0
+1025,2500,half_crest(650)_midcrest1(5kmgap) ,0
+1025,5000,half_crest(650)_midcrest1(10kmgap),0
+1025,10000,half_crest(650)_midcrest1(20kmgap),0
+1025,750,half_crest(650)_midgap(500gap)    ,0
+1025,1500,half_crest(650)_midgap(1kmgap)    ,0
+1025,7500,half_crest(650)_midgap(5kmgap)    ,0
+1025,15000,half_crest(650)_midgap(10kmgap)   ,0
+1025,30000,half_crest(650)_midgap(20kmgap)   ,0
+1025,1250,half_crest(650)_midcrest2(500mgap),0
+1025,2500,half_crest(650)_midcrest2(1kmgap) ,0
+1025,12500,half_crest(650)_midcrest2(5kmgap) ,0
+1025,25000,half_crest(650)_midcrest2(10kmgap),0
+1025,50000,half_crest(650)_midcrest2(20kmgap),0
+1187.5,250,3qtr_crest(650)_midcrest1(500mgap),0
+1187.5,500,3qtr_crest(650)_midcrest1(1kmgap) ,0
+1187.5,2500,3qtr_crest(650)_midcrest1(5kmgap) ,0
+1187.5,5000,3qtr_crest(650)_midcrest1(10kmgap),0
+1187.5,10000,3qtr_crest(650)_midcrest1(20kmgap),0
+1187.5,750,3qtr_crest(650)_midgap(500gap)    ,0
+1187.5,1500,3qtr_crest(650)_midgap(1kmgap)    ,0
+1187.5,7500,3qtr_crest(650)_midgap(5kmgap)    ,0
+1187.5,15000,3qtr_crest(650)_midgap(10kmgap)   ,0
+1187.5,30000,3qtr_crest(650)_midgap(20kmgap)   ,0
+1187.5,1250,3qtr_crest(650)_midcrest2(500mgap),0
+1187.5,2500,3qtr_crest(650)_midcrest2(1kmgap) ,0
+1187.5,12500,3qtr_crest(650)_midcrest2(5kmgap) ,0
+1187.5,25000,3qtr_crest(650)_midcrest2(10kmgap),0
+1187.5,50000,3qtr_crest(650)_midcrest2(20kmgap),0
+820,250,before_crest(50)_midcrest1(500mgap),0
+820,500,before_crest(50)_midcrest1(1kmgap) ,0
+820,2500,before_crest(50)_midcrest1(5kmgap) ,0
+820,5000,before_crest(50)_midcrest1(10kmgap),0
+820,10000,before_crest(50)_midcrest1(20kmgap),0
+820,750,before_crest(50)_midgap(500gap)    ,0
+820,1500,before_crest(50)_midgap(1kmgap)    ,0
+820,7500,before_crest(50)_midgap(5kmgap)    ,0
+820,15000,before_crest(50)_midgap(10kmgap)   ,0
+820,30000,before_crest(50)_midgap(20kmgap)   ,0
+820,1250,before_crest(50)_midcrest2(500mgap),0
+820,2500,before_crest(50)_midcrest2(1kmgap) ,0
+820,12500,before_crest(50)_midcrest2(5kmgap) ,0
+820,25000,before_crest(50)_midcrest2(10kmgap),0
+820,50000,before_crest(50)_midcrest2(20kmgap),0
+1020,250,before_crest(250)_midcrest1(500mgap),0
+1020,500,before_crest(250)_midcrest1(1kmgap) ,0
+1020,2500,before_crest(250)_midcrest1(5kmgap) ,0
+1020,5000,before_crest(250)_midcrest1(10kmgap),0
+1020,10000,before_crest(250)_midcrest1(20kmgap),0
+1020,750,before_crest(250)_midgap(500gap)    ,0
+1020,1500,before_crest(250)_midgap(1kmgap)    ,0
+1020,7500,before_crest(250)_midgap(5kmgap)    ,0
+1020,15000,before_crest(250)_midgap(10kmgap)   ,0
+1020,30000,before_crest(250)_midgap(20kmgap)   ,0
+1020,1250,before_crest(250)_midcrest2(500mgap),0
+1020,2500,before_crest(250)_midcrest2(1kmgap) ,0
+1020,12500,before_crest(250)_midcrest2(5kmgap) ,0
+1020,25000,before_crest(250)_midcrest2(10kmgap),0
+1020,50000,before_crest(250)_midcrest2(20kmgap),0
+1220,250,before_crest(450)_midcrest1(500mgap),0
+1220,500,before_crest(450)_midcrest1(1kmgap) ,0
+1220,2500,before_crest(450)_midcrest1(5kmgap) ,0
+1220,5000,before_crest(450)_midcrest1(10kmgap),0
+1220,10000,before_crest(450)_midcrest1(20kmgap),0
+1220,750,before_crest(450)_midgap(500gap)    ,0
+1220,1500,before_crest(450)_midgap(1kmgap)    ,0
+1220,7500,before_crest(450)_midgap(5kmgap)    ,0
+1220,15000,before_crest(450)_midgap(10kmgap)   ,0
+1220,30000,before_crest(450)_midgap(20kmgap)   ,0
+1220,1250,before_crest(450)_midcrest2(500mgap),0
+1220,2500,before_crest(450)_midcrest2(1kmgap) ,0
+1220,12500,before_crest(450)_midcrest2(5kmgap) ,0
+1220,25000,before_crest(450)_midcrest2(10kmgap),0
+1220,50000,before_crest(450)_midcrest2(20kmgap),0
+1420,250,before_crest(650)_midcrest1(500mgap),0
+1420,500,before_crest(650)_midcrest1(1kmgap) ,0
+1420,2500,before_crest(650)_midcrest1(5kmgap) ,0
+1420,5000,before_crest(650)_midcrest1(10kmgap),0
+1420,10000,before_crest(650)_midcrest1(20kmgap),0
+1420,750,before_crest(650)_midgap(500gap)    ,0
+1420,1500,before_crest(650)_midgap(1kmgap)    ,0
+1420,7500,before_crest(650)_midgap(5kmgap)    ,0
+1420,15000,before_crest(650)_midgap(10kmgap)   ,0
+1420,30000,before_crest(650)_midgap(20kmgap)   ,0
+1420,1250,before_crest(650)_midcrest2(500mgap),0
+1420,2500,before_crest(650)_midcrest2(1kmgap) ,0
+1420,12500,before_crest(650)_midcrest2(5kmgap) ,0
+1420,25000,before_crest(650)_midcrest2(10kmgap),0
+1420,50000,before_crest(650)_midcrest2(20kmgap),0
+2530,250,start(50)_midcrest1(500mgap),0
+2530,500,start(50)_midcrest1(1kmgap) ,0
+2530,2500,start(50)_midcrest1(5kmgap) ,0
+2530,5000,start(50)_midcrest1(10kmgap),0
+2530,10000,start(50)_midcrest1(20kmgap),0
+2530,750,start(50)_midgap(500gap)    ,0
+2530,1500,start(50)_midgap(1kmgap)    ,0
+2530,7500,start(50)_midgap(5kmgap)    ,0
+2530,15000,start(50)_midgap(10kmgap)   ,0
+2530,30000,start(50)_midgap(20kmgap)   ,0
+2530,1250,start(50)_midcrest2(500mgap),0
+2530,2500,start(50)_midcrest2(1kmgap) ,0
+2530,12500,start(50)_midcrest2(5kmgap) ,0
+2530,25000,start(50)_midcrest2(10kmgap),0
+2530,50000,start(50)_midcrest2(20kmgap),0
+2730,250,start(250)_midcrest1(500mgap),0
+2730,500,start(250)_midcrest1(1kmgap) ,0
+2730,2500,start(250)_midcrest1(5kmgap) ,0
+2730,5000,start(250)_midcrest1(10kmgap),0
+2730,10000,start(250)_midcrest1(20kmgap),0
+2730,750,start(250)_midgap(500gap)    ,0
+2730,1500,start(250)_midgap(1kmgap)    ,0
+2730,7500,start(250)_midgap(5kmgap)    ,0
+2730,15000,start(250)_midgap(10kmgap)   ,0
+2730,30000,start(250)_midgap(20kmgap)   ,0
+2730,1250,start(250)_midcrest2(500mgap),0
+2730,2500,start(250)_midcrest2(1kmgap) ,0
+2730,12500,start(250)_midcrest2(5kmgap) ,0
+2730,25000,start(250)_midcrest2(10kmgap),0
+2730,50000,start(250)_midcrest2(20kmgap),0
+2930,250,start(450)_midcrest1(500mgap),0
+2930,500,start(450)_midcrest1(1kmgap) ,0
+2930,2500,start(450)_midcrest1(5kmgap) ,0
+2930,5000,start(450)_midcrest1(10kmgap),0
+2930,10000,start(450)_midcrest1(20kmgap),0
+2930,750,start(450)_midgap(500gap)    ,0
+2930,1500,start(450)_midgap(1kmgap)    ,0
+2930,7500,start(450)_midgap(5kmgap)    ,0
+2930,15000,start(450)_midgap(10kmgap)   ,0
+2930,30000,start(450)_midgap(20kmgap)   ,0
+2930,1250,start(450)_midcrest2(500mgap),0
+2930,2500,start(450)_midcrest2(1kmgap) ,0
+2930,12500,start(450)_midcrest2(5kmgap) ,0
+2930,25000,start(450)_midcrest2(10kmgap),0
+2930,50000,start(450)_midcrest2(20kmgap),0
+3130,250,start(650)_midcrest1(500mgap),0
+3130,500,start(650)_midcrest1(1kmgap) ,0
+3130,2500,start(650)_midcrest1(5kmgap) ,0
+3130,5000,start(650)_midcrest1(10kmgap),0
+3130,10000,start(650)_midcrest1(20kmgap),0
+3130,750,start(650)_midgap(500gap)    ,0
+3130,1500,start(650)_midgap(1kmgap)    ,0
+3130,7500,start(650)_midgap(5kmgap)    ,0
+3130,15000,start(650)_midgap(10kmgap)   ,0
+3130,30000,start(650)_midgap(20kmgap)   ,0
+3130,1250,start(650)_midcrest2(500mgap),0
+3130,2500,start(650)_midcrest2(1kmgap) ,0
+3130,12500,start(650)_midcrest2(5kmgap) ,0
+3130,25000,start(650)_midcrest2(10kmgap),0
+3130,50000,start(650)_midcrest2(20kmgap),0
Index: /anuga_work/development/reef_0708/gradual_lagoon.py
===================================================================
--- /anuga_work/development/reef_0708/gradual_lagoon.py	(revision 5066)
+++ /anuga_work/development/reef_0708/gradual_lagoon.py	(revision 5066)
@@ -0,0 +1,197 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd, umask, mkdir
+from anuga.utilities.polygon import Polygon_function
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+
+
+name= 'gradual_lagoon'
+
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [2, -2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            length = (crest[i]+500)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+##        output_dir = 'c:'+sep+'anuga_data'+sep
+        output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gradual_lagoon'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_gradual_lagoon'+sep
+        sww_file = str(name)
+
+        copy_code_files(output_dir,__file__,__file__)
+    
+        start_screen_catcher(output_dir)
+        
+        dx = dy = .5           # Resolution: Length of subdivisions on both axes
+        boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+        interior_polygon = [[140,0],[280+crest[i],0],[280+crest[i],20],[140,20]]
+        interior_polygon2 =[[290+crest[i],0],[499+crest[i],0],[499+crest[i],20],[290+crest[i],20]]
+        interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+        meshname = str(name)+'.msh'
+        create_mesh_from_regions(boundary_polygon,
+                                 boundary_tags={'bottom': [0],
+                                                'right': [1],
+                                                'top': [2],
+                                                'left': [3]},
+                                 maximum_triangle_area=50,
+                                 filename=meshname,
+                                 interior_regions=interior_regions,
+                                 use_cache=False,
+                                 verbose=False)
+
+        domain = Domain(meshname, use_cache=False, verbose=True)
+
+        print 'Number of triangles = ', len(domain)
+        print 'The extent is ', domain.get_extent()
+        print domain.statistics()
+         
+        domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+        domain.set_minimum_storable_height(0.01)
+        domain.set_default_order(2) # Second order spatial approximation
+        domain.set_name(sww_file)   # Output name
+        domain.set_datadir(output_dir)  
+
+
+        #------------------------------------------------------------------------------
+        # Setup initial conditions
+        #------------------------------------------------------------------------------
+
+        def topography(x,y):
+            """Complex topography defined by a function of vectors x and y
+            """
+
+            z =(-0.026*x)+(0.026*(220+crest[i]))+crestdepth[k]-4         
+            N = len (x)
+            for j in range(N):
+
+                if x[j] < 180:
+                    z[j] = -4+crestdepth[k] 
+                
+                elif 179 < x[j] < 200:
+                    z[j] = 0.2*x[j]-40+crestdepth[k]
+                    
+                    ##Crest
+                elif 199 < x[j] < (200+crest[i]):
+                    z[j] = +crestdepth[k]
+                    
+                 #Curve down
+                elif (199+crest[i]) < x[j] < (220+crest[i]):
+                    z[j] = -0.01*(x[j]-(199+crest[i]))*(x[j]-(199+crest[i]))+crestdepth[k]
+                
+            return z
+           
+
+
+        domain.set_quantity('elevation', topography) # Use function for elevation
+##        domain.set_quantity('friction', 0)         # Constant friction
+        domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+        domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+        #------------------------------------------------------------------------------
+        # Setup boundary conditions
+        #------------------------------------------------------------------------------
+
+        from math import sin, pi, exp, cos, cosh, sqrt 
+        Br = Reflective_boundary(domain)      # Solid reflective wall
+        Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+        Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+        Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                           f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+        g = 9.81
+        offshore_depth = 17
+        H_d_ratio = 0.116
+        Xo = 17500
+        po = 0.0002
+        def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+        Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+        # Associate boundary tags with boundary objects
+        domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+        #------------------------------------------------------------------------------
+        # Evolve system through time
+        #------------------------------------------------------------------------------
+
+        for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+            domain.write_time()
+
+            """
+        Generate time series of nominated "gauges" 
+        Note, this script will only work if pylab is installed on the platform
+
+        Inputs:
+
+        production dirs: dictionary of production directories with a
+                         association to that simulation run, eg high tide,
+                         magnitude, etc.
+                            
+        Outputs:
+
+        * figures stored in same directory as sww file
+        * time series data stored in csv files in same directory as sww file
+        * elevation at nominated gauges (elev_output)
+        """
+
+        from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+        from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+        # nominate directory location of sww file with associated attribute
+        production_dirs = {output_dir: str(name)}
+
+        # Generate figures
+        swwfiles = {}
+        for label_id in production_dirs.keys():
+            file_loc = label_id
+            swwfile = file_loc + str(name)+'.sww'
+            swwfiles[swwfile] = label_id
+            print 'hello', swwfile
+        texname, elev_output = sww2timeseries(swwfiles,
+                                                sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_lagoon.csv',
+                                              production_dirs,
+                                              report = False,
+                                              reportname = '',
+                                              plot_quantity = ['stage', 'speed'],
+                                              generate_fig = False,
+                                              surface = False,
+                                              time_min = None,
+                                              time_max = None,
+                                              #time_unit = 'secs',
+                                              title_on = True,
+                                              verbose = True)
+##        remove(output_dir+sep+str(name)+'.sww')
+
+
+
Index: /anuga_work/development/reef_0708/gradual_lagoon_big.py
===================================================================
--- /anuga_work/development/reef_0708/gradual_lagoon_big.py	(revision 5066)
+++ /anuga_work/development/reef_0708/gradual_lagoon_big.py	(revision 5066)
@@ -0,0 +1,183 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd, umask, mkdir
+from anuga.utilities.polygon import Polygon_function
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+
+
+
+crest =[50, 200, 400, 700]
+crestdepth = [-6, -4, -2, -0.5, 0, 0.5]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        length = (crest[i]+500)
+        width = 20.
+        A = 1
+        T = 1800
+        umask(002)
+        time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+        output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'mesh_test'+sep+'Big'+sep+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_big_mesh'+sep
+        sww_file = 'reef'
+
+        copy_code_files(output_dir,__file__,__file__)
+    
+        start_screen_catcher(output_dir)
+        
+        dx = dy = .5           # Resolution: Length of subdivisions on both axes
+        boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+        interior_polygon = [[170,0],[230+crest[i],0],[230+crest[i],20],[170,20]]
+        interior_polygon2 =[[231+crest[i],0],[499+crest[i],0],[499+crest[i],20],[231+crest[i],20]]
+        interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+        meshname = 'reef'+'.msh'
+        create_mesh_from_regions(boundary_polygon,
+                                 boundary_tags={'bottom': [0],
+                                                'right': [1],
+                                                'top': [2],
+                                                'left': [3]},
+                                 maximum_triangle_area=50,
+                                 filename=meshname,
+                                 interior_regions=interior_regions,
+                                 use_cache=False,
+                                 verbose=False)
+
+        domain = Domain(meshname, use_cache=False, verbose=True)
+
+        print 'Number of triangles = ', len(domain)
+        print 'The extent is ', domain.get_extent()
+        print domain.statistics()
+         
+        domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+        domain.set_minimum_storable_height(0.01)
+        domain.set_default_order(2) # Second order spatial approximation
+        domain.set_name(sww_file)   # Output name
+        domain.set_datadir(output_dir)  
+
+
+        #------------------------------------------------------------------------------
+        # Setup initial conditions
+        #------------------------------------------------------------------------------
+
+        def topography(x,y):
+            """Complex topography defined by a function of vectors x and y
+            """
+
+            z =(-0.026*x)+(0.026*(200+crest[i]))+crestdepth[k]-4         
+            N = len (x)
+            for j in range(N):
+
+                if x[j] < 180:
+                    z[j] = -4+crestdepth[k] 
+                
+                elif 179 < x[j] < 200:
+                    z[j] = 0.2*x[j]-40+crestdepth[k]
+                    
+                    ##Crest
+                elif 199 < x[j] < (200+crest[i]):
+                    z[j] = +crestdepth[k]
+                    
+                 
+                
+            return z
+           
+
+
+        domain.set_quantity('elevation', topography) # Use function for elevation
+##        domain.set_quantity('friction', 0)         # Constant friction
+        domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.),(interior_polygon ,0.05), (interior_polygon2 , 0.)] ) )#changing friction over two polygons
+        domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+        #------------------------------------------------------------------------------
+        # Setup boundary conditions
+        #------------------------------------------------------------------------------
+
+        from math import sin, pi, exp, cos 
+        Br = Reflective_boundary(domain)      # Solid reflective wall
+        Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+        Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+        Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                           f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+        A = 1
+        T = 1800
+        def waveform(t):
+             return A*sin(2*pi*(t)/T)
+        Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+        # Associate boundary tags with boundary objects
+        domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+        #------------------------------------------------------------------------------
+        # Evolve system through time
+        #------------------------------------------------------------------------------
+
+        for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+            domain.write_time()
+
+            """
+        Generate time series of nominated "gauges" 
+        Note, this script will only work if pylab is installed on the platform
+
+        Inputs:
+
+        production dirs: dictionary of production directories with a
+                         association to that simulation run, eg high tide,
+                         magnitude, etc.
+                            
+        Outputs:
+
+        * figures stored in same directory as sww file
+        * time series data stored in csv files in same directory as sww file
+        * elevation at nominated gauges (elev_output)
+        """
+
+        from os import getcwd, sep, altsep, mkdir, access, F_OK
+        from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+        # nominate directory location of sww file with associated attribute
+        production_dirs = {output_dir: 'reef'}
+
+        # Generate figures
+        swwfiles = {}
+        for label_id in production_dirs.keys():
+            file_loc = label_id
+            swwfile = file_loc + 'reef.sww'
+            swwfiles[swwfile] = label_id
+            print 'hello', swwfile
+        texname, elev_output = sww2timeseries(swwfiles,
+                                                sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'mesh_test'+sep+'gauges_mesh.csv',
+                                              production_dirs,
+                                              report = False,
+                                              reportname = '',
+                                              plot_quantity = ['stage', 'speed'],
+                                              generate_fig = False,
+                                              surface = False,
+                                              time_min = None,
+                                              time_max = None,
+                                              #time_unit = 'secs',
+                                              title_on = True,
+                                              verbose = True)
+
Index: /anuga_work/development/reef_0708/gradual_lagoon_med.py
===================================================================
--- /anuga_work/development/reef_0708/gradual_lagoon_med.py	(revision 5066)
+++ /anuga_work/development/reef_0708/gradual_lagoon_med.py	(revision 5066)
@@ -0,0 +1,182 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd, umask, mkdir
+from anuga.utilities.polygon import Polygon_function
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+
+
+
+crest =[50, 200, 400, 700]
+crestdepth = [-6, -4, -2, -0.5, 0, 0.5]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        length = (crest[i]+500)
+        width = 20.
+        A = 1
+        T = 1800
+        umask(002)
+        time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+        output_dir =    sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'mesh_test'+sep+'Med'+sep+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_med_mesh'+sep
+        sww_file = 'reef'
+
+        copy_code_files(output_dir,__file__,__file__)
+    
+        start_screen_catcher(output_dir)
+        
+        dx = dy = .5           # Resolution: Length of subdivisions on both axes
+        boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+        interior_polygon = [[170,0],[230+crest[i],0],[230+crest[i],20],[170,20]]
+        interior_polygon2 =[[231+crest[i],0],[499+crest[i],0],[499+crest[i],20],[231+crest[i],20]]
+        interior_regions = [[interior_polygon, 2], [interior_polygon2, 12.5]]
+        meshname = 'reef'+'.msh'
+        create_mesh_from_regions(boundary_polygon,
+                                 boundary_tags={'bottom': [0],
+                                                'right': [1],
+                                                'top': [2],
+                                                'left': [3]},
+                                 maximum_triangle_area=12.5,
+                                 filename=meshname,
+                                 interior_regions=interior_regions,
+                                 use_cache=False,
+                                 verbose=False)
+
+        domain = Domain(meshname, use_cache=False, verbose=True)
+
+        print 'Number of triangles = ', len(domain)
+        print 'The extent is ', domain.get_extent()
+        print domain.statistics()
+         
+        domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+        domain.set_minimum_storable_height(0.01)
+        domain.set_name(sww_file)# Output name
+        domain.set_datadir(output_dir)  
+
+
+        #------------------------------------------------------------------------------
+        # Setup initial conditions
+        #------------------------------------------------------------------------------
+
+        def topography(x,y):
+            """Complex topography defined by a function of vectors x and y
+            """
+
+            z =(-0.026*x)+(0.026*(200+crest[i]))+crestdepth[k]-4         
+            N = len (x)
+            for j in range(N):
+
+                if x[j] < 180:
+                    z[j] = -4+crestdepth[k] 
+                
+                elif 179 < x[j] < 200:
+                    z[j] = 0.2*x[j]-40+crestdepth[k]
+                    
+                    ##Crest
+                elif 199 < x[j] < (200+crest[i]):
+                    z[j] = +crestdepth[k]
+                    
+                 
+                
+            return z
+           
+
+
+        domain.set_quantity('elevation', topography) # Use function for elevation
+##        domain.set_quantity('friction', 0)         # Constant friction
+        domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.),(interior_polygon ,0.05), (interior_polygon2 , 0.)] ) )#changing friction over two polygons
+        domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+        #------------------------------------------------------------------------------
+        # Setup boundary conditions
+        #------------------------------------------------------------------------------
+
+        from math import sin, pi, exp, cos 
+        Br = Reflective_boundary(domain)      # Solid reflective wall
+        Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+        Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+        Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                           f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+        A = 1
+        T = 1800
+        def waveform(t):
+             return A*sin(2*pi*(t)/T)
+        Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+        # Associate boundary tags with boundary objects
+        domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+        #------------------------------------------------------------------------------
+        # Evolve system through time
+        #------------------------------------------------------------------------------
+
+        for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+            domain.write_time()
+
+            """
+        Generate time series of nominated "gauges" 
+        Note, this script will only work if pylab is installed on the platform
+
+        Inputs:
+
+        production dirs: dictionary of production directories with a
+                         association to that simulation run, eg high tide,
+                         magnitude, etc.
+                            
+        Outputs:
+
+        * figures stored in same directory as sww file
+        * time series data stored in csv files in same directory as sww file
+        * elevation at nominated gauges (elev_output)
+        """
+
+        from os import getcwd, sep, altsep, mkdir, access, F_OK
+        from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+        # nominate directory location of sww file with associated attribute
+        production_dirs = {output_dir: 'reef'}
+
+        # Generate figures
+        swwfiles = {}
+        for label_id in production_dirs.keys():
+            file_loc = label_id
+            swwfile = file_loc + 'reef.sww'
+            swwfiles[swwfile] = label_id
+            print 'hello', swwfile
+        texname, elev_output = sww2timeseries(swwfiles,
+                                                sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'mesh_test'+sep+'gauges_mesh.csv',
+                                              production_dirs,
+                                              report = False,
+                                              reportname = '',
+                                              plot_quantity = ['stage', 'speed'],
+                                              generate_fig = False,
+                                              surface = False,
+                                              time_min = None,
+                                              time_max = None,
+                                              #time_unit = 'secs',
+                                              title_on = True,
+                                              verbose = True)
+
Index: /anuga_work/development/reef_0708/gradual_lagoon_test.py
===================================================================
--- /anuga_work/development/reef_0708/gradual_lagoon_test.py	(revision 5066)
+++ /anuga_work/development/reef_0708/gradual_lagoon_test.py	(revision 5066)
@@ -0,0 +1,183 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd, umask, mkdir
+from anuga.utilities.polygon import Polygon_function
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+
+
+
+crest =[50]
+crestdepth = [0.5, 0, -0.5, -4, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        length = (crest[i]+500)
+        width = 20.
+        A = 1
+        T = 1800
+        umask(002)
+        time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+        output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_big_mesh'+sep
+        sww_file = 'reef'
+
+        copy_code_files(output_dir,__file__,__file__)
+    
+        start_screen_catcher(output_dir)
+        
+        dx = dy = .5           # Resolution: Length of subdivisions on both axes
+        boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+        interior_polygon = [[170,0],[230+crest[i],0],[230+crest[i],20],[170,20]]
+        interior_polygon2 =[[231+crest[i],0],[499+crest[i],0],[499+crest[i],20],[231+crest[i],20]]
+##        interior_regions = [[interior_polygon, 1250], [interior_polygon2, 1250]]
+        meshname = 'reef'+'.msh'
+        create_mesh_from_regions(boundary_polygon,
+                                 boundary_tags={'bottom': [0],
+                                                'right': [1],
+                                                'top': [2],
+                                                'left': [3]},
+                                 maximum_triangle_area=1250,
+                                 filename=meshname,
+##                                 interior_regions=interior_regions,
+                                 use_cache=False,
+                                 verbose=False)
+
+        domain = Domain(meshname, use_cache=False, verbose=True)
+
+        print 'Number of triangles = ', len(domain)
+        print 'The extent is ', domain.get_extent()
+        print domain.statistics()
+         
+        domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+        domain.set_minimum_storable_height(0.01)
+        domain.set_default_order(2) # Second order spatial approximation
+        domain.set_name(sww_file)   # Output name
+        domain.set_datadir(output_dir)  
+
+
+        #------------------------------------------------------------------------------
+        # Setup initial conditions
+        #------------------------------------------------------------------------------
+
+        def topography(x,y):
+            """Complex topography defined by a function of vectors x and y
+            """
+
+            z =(-0.026*x)+(0.026*(200+crest[i]))+crestdepth[k]-4         
+            N = len (x)
+            for j in range(N):
+
+                if x[j] < 180:
+                    z[j] = -4+crestdepth[k] 
+                
+                elif 179 < x[j] < 200:
+                    z[j] = 0.2*x[j]-40+crestdepth[k]
+                    
+                    ##Crest
+                elif 199 < x[j] < (200+crest[i]):
+                    z[j] = +crestdepth[k]
+                    
+                 
+                
+            return z
+           
+
+
+        domain.set_quantity('elevation', topography) # Use function for elevation
+##        domain.set_quantity('friction', 0)         # Constant friction
+        domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.),(interior_polygon ,0.05), (interior_polygon2 , 0.)] ) )#changing friction over two polygons
+        domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+        #------------------------------------------------------------------------------
+        # Setup boundary conditions
+        #------------------------------------------------------------------------------
+
+        from math import sin, pi, exp, cos 
+        Br = Reflective_boundary(domain)      # Solid reflective wall
+        Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+        Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+        Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                           f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+        A = 1
+        T = 1800
+        def waveform(t):
+             return A*sin(2*pi*(t)/T)
+        Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+        # Associate boundary tags with boundary objects
+        domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+        #------------------------------------------------------------------------------
+        # Evolve system through time
+        #------------------------------------------------------------------------------
+
+        for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+            domain.write_time()
+
+            """
+        Generate time series of nominated "gauges" 
+        Note, this script will only work if pylab is installed on the platform
+
+        Inputs:
+
+        production dirs: dictionary of production directories with a
+                         association to that simulation run, eg high tide,
+                         magnitude, etc.
+                            
+        Outputs:
+
+        * figures stored in same directory as sww file
+        * time series data stored in csv files in same directory as sww file
+        * elevation at nominated gauges (elev_output)
+        """
+
+        from os import getcwd, sep, altsep, mkdir, access, F_OK
+        from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+        # nominate directory location of sww file with associated attribute
+        production_dirs = {output_dir: 'reef'}
+
+        # Generate figures
+        swwfiles = {}
+        for label_id in production_dirs.keys():
+            file_loc = label_id
+            swwfile = file_loc + 'reef.sww'
+            swwfiles[swwfile] = label_id
+            print 'hello', swwfile
+        texname, elev_output = sww2timeseries(swwfiles,
+                                                sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'mesh_test'+sep+'gauges_mesh.csv',
+                                              production_dirs,
+                                              report = False,
+                                              reportname = '',
+                                              plot_quantity = ['stage', 'speed'],
+                                              generate_fig = False,
+                                              surface = False,
+                                              time_min = None,
+                                              time_max = None,
+                                              #time_unit = 'secs',
+                                              title_on = True,
+                                              verbose = True)
+
Index: /anuga_work/development/reef_0708/gradual_lgflat.py
===================================================================
--- /anuga_work/development/reef_0708/gradual_lgflat.py	(revision 5066)
+++ /anuga_work/development/reef_0708/gradual_lgflat.py	(revision 5066)
@@ -0,0 +1,197 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='gradual_lgflat'
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [2, -2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            length = (crest[i]+2500)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+##            output_dir = 'c:'+sep+'anuga_data'+sep
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gradual_lgflat'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_'+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[2280+crest[i],0],[2280+crest[i],20],[140,20]]
+            interior_polygon2 =[[2290+crest[i],0],[2499+crest[i],0],[2499+crest[i],20],[2290+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=False, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)   # Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.026*x)+(0.026*(2220+crest[i]))+crestdepth[k]-4        
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        #Reef Flat
+                    elif 199 < x[j] < 2200:
+                        z[j] = -0.5+crestdepth[k]
+                        ##Crest
+                    elif 2199 < x[j] < (2200+crest[i]):
+                        z[j] = +crestdepth[k]
+                       
+    ##                      
+                     #Curve down
+                    elif (2199+crest[i]) < x[j] < (2220+crest[i]):
+                        z[j] = -0.01*(x[j]-(2199+crest[i]))*(x[j]-(2199+crest[i]))+crestdepth[k]
+                        
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 17
+            H_d_ratio = 0.116
+            Xo = 17500
+            po = 0.0002
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+                domain.write_time()
+                print   domain.timestepping_statistics(track_speeds=True)
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_lgflat.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
+
Index: /anuga_work/development/reef_0708/gradual_smflat.py
===================================================================
--- /anuga_work/development/reef_0708/gradual_smflat.py	(revision 5066)
+++ /anuga_work/development/reef_0708/gradual_smflat.py	(revision 5066)
@@ -0,0 +1,193 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name= 'gradual_smflat'
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [2, -2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            length = (crest[i]+1000)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gradual_smflat'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_'+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[140,20]]
+            interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)   # Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.026*x)+(0.026*(720+crest[i]))+crestdepth[k]-4        
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        #Reef Flat
+                    elif 199 < x[j] < 700:
+                        z[j] = -0.5+crestdepth[k]
+                        ##Crest
+                    elif 699 < x[j] < (700+crest[i]):
+                        z[j] = +crestdepth[k]
+                       
+                        #Curve down
+                    elif (699+crest[i]) < x[j] < (720+crest[i]):
+                        z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 17
+            H_d_ratio = 0.116
+            Xo = 17500
+            po = 0.0002
+            def waveform(t):
+                    return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/reef_0708/mesh.py
===================================================================
--- /anuga_work/development/reef_0708/mesh.py	(revision 5066)
+++ /anuga_work/development/reef_0708/mesh.py	(revision 5066)
@@ -0,0 +1,182 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd, umask, mkdir
+from anuga.utilities.polygon import Polygon_function
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+
+
+
+crest =[50, 200, 400, 700]
+crestdepth = [-6, -4, -2, -0.5, 0, 0.5]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        length = (crest[i]+500)
+        width = 20.
+        A = 1
+        T = 1800
+        umask(002)
+        time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+        output_dir =    sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'mesh_test'+sep+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_mesh'+sep
+        sww_file = 'reef'
+
+        copy_code_files(output_dir,__file__,__file__)
+    
+        start_screen_catcher(output_dir)
+        
+        dx = dy = .5           # Resolution: Length of subdivisions on both axes
+        boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+        interior_polygon = [[190+crest[i],0],[225+crest[i],0],[225+crest[i],20],[190+crest[i],20]]
+        interior_polygon2 =[[231+crest[i],0],[499+crest[i],0],[499+crest[i],20],[231+crest[i],20]]
+        interior_regions = [[interior_polygon, 1], [interior_polygon2, 12.5]]
+        meshname = 'reef'+'.msh'
+        create_mesh_from_regions(boundary_polygon,
+                                 boundary_tags={'bottom': [0],
+                                                'right': [1],
+                                                'top': [2],
+                                                'left': [3]},
+                                 maximum_triangle_area=12.5,
+                                 filename=meshname,
+                                 interior_regions=interior_regions,
+                                 use_cache=False,
+                                 verbose=False)
+
+        domain = Domain(meshname, use_cache=False, verbose=True)
+
+        print 'Number of triangles = ', len(domain)
+        print 'The extent is ', domain.get_extent()
+        print domain.statistics()
+         
+        domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+        domain.set_minimum_storable_height(0.01)
+        domain.set_name(sww_file)# Output name
+        domain.set_datadir(output_dir)  
+
+
+        #------------------------------------------------------------------------------
+        # Setup initial conditions
+        #------------------------------------------------------------------------------
+
+        def topography(x,y):
+            """Complex topography defined by a function of vectors x and y
+            """
+
+            z =(-0.026*x)+(0.026*(200+crest[i]))+crestdepth[k]-4         
+            N = len (x)
+            for j in range(N):
+
+                if x[j] < 180:
+                    z[j] = -4+crestdepth[k] 
+                
+                elif 179 < x[j] < 200:
+                    z[j] = 0.2*x[j]-40+crestdepth[k]
+                    
+                    ##Crest
+                elif 199 < x[j] < (200+crest[i]):
+                    z[j] = +crestdepth[k]
+                    
+                 
+                
+            return z
+           
+
+
+        domain.set_quantity('elevation', topography) # Use function for elevation
+##        domain.set_quantity('friction', 0)         # Constant friction
+        domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.),(interior_polygon ,0.05), (interior_polygon2 , 0.)] ) )#changing friction over two polygons
+        domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+        #------------------------------------------------------------------------------
+        # Setup boundary conditions
+        #------------------------------------------------------------------------------
+
+        from math import sin, pi, exp, cos 
+        Br = Reflective_boundary(domain)      # Solid reflective wall
+        Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+        Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+        Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                           f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+        A = 1
+        T = 1800
+        def waveform(t):
+             return A*sin(2*pi*(t)/T)
+        Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+        # Associate boundary tags with boundary objects
+        domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+        #------------------------------------------------------------------------------
+        # Evolve system through time
+        #------------------------------------------------------------------------------
+
+        for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+            domain.write_time()
+
+            """
+        Generate time series of nominated "gauges" 
+        Note, this script will only work if pylab is installed on the platform
+
+        Inputs:
+
+        production dirs: dictionary of production directories with a
+                         association to that simulation run, eg high tide,
+                         magnitude, etc.
+                            
+        Outputs:
+
+        * figures stored in same directory as sww file
+        * time series data stored in csv files in same directory as sww file
+        * elevation at nominated gauges (elev_output)
+        """
+
+        from os import getcwd, sep, altsep, mkdir, access, F_OK
+        from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+        # nominate directory location of sww file with associated attribute
+        production_dirs = {output_dir: 'reef'}
+
+        # Generate figures
+        swwfiles = {}
+        for label_id in production_dirs.keys():
+            file_loc = label_id
+            swwfile = file_loc + 'reef.sww'
+            swwfiles[swwfile] = label_id
+            print 'hello', swwfile
+        texname, elev_output = sww2timeseries(swwfiles,
+                                                sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'mesh_test'+sep+'gauges_mesh.csv',
+                                              production_dirs,
+                                              report = False,
+                                              reportname = '',
+                                              plot_quantity = ['stage', 'speed'],
+                                              generate_fig = False,
+                                              surface = False,
+                                              time_min = None,
+                                              time_max = None,
+                                              #time_unit = 'secs',
+                                              title_on = True,
+                                              verbose = True)
+
Index: /anuga_work/development/reef_0708/steep_lagoon.py
===================================================================
--- /anuga_work/development/reef_0708/steep_lagoon.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_lagoon.py	(revision 5066)
@@ -0,0 +1,192 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_lagoon'
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [2, -2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            length = (crest[i]+500)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'steep_lagoon'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_'+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[280+crest[i],0],[280+crest[i],20],[140,20]]
+            interior_polygon2 =[[290+crest[i],0],[499+crest[i],0],[499+crest[i],20],[290+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)   # Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.84*x)+(0.84*(220+crest[i]))+crestdepth[k]-4         
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        
+                        ##Crest
+                    elif 199 < x[j] < (200+crest[i]):
+                        z[j] = +crestdepth[k]
+                        
+                     #Curve down
+                    elif (199+crest[i]) < x[j] < (220+crest[i]):
+                        z[j] = -0.01*(x[j]-(199+crest[i]))*(x[j]-(199+crest[i]))+crestdepth[k]
+                    
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 250
+            H_d_ratio = 0.008
+            Xo = 67000
+            po = 0.03
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_lagoon.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/reef_0708/steep_lgflat.py
===================================================================
--- /anuga_work/development/reef_0708/steep_lgflat.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_lgflat.py	(revision 5066)
@@ -0,0 +1,194 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_lgflat'
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [2, -2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            length = (crest[i]+2500)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'steep_lgflat'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_'+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[2280+crest[i],0],[2280+crest[i],20],[140,20]]
+            interior_polygon2 =[[2290+crest[i],0],[2499+crest[i],0],[2499+crest[i],20],[2290+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)   # Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.84*x)+(0.84*(2220+crest[i]))+crestdepth[k]-4        
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        #Reef Flat
+                    elif 199 < x[j] < 2200:
+                        z[j] = -0.5+crestdepth[k]
+                        ##Crest
+                    elif 2199 < x[j] < (2200+crest[i]):
+                        z[j] = +crestdepth[k]
+                       
+    ##                     #Curve down
+                    elif (2199+crest[i]) < x[j] < (2220+crest[i]):
+                        z[j] = -0.01*(x[j]-(2199+crest[i]))*(x[j]-(2199+crest[i]))+crestdepth[k]                    
+
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 250
+            H_d_ratio = 0.008
+            Xo = 67000
+            po = 0.03
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_lgflat.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/reef_0708/steep_smflat.py
===================================================================
--- /anuga_work/development/reef_0708/steep_smflat.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_smflat.py	(revision 5066)
@@ -0,0 +1,193 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_smflat_topography'
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 250, 450, 650]
+crestdepth = [1, 0, -1, -3, -5]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (crest[i]+1000)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'topography'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[140,20]]
+            interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=False, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.84*x)+(0.84*(720+crest[i]))+crestdepth[k]-4        
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        #Reef Flat
+                    elif 199 < x[j] < 700:
+                        z[j] = -0.5+crestdepth[k]
+                        ##Crest
+                    elif 699 < x[j] < (700+crest[i]):
+                        z[j] = +crestdepth[k]
+
+                       #Curve down
+                    elif (699+crest[i]) < x[j] < (720+crest[i]):
+                        z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 250
+            H_d_ratio = 0.008
+            Xo = 67000
+            po = 0.03
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/reef_0708/steep_smflat_900.py
===================================================================
--- /anuga_work/development/reef_0708/steep_smflat_900.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_smflat_900.py	(revision 5066)
@@ -0,0 +1,194 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_smflat_900'
+wave = [0.5, 1, 2, 4, -0.5, -1, -2, -4] 
+crest =[50, 450]
+crestdepth = [1, -3]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (crest[i]+1000)
+            width = 20.
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'wave_testers'+sep+'wave_value'+sep+str(length)+'_'+str(wave[l])+'_'+str(crestdepth[k])+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[170,20]]
+            interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.84*x)+(0.84*(700+crest[i]))+crestdepth[k]-4        
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        #Reef Flat
+                    elif 199 < x[j] < 700:
+                        z[j] = -0.5+crestdepth[k]
+                        ##Crest
+                    elif 699 < x[j] < (700+crest[i]):
+                        z[j] = +crestdepth[k]
+
+                       #Curve down
+                    elif (699+crest[i]) < x[j] < (720+crest[i]):
+                        z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 250
+            H_d_ratio = 0.008
+            Xo = 22000
+            po = 0.35
+            def waveform(t):
+                    return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            print (output_dir+sep+str(name)+'.sww')
+##            remove(output_dir+sep+str(name)+'.sww')
+          
+
+
+
+
Index: /anuga_work/development/reef_0708/steep_smflat_con_crest.py
===================================================================
--- /anuga_work/development/reef_0708/steep_smflat_con_crest.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_smflat_con_crest.py	(revision 5066)
@@ -0,0 +1,204 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_smflat_con2'
+wave = [0.5, 2]
+period = [900, 2700]
+crest =[50, 450]
+crestdepth = [1, -3]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            E = len(period)
+            for w in range(E):
+##                def waveform_con1(t):
+##                    return wave[l]*1.6*sin(2*pi*t/period[w])*exp(-t/(period[w]*1200))
+##                def waveform_con2(t):
+##                    return wave[l]*1.17*sin(2*pi*t/period[w])*exp(-t/(period[w]*1200))
+##                def waveform_sin(t):
+##                    return wave[l]*sin(pi*2*t/period[w])
+            
+
+                length = (crest[i]+1000)
+                width = 20.
+                umask(002)
+                time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+                output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'wave_testers'+sep+'wave_type'+sep+str(length)+'_'+str(wave[l])+'_'+str(crestdepth[k])+'_'+str(period[w])+'_'+str(name)+sep
+                sww_file = str(name)
+                copy_code_files(output_dir,__file__,__file__)
+
+                start_screen_catcher(output_dir)
+                dx = dy = .5           # Resolution: Length of subdivisions on both axes
+                boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+                interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[170,20]]
+                interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+                interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+                meshname = str(name)+'.msh'
+                create_mesh_from_regions(boundary_polygon,
+                                         boundary_tags={'bottom': [0],
+                                                        'right': [1],
+                                                        'top': [2],
+                                                        'left': [3]},
+                                         maximum_triangle_area=50,
+                                         filename=meshname,
+                                         interior_regions=interior_regions,
+                                         use_cache=False,
+                                         verbose=False)
+
+                domain = Domain(meshname, use_cache=True, verbose=True)
+
+                print 'Number of triangles = ', len(domain)
+                print 'The extent is ', domain.get_extent()
+                print domain.statistics()
+                 
+                domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+                domain.set_minimum_storable_height(0.01)
+                domain.set_default_order(2) # Second order spatial approximation
+                domain.set_name(sww_file)# Output name
+                domain.set_datadir(output_dir)  
+
+
+                #------------------------------------------------------------------------------
+                # Setup initial conditions
+                #------------------------------------------------------------------------------
+
+                def topography(x,y):
+                    """Complex topography defined by a function of vectors x and y
+                    """
+
+                    z =(-0.84*x)+(0.84*(700+crest[i]))+crestdepth[k]-4        
+                    N = len (x)
+                    for j in range(N):
+
+                        if x[j] < 180:
+                            z[j] = -4+crestdepth[k] 
+                        
+                        elif 179 < x[j] < 200:
+                            z[j] = 0.2*x[j]-40+crestdepth[k]
+                            #Reef Flat
+                        elif 199 < x[j] < 700:
+                            z[j] = -0.5+crestdepth[k]
+                            ##Crest
+                        elif 699 < x[j] < (700+crest[i]):
+                            z[j] = +crestdepth[k]
+
+                           #Curve down
+                        elif (699+crest[i]) < x[j] < (720+crest[i]):
+                            z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+
+                    return z
+                   
+
+
+                domain.set_quantity('elevation', topography) # Use function for elevation
+        ##        domain.set_quantity('friction', 0)         # Constant friction
+                domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+                domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+                #------------------------------------------------------------------------------
+                # Setup boundary conditions
+                #------------------------------------------------------------------------------
+
+                from math import sin, pi, exp, cos, cosh, sqrt 
+                Br = Reflective_boundary(domain)      # Solid reflective wall
+                Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+                Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+                Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                                   f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+
+                def waveform_con2(t):
+                    return wave[l]*2.1*sin(2*pi*t/period[w])*exp(-t/(period[w]))
+                
+                Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform_con2)
+                # Associate boundary tags with boundary objects
+                domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+
+                #------------------------------------------------------------------------------
+                # Evolve system through time
+                #------------------------------------------------------------------------------
+
+                for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                    domain.write_time()
+
+                    """
+                Generate time series of nominated "gauges" 
+                Note, this script will only work if pylab is installed on the platform
+
+                Inputs:
+
+                production dirs: dictionary of production directories with a
+                                 association to that simulation run, eg high tide,
+                                 magnitude, etc.
+                                    
+                Outputs:
+
+                * figures stored in same directory as sww file
+                * time series data stored in csv files in same directory as sww file
+                * elevation at nominated gauges (elev_output)
+                """
+
+                from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+                from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+                # nominate directory location of sww file with associated attribute
+                production_dirs = {output_dir: str(name)}
+
+                # Generate figures
+                swwfiles = {}
+                for label_id in production_dirs.keys():
+                    file_loc = label_id
+                    swwfile = file_loc + str(name)+'.sww'
+                    swwfiles[swwfile] = label_id
+                    print 'hello', swwfile
+                texname, elev_output = sww2timeseries(swwfiles,
+                                                       sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                      production_dirs,
+                                                      report = False,
+                                                      reportname = '',
+                                                      plot_quantity = ['stage', 'speed'],
+                                                      generate_fig = False,
+                                                      surface = False,
+                                                      time_min = None,
+                                                      time_max = None,
+                                                      #time_unit = 'secs',
+                                                      title_on = True,
+                                                      verbose = True)
+##                print (output_dir+sep+str(name)+'.sww')
+##                remove(output_dir+sep+str(name)+'.sww')
+##              
+
+
+
+
+
Index: /anuga_work/development/reef_0708/steep_smflat_con_depr.py
===================================================================
--- /anuga_work/development/reef_0708/steep_smflat_con_depr.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_smflat_con_depr.py	(revision 5066)
@@ -0,0 +1,204 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_smflat_con1'
+wave = [-0.5, -2]
+period = [900, 2700]
+crest =[50, 450]
+crestdepth = [1, -3]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            E = len(period)
+            for w in range(E):
+##                def waveform_con1(t):
+##                    return wave[l]*1.6*sin(2*pi*t/period[w])*exp(-t/(period[w]*1200))
+##                def waveform_con2(t):
+##                    return wave[l]*1.17*sin(2*pi*t/period[w])*exp(-t/(period[w]*1200))
+##                def waveform_sin(t):
+##                    return wave[l]*sin(pi*2*t/period[w])
+            
+
+                length = (crest[i]+1000)
+                width = 20.
+                umask(002)
+                time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+                output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'wave_testers'+sep+'wave_type'+sep+str(length)+'_'+str(wave[l])+'_'+str(crestdepth[k])+'_'+str(period[w])+'_'+str(name)+sep
+                sww_file = str(name)
+                copy_code_files(output_dir,__file__,__file__)
+
+                start_screen_catcher(output_dir)
+                dx = dy = .5           # Resolution: Length of subdivisions on both axes
+                boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+                interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[170,20]]
+                interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+                interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+                meshname = str(name)+'.msh'
+                create_mesh_from_regions(boundary_polygon,
+                                         boundary_tags={'bottom': [0],
+                                                        'right': [1],
+                                                        'top': [2],
+                                                        'left': [3]},
+                                         maximum_triangle_area=50,
+                                         filename=meshname,
+                                         interior_regions=interior_regions,
+                                         use_cache=False,
+                                         verbose=False)
+
+                domain = Domain(meshname, use_cache=True, verbose=True)
+
+                print 'Number of triangles = ', len(domain)
+                print 'The extent is ', domain.get_extent()
+                print domain.statistics()
+                 
+                domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+                domain.set_minimum_storable_height(0.01)
+                domain.set_default_order(2) # Second order spatial approximation
+                domain.set_name(sww_file)# Output name
+                domain.set_datadir(output_dir)  
+
+
+                #------------------------------------------------------------------------------
+                # Setup initial conditions
+                #------------------------------------------------------------------------------
+
+                def topography(x,y):
+                    """Complex topography defined by a function of vectors x and y
+                    """
+
+                    z =(-0.84*x)+(0.84*(700+crest[i]))+crestdepth[k]-4        
+                    N = len (x)
+                    for j in range(N):
+
+                        if x[j] < 180:
+                            z[j] = -4+crestdepth[k] 
+                        
+                        elif 179 < x[j] < 200:
+                            z[j] = 0.2*x[j]-40+crestdepth[k]
+                            #Reef Flat
+                        elif 199 < x[j] < 700:
+                            z[j] = -0.5+crestdepth[k]
+                            ##Crest
+                        elif 699 < x[j] < (700+crest[i]):
+                            z[j] = +crestdepth[k]
+
+                           #Curve down
+                        elif (699+crest[i]) < x[j] < (720+crest[i]):
+                            z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+
+                    return z
+                   
+
+
+                domain.set_quantity('elevation', topography) # Use function for elevation
+        ##        domain.set_quantity('friction', 0)         # Constant friction
+                domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+                domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+                #------------------------------------------------------------------------------
+                # Setup boundary conditions
+                #------------------------------------------------------------------------------
+
+                from math import sin, pi, exp, cos, cosh, sqrt 
+                Br = Reflective_boundary(domain)      # Solid reflective wall
+                Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+                Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+                Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                                   f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+
+                def waveform_con1(t):
+                    return wave[l]*2.1*sin(2*pi*t/period[w])*exp(-t/(period[w]))
+                
+                Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform_con1)
+                # Associate boundary tags with boundary objects
+                domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+
+                #------------------------------------------------------------------------------
+                # Evolve system through time
+                #------------------------------------------------------------------------------
+
+                for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                    domain.write_time()
+
+                    """
+                Generate time series of nominated "gauges" 
+                Note, this script will only work if pylab is installed on the platform
+
+                Inputs:
+
+                production dirs: dictionary of production directories with a
+                                 association to that simulation run, eg high tide,
+                                 magnitude, etc.
+                                    
+                Outputs:
+
+                * figures stored in same directory as sww file
+                * time series data stored in csv files in same directory as sww file
+                * elevation at nominated gauges (elev_output)
+                """
+
+                from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+                from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+                # nominate directory location of sww file with associated attribute
+                production_dirs = {output_dir: str(name)}
+
+                # Generate figures
+                swwfiles = {}
+                for label_id in production_dirs.keys():
+                    file_loc = label_id
+                    swwfile = file_loc + str(name)+'.sww'
+                    swwfiles[swwfile] = label_id
+                    print 'hello', swwfile
+                texname, elev_output = sww2timeseries(swwfiles,
+                                                       sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                      production_dirs,
+                                                      report = False,
+                                                      reportname = '',
+                                                      plot_quantity = ['stage', 'speed'],
+                                                      generate_fig = False,
+                                                      surface = False,
+                                                      time_min = None,
+                                                      time_max = None,
+                                                      #time_unit = 'secs',
+                                                      title_on = True,
+                                                      verbose = True)
+##                print (output_dir+sep+str(name)+'.sww')
+##                remove(output_dir+sep+str(name)+'.sww')
+##              
+
+
+
+
+
Index: /anuga_work/development/reef_0708/steep_smflat_friction.py
===================================================================
--- /anuga_work/development/reef_0708/steep_smflat_friction.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_smflat_friction.py	(revision 5066)
@@ -0,0 +1,197 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_smflat_friction'
+friction =[0, 0.02, 0.05, 0.1, 0.2, 0.3]
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [2, -2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        O = len (friction)
+        for h in range (O):
+            B = len(wave)
+            for l in range(B): 
+                length = (crest[i]+1000)
+                width = 20.
+                A = 1
+                T = 2700
+                umask(002)
+                time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+                output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'friction'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_'+str(friction[h])+'_'+str(name)+sep
+                sww_file = str(name)
+                copy_code_files(output_dir,__file__,__file__)
+
+                start_screen_catcher(output_dir)
+                dx = dy = .5           # Resolution: Length of subdivisions on both axes
+                boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+                interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[140,20]]
+                interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+                interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+                meshname = 'reef'+'.msh'
+                create_mesh_from_regions(boundary_polygon,
+                                         boundary_tags={'bottom': [0],
+                                                        'right': [1],
+                                                        'top': [2],
+                                                        'left': [3]},
+                                         maximum_triangle_area=50,
+                                         filename=meshname,
+                                         interior_regions=interior_regions,
+                                         use_cache=False,
+                                         verbose=False)
+
+                domain = Domain(meshname, use_cache=False, verbose=True)
+
+                print 'Number of triangles = ', len(domain)
+                print 'The extent is ', domain.get_extent()
+                print domain.statistics()
+                 
+                domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+                domain.set_minimum_storable_height(0.01)
+                domain.set_default_order(2) # Second order spatial approximation
+                domain.set_name(sww_file)# Output name
+                domain.set_datadir(output_dir)  
+
+
+                #------------------------------------------------------------------------------
+                # Setup initial conditions
+                #------------------------------------------------------------------------------
+
+                def topography(x,y):
+                    """Complex topography defined by a function of vectors x and y
+                    """
+
+                    z =(-0.84*x)+(0.84*(720+crest[i]))+crestdepth[k]-4        
+                    N = len (x)
+                    for j in range(N):
+
+                        if x[j] < 180:
+                            z[j] = -4+crestdepth[k] 
+                        
+                        elif 179 < x[j] < 200:
+                            z[j] = 0.2*x[j]-40+crestdepth[k]
+                            #Reef Flat
+                        elif 199 < x[j] < 700:
+                            z[j] = -0.5+crestdepth[k]
+                            ##Crest
+                        elif 699 < x[j] < (700+crest[i]):
+                            z[j] = +crestdepth[k]
+
+                           #Curve down
+                        elif (699+crest[i]) < x[j] < (720+crest[i]):
+                            z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+
+                    return z
+                   
+
+
+                domain.set_quantity('elevation', topography) # Use function for elevation
+        ##        domain.set_quantity('friction', 0)         # Constant friction
+                domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.),(interior_polygon ,friction[h]), (interior_polygon2 , 0.)] ) )#changing friction over two polygons
+                domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+                #------------------------------------------------------------------------------
+                # Setup boundary conditions
+                #------------------------------------------------------------------------------
+
+                from math import sin, pi, exp, cos, cosh, sqrt 
+                Br = Reflective_boundary(domain)      # Solid reflective wall
+                Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+                Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+                Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                                   f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+                g = 9.81
+                offshore_depth = 250
+                H_d_ratio = 0.008
+                Xo = 67000
+                po = 0.03
+                def waveform(t):
+                    return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+                Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+                # Associate boundary tags with boundary objects
+                domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+                #------------------------------------------------------------------------------
+                # Evolve system through time
+                #------------------------------------------------------------------------------
+
+                for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                    domain.write_time()
+
+                    """
+                Generate time series of nominated "gauges" 
+                Note, this script will only work if pylab is installed on the platform
+
+                Inputs:
+
+                production dirs: dictionary of production directories with a
+                                 association to that simulation run, eg high tide,
+                                 magnitude, etc.
+                                    
+                Outputs:
+
+                * figures stored in same directory as sww file
+                * time series data stored in csv files in same directory as sww file
+                * elevation at nominated gauges (elev_output)
+                """
+
+                from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+                from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+                # nominate directory location of sww file with associated attribute
+                production_dirs = {output_dir: str(name)}
+
+                # Generate figures
+                swwfiles = {}
+                for label_id in production_dirs.keys():
+                    file_loc = label_id
+                    swwfile = file_loc + str(name)+'.sww'
+                    swwfiles[swwfile] = label_id
+                    print 'hello', swwfile
+                texname, elev_output = sww2timeseries(swwfiles,
+                                                       sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                      production_dirs,
+                                                      report = False,
+                                                      reportname = '',
+                                                      plot_quantity = ['stage', 'speed'],
+                                                      generate_fig = False,
+                                                      surface = False,
+                                                      time_min = None,
+                                                      time_max = None,
+                                                      #time_unit = 'secs',
+                                                      title_on = True,
+                                                      verbose = True)
+##                remove(output_dir+sep+str(name)+'.sww')
+
+
+
Index: /anuga_work/development/reef_0708/steep_smflat_sin.py
===================================================================
--- /anuga_work/development/reef_0708/steep_smflat_sin.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_smflat_sin.py	(revision 5066)
@@ -0,0 +1,204 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_smflat_sin'
+wave = [0.5, 2, -0.5, -2]
+period = [900, 2700]
+crest =[50,  450]
+crestdepth = [1, -3]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            E = len(period)
+            for w in range(E):
+##                def waveform_con1(t):
+##                    return wave[l]*1.6*sin(2*pi*t/period[w])*exp(-t/(period[w]*1200))
+##                def waveform_con2(t):
+##                    return wave[l]*1.17*sin(2*pi*t/period[w])*exp(-t/(period[w]*1200))
+##                def waveform_sin(t):
+##                    return wave[l]*sin(pi*2*t/period[w])
+            
+
+                length = (crest[i]+1000)
+                width = 20.
+                umask(002)
+                time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+                output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'wave_testers'+sep+'wave_type'+sep+str(length)+'_'+str(wave[l])+'_'+str(crestdepth[k])+'_'+str(period[w])+'_'+str(name)+sep
+                sww_file = str(name)
+                copy_code_files(output_dir,__file__,__file__)
+
+                start_screen_catcher(output_dir)
+                dx = dy = .5           # Resolution: Length of subdivisions on both axes
+                boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+                interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[170,20]]
+                interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+                interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+                meshname = str(name)+'.msh'
+                create_mesh_from_regions(boundary_polygon,
+                                         boundary_tags={'bottom': [0],
+                                                        'right': [1],
+                                                        'top': [2],
+                                                        'left': [3]},
+                                         maximum_triangle_area=50,
+                                         filename=meshname,
+                                         interior_regions=interior_regions,
+                                         use_cache=False,
+                                         verbose=False)
+
+                domain = Domain(meshname, use_cache=True, verbose=True)
+
+                print 'Number of triangles = ', len(domain)
+                print 'The extent is ', domain.get_extent()
+                print domain.statistics()
+                 
+                domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+                domain.set_minimum_storable_height(0.01)
+                domain.set_default_order(2) # Second order spatial approximation
+                domain.set_name(sww_file)# Output name
+                domain.set_datadir(output_dir)  
+
+
+                #------------------------------------------------------------------------------
+                # Setup initial conditions
+                #------------------------------------------------------------------------------
+
+                def topography(x,y):
+                    """Complex topography defined by a function of vectors x and y
+                    """
+
+                    z =(-0.84*x)+(0.84*(700+crest[i]))+crestdepth[k]-4        
+                    N = len (x)
+                    for j in range(N):
+
+                        if x[j] < 180:
+                            z[j] = -4+crestdepth[k] 
+                        
+                        elif 179 < x[j] < 200:
+                            z[j] = 0.2*x[j]-40+crestdepth[k]
+                            #Reef Flat
+                        elif 199 < x[j] < 700:
+                            z[j] = -0.5+crestdepth[k]
+                            ##Crest
+                        elif 699 < x[j] < (700+crest[i]):
+                            z[j] = +crestdepth[k]
+
+                           #Curve down
+                        elif (699+crest[i]) < x[j] < (720+crest[i]):
+                            z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+
+                    return z
+                   
+
+
+                domain.set_quantity('elevation', topography) # Use function for elevation
+        ##        domain.set_quantity('friction', 0)         # Constant friction
+                domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+                domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+                #------------------------------------------------------------------------------
+                # Setup boundary conditions
+                #------------------------------------------------------------------------------
+
+                from math import sin, pi, exp, cos, cosh, sqrt 
+                Br = Reflective_boundary(domain)      # Solid reflective wall
+                Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+                Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+                Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                                   f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+
+                def waveform_sin(t):
+                    return wave[l]*sin(pi*2*t/period[w])
+                
+                Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform_sin)
+                # Associate boundary tags with boundary objects
+                domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+
+                #------------------------------------------------------------------------------
+                # Evolve system through time
+                #------------------------------------------------------------------------------
+
+                for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                    domain.write_time()
+
+                    """
+                Generate time series of nominated "gauges" 
+                Note, this script will only work if pylab is installed on the platform
+
+                Inputs:
+
+                production dirs: dictionary of production directories with a
+                                 association to that simulation run, eg high tide,
+                                 magnitude, etc.
+                                    
+                Outputs:
+
+                * figures stored in same directory as sww file
+                * time series data stored in csv files in same directory as sww file
+                * elevation at nominated gauges (elev_output)
+                """
+
+                from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+                from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+                # nominate directory location of sww file with associated attribute
+                production_dirs = {output_dir: str(name)}
+
+                # Generate figures
+                swwfiles = {}
+                for label_id in production_dirs.keys():
+                    file_loc = label_id
+                    swwfile = file_loc + str(name)+'.sww'
+                    swwfiles[swwfile] = label_id
+                    print 'hello', swwfile
+                texname, elev_output = sww2timeseries(swwfiles,
+                                                       sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                      production_dirs,
+                                                      report = False,
+                                                      reportname = '',
+                                                      plot_quantity = ['stage', 'speed'],
+                                                      generate_fig = False,
+                                                      surface = False,
+                                                      time_min = None,
+                                                      time_max = None,
+                                                      #time_unit = 'secs',
+                                                      title_on = True,
+                                                      verbose = True)
+##                print (output_dir+sep+str(name)+'.sww')
+##                remove(output_dir+sep+str(name)+'.sww')
+##              
+
+
+
+
+
Index: /anuga_work/development/reef_0708/steep_smflat_sol_900.py
===================================================================
--- /anuga_work/development/reef_0708/steep_smflat_sol_900.py	(revision 5066)
+++ /anuga_work/development/reef_0708/steep_smflat_sol_900.py	(revision 5066)
@@ -0,0 +1,209 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='steep_smflat_sol_900'
+wave = [0.5, 2]
+period = [900]
+crest =[50,  450]
+crestdepth = [1, -3]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            E = len(period)
+            for w in range(E):
+##                def waveform_con1(t):
+##                    return wave[l]*1.6*sin(2*pi*t/period[w])*exp(-t/(period[w]*1200))
+##                def waveform_con2(t):
+##                    return wave[l]*1.17*sin(2*pi*t/period[w])*exp(-t/(period[w]*1200))
+##                def waveform_sin(t):
+##                    return wave[l]*sin(pi*2*t/period[w])
+            
+
+                length = (crest[i]+1000)
+                width = 20.
+                umask(002)
+                time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+                output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'wave_testers'+sep+'wave_type'+sep+str(length)+'_'+str(wave[l])+'_'+str(crestdepth[k])+'_'+str(period[w])+'_'+str(name)+sep
+                sww_file = str(name)
+                copy_code_files(output_dir,__file__,__file__)
+
+                start_screen_catcher(output_dir)
+                dx = dy = .5           # Resolution: Length of subdivisions on both axes
+                boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+                interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[170,20]]
+                interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+                interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+                meshname = str(name)+'.msh'
+                create_mesh_from_regions(boundary_polygon,
+                                         boundary_tags={'bottom': [0],
+                                                        'right': [1],
+                                                        'top': [2],
+                                                        'left': [3]},
+                                         maximum_triangle_area=50,
+                                         filename=meshname,
+                                         interior_regions=interior_regions,
+                                         use_cache=False,
+                                         verbose=False)
+
+                domain = Domain(meshname, use_cache=False, verbose=True)
+
+                print 'Number of triangles = ', len(domain)
+                print 'The extent is ', domain.get_extent()
+                print domain.statistics()
+                 
+                domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+                domain.set_minimum_storable_height(0.01)
+                domain.set_default_order(2) # Second order spatial approximation
+                domain.set_name(sww_file)# Output name
+                domain.set_datadir(output_dir)  
+
+
+                #------------------------------------------------------------------------------
+                # Setup initial conditions
+                #------------------------------------------------------------------------------
+
+                def topography(x,y):
+                    """Complex topography defined by a function of vectors x and y
+                    """
+
+                    z =(-0.84*x)+(0.84*(700+crest[i]))+crestdepth[k]-4        
+                    N = len (x)
+                    for j in range(N):
+
+                        if x[j] < 180:
+                            z[j] = -4+crestdepth[k] 
+                        
+                        elif 179 < x[j] < 200:
+                            z[j] = 0.2*x[j]-40+crestdepth[k]
+                            #Reef Flat
+                        elif 199 < x[j] < 700:
+                            z[j] = -0.5+crestdepth[k]
+                            ##Crest
+                        elif 699 < x[j] < (700+crest[i]):
+                            z[j] = +crestdepth[k]
+
+                           #Curve down
+                        elif (699+crest[i]) < x[j] < (720+crest[i]):
+                            z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+
+                    return z
+                   
+
+
+                domain.set_quantity('elevation', topography) # Use function for elevation
+        ##        domain.set_quantity('friction', 0)         # Constant friction
+                domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+                domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+                #------------------------------------------------------------------------------
+                # Setup boundary conditions
+                #------------------------------------------------------------------------------
+
+                from math import sin, pi, exp, cos, cosh, sqrt 
+                Br = Reflective_boundary(domain)      # Solid reflective wall
+                Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+                Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+                Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                                   f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+                g = 9.81
+                offshore_depth = 250
+                H_d_ratio = 0.008
+                Xo = 22300
+                po = 0.6
+            
+                def waveform_sol(t):
+                    return 0.5*wave[l]*offshore_depth*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+                
+                Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform_sol)
+                # Associate boundary tags with boundary objects
+                domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+
+                #------------------------------------------------------------------------------
+                # Evolve system through time
+                #------------------------------------------------------------------------------
+
+                for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                    domain.write_time()
+
+                    """
+                Generate time series of nominated "gauges" 
+                Note, this script will only work if pylab is installed on the platform
+
+                Inputs:
+
+                production dirs: dictionary of production directories with a
+                                 association to that simulation run, eg high tide,
+                                 magnitude, etc.
+                                    
+                Outputs:
+
+                * figures stored in same directory as sww file
+                * time series data stored in csv files in same directory as sww file
+                * elevation at nominated gauges (elev_output)
+                """
+
+                from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+                from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+                # nominate directory location of sww file with associated attribute
+                production_dirs = {output_dir: str(name)}
+
+                # Generate figures
+                swwfiles = {}
+                for label_id in production_dirs.keys():
+                    file_loc = label_id
+                    swwfile = file_loc + str(name)+'.sww'
+                    swwfiles[swwfile] = label_id
+                    print 'hello', swwfile
+                texname, elev_output = sww2timeseries(swwfiles,
+                                                       sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                      production_dirs,
+                                                      report = False,
+                                                      reportname = '',
+                                                      plot_quantity = ['stage', 'speed'],
+                                                      generate_fig = False,
+                                                      surface = False,
+                                                      time_min = None,
+                                                      time_max = None,
+                                                      #time_unit = 'secs',
+                                                      title_on = True,
+                                                      verbose = True)
+##                print (output_dir+sep+str(name)+'.sww')
+##                remove(output_dir+sep+str(name)+'.sww')
+##              
+
+
+
+
+
Index: /anuga_work/development/reef_0708/transect_gap_1000.py
===================================================================
--- /anuga_work/development/reef_0708/transect_gap_1000.py	(revision 5066)
+++ /anuga_work/development/reef_0708/transect_gap_1000.py	(revision 5066)
@@ -0,0 +1,214 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+from __future__ import division
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='gap'
+crest =[50]
+A = [1]
+gap = [1000]
+E = len (crest)
+for i in range(E):
+    M = len (gap)
+    for k in range (M):
+        B = len(A)
+        for l in range(B): 
+            length = (crest[i]+2500)
+            width = (gap[k]*3)
+            crestdepth = (-2)         
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+##            output_dir = 'c:'+sep+'anuga_data'+sep
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'gap'+sep+str(length)+'_'+str(A[l])+'_'+'2700'+'_'+str(gap[k])+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],width],[140,width]]
+            interior_polygon2 = [[810+crest[i],0],[2499+crest[i],0],[2499+crest[i],width],[810+crest[i],width]]
+            interior_polygon3 = [[700,0], [700,gap[k]], [700+crest[i],gap[k]], [700+crest[i],0]]
+            interior_polygon4 = [[700,2*gap[k]], [700,width], [700+crest[i],width], [700+crest[i],2*gap[k]]]                     
+##            interior_regions = [[interior_polygon, 400], [interior_polygon2, 2500], [interior_polygon3, 200], [interior_polygon4, 200]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=625,
+                                     filename=meshname,
+##                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)# Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z = (-81/(820+crest[i]-180)*x)+crestdepth-7+(180*(81/(820+crest[i]-180)))     
+                N = len (x)
+                for j in range(N):
+                    ##Lagoon
+                    if x[j] < 180:
+                        z[j] = -7+crestdepth
+
+                     ##gap
+                    elif 179 < x[j] < (821+crest[i]) and (gap[k]) < y[j] < (2*gap[k]):
+                        z[j] = (-81/(820+crest[i]-180)*x[j])+crestdepth-7+(180*(81/(820+crest[i]-180))) 
+##                      ##back of gap      
+##                    elif 180 < x[j] < 200 and (gap[k]) < y[j] < (2*gap[k]):
+##                        z[j] = -x[j]+173+crestdepth
+##                      ##Side of Gap Right  
+##                    elif 179< x[j] < (821+crest[i]) and (gap[k]*2)-4 < y[j] < (2*gap[k])+1:
+##                        z[j] = x[j]*20+crestdepth
+##                        ####                    ##Side of Gap left
+##                    elif 179 < x[j] < (821+crest[i]) and ((gap[k])-1) < y[j] < (gap[k]+4):
+##                        z[j] = -x[j]*20+crestdepth 
+                    #crest to lagoon
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth
+                        #Flat
+                    elif 199 < x[j] < 700:
+                        z[j] = -0.5+crestdepth
+                    ##Crest
+                    elif 699 < x[j] < (700+crest[i]):
+                        z[j] = +crestdepth
+                     #Curve down
+                    elif (699+crest[i]) < x[j] < (720+crest[i]):
+                        z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth
+                       ##steep slope 
+                    elif (719+crest[i]) < x[j] < (820+crest[i]):
+                        z[j] =(-0.84*x[j])+(0.84*(720+crest[i]))+crestdepth-4
+                    
+                return z
+
+
+
+
+                    
+               
+
+
+            domain.set_quantity('elevation', topography, alpha=0.1) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon, 0.05), (interior_polygon2, 0.05), (interior_polygon3, 0.2), (interior_polygon4, 0.2)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+            domain.tight_slope_limiters = 1
+            domain.beta_h = 0
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 288
+            H_d_ratio = 0.008
+            Xo = 71700
+            po = 0.036
+            def waveform(t):
+                return A[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'gap'+sep+'gauges_smflat_gap.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage','speed','bearing'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            remove(output_dir+sep+str(name)+'.sww')
Index: /anuga_work/development/reef_0708/wall_lagoon.py
===================================================================
--- /anuga_work/development/reef_0708/wall_lagoon.py	(revision 5066)
+++ /anuga_work/development/reef_0708/wall_lagoon.py	(revision 5066)
@@ -0,0 +1,192 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='wall_lagoon'
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [2, -2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (crest[i]+500)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+##            output_dir = 'C:'+sep+'anuga_data'+sep
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'wall_lagoon'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_'+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[280+crest[i],0],[280+crest[i],20],[140,20]]
+            interior_polygon2 =[[290+crest[i],0],[499+crest[i],0],[499+crest[i],20],[290+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)   # Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.026*x)+(0.026*(228+crest[i]))+crestdepth[k]-4-80         
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        
+                        ##Crest
+                    elif 199 < x[j] < (200+crest[i]):
+                        z[j] = +crestdepth[k]
+                        
+                     #Curve down
+                    elif (199+crest[i]) < x[j] < (220+crest[i]):
+                        z[j] = -0.01*(x[j]-(199+crest[i]))*(x[j]-(199+crest[i]))+crestdepth[k]
+                    #Wall
+                    elif (219+crest[i]) < x[j] < (228+crest[i]):
+                        z [j] = (-10*x[j])+(10*(220+crest[i]))+crestdepth[k]-4 
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 90
+            H_d_ratio = 0.022
+            Xo = 40300
+            po = 0.004
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_lagoon.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            remove(output_dir+sep+str(name)+'.sww')
+
Index: /anuga_work/development/reef_0708/wall_lgflat.py
===================================================================
--- /anuga_work/development/reef_0708/wall_lgflat.py	(revision 5066)
+++ /anuga_work/development/reef_0708/wall_lgflat.py	(revision 5066)
@@ -0,0 +1,195 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name ='wall_lgflat'
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [-2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B):
+            length = (crest[i]+2500)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'wall_lgflat'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_'+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[2280+crest[i],0],[2280+crest[i],20],[140,20]]
+            interior_polygon2 =[[2290+crest[i],0],[2499+crest[i],0],[2499+crest[i],20],[2290+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)   # Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.026*x)+(0.026*(2228+crest[i]))+crestdepth[k]-4-80       
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        #Reef Flat
+                    elif 199 < x[j] < 2200:
+                        z[j] = -0.5+crestdepth[k]
+                        ##Crest
+                    elif 2199 < x[j] < (2200+crest[i]):
+                        z[j] = +crestdepth[k]
+                       
+    ##                     #Curve down
+                    elif (2199+crest[i]) < x[j] < (2220+crest[i]):
+                        z[j] = -0.01*(x[j]-(2199+crest[i]))*(x[j]-(2199+crest[i]))+crestdepth[k]                    
+                        #Wall
+                    elif (2219+crest[i]) < x[j] < (2228+crest[i]):
+                        z [j] = (-10*x[j])+(10*(2220+crest[i]))+crestdepth[k]-4
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 90
+            H_d_ratio = 0.022
+            Xo = 40300
+            po = 0.004
+            def waveform(t):
+                    return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = length*2):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_lgflat.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/reef_0708/wall_smflat.py
===================================================================
--- /anuga_work/development/reef_0708/wall_smflat.py	(revision 5066)
+++ /anuga_work/development/reef_0708/wall_smflat.py	(revision 5066)
@@ -0,0 +1,197 @@
+"""Simple water flow example using ANUGA
+
+Water driven up a linear slope and time varying boundary,
+similar to a beach environment
+"""
+
+
+#------------------------------------------------------------------------------
+# Import necessary modules
+#------------------------------------------------------------------------------
+
+from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
+from anuga.shallow_water import Domain
+from anuga.shallow_water import Reflective_boundary
+from anuga.shallow_water import Dirichlet_boundary
+from anuga.shallow_water import Time_boundary
+from anuga.shallow_water import Transmissive_boundary
+from anuga.shallow_water import Transmissive_Momentum_Set_Stage_boundary
+from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files
+from time import strftime, gmtime
+from os import sep, environ, getenv, getcwd,umask
+from anuga.utilities.polygon import Polygon_function
+#------------------------------------------------------------------------------
+# Setup computational domain
+#------------------------------------------------------------------------------
+from anuga.pmesh.mesh_interface import create_mesh_from_regions
+
+name= 'wall_smflat'
+wave = [1, -1] #1 returns leading depression N-wave
+               #-1 returns leading crest N-wave
+crest =[50, 450]
+crestdepth = [2, -2, -6]
+N = len (crest)
+for i in range(N):
+    M = len (crestdepth)
+    for k in range (M):
+        B = len(wave)
+        for l in range(B): 
+            length = (crest[i]+1000)
+            width = 20.
+            A = 1
+            T = 2700
+            umask(002)
+            time = strftime('%Y%m%d_%H%M%S',gmtime())
+
+            output_dir = sep+'d'+sep+'xrd'+sep+'gem'+sep+'5'+sep+'nhi'+sep+'inundation'+sep+'data'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'wall_smflat'+sep+str(wave[l])+'_'+str(length)+'_'+str(A)+'_'+str(T)+'_'+str(crestdepth[k])+'_'+str(name)+sep
+            sww_file = str(name)
+            copy_code_files(output_dir,__file__,__file__)
+
+            start_screen_catcher(output_dir)
+            dx = dy = .5           # Resolution: Length of subdivisions on both axes
+            boundary_polygon = [[0,0],[length,0],[length,width],[0,width]]
+            interior_polygon = [[140,0],[780+crest[i],0],[780+crest[i],20],[140,20]]
+            interior_polygon2 =[[790+crest[i],0],[999+crest[i],0],[999+crest[i],20],[790+crest[i],20]]
+            interior_regions = [[interior_polygon, 8], [interior_polygon2, 50]]
+            meshname = str(name)+'.msh'
+            create_mesh_from_regions(boundary_polygon,
+                                     boundary_tags={'bottom': [0],
+                                                    'right': [1],
+                                                    'top': [2],
+                                                    'left': [3]},
+                                     maximum_triangle_area=50,
+                                     filename=meshname,
+                                     interior_regions=interior_regions,
+                                     use_cache=False,
+                                     verbose=False)
+
+            domain = Domain(meshname, use_cache=True, verbose=True)
+
+            print 'Number of triangles = ', len(domain)
+            print 'The extent is ', domain.get_extent()
+            print domain.statistics()
+             
+            domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
+            domain.set_minimum_storable_height(0.01)
+            domain.set_default_order(2) # Second order spatial approximation
+            domain.set_name(sww_file)   # Output name
+            domain.set_datadir(output_dir)  
+
+
+            #------------------------------------------------------------------------------
+            # Setup initial conditions
+            #------------------------------------------------------------------------------
+
+            def topography(x,y):
+                """Complex topography defined by a function of vectors x and y
+                """
+
+                z =(-0.026*x)+(0.026*(728+crest[i]))+crestdepth[k]-4-80         
+                N = len (x)
+                for j in range(N):
+
+                    if x[j] < 180:
+                        z[j] = -4+crestdepth[k] 
+                    
+                    elif 179 < x[j] < 200:
+                        z[j] = 0.2*x[j]-40+crestdepth[k]
+                        #Reef Flat
+                    elif 199 < x[j] < 700:
+                        z[j] = -0.5+crestdepth[k]
+                        ##Crest
+                    elif 699 < x[j] < (700+crest[i]):
+                        z[j] = +crestdepth[k]
+                       
+                        #Curve down
+                    elif (699+crest[i]) < x[j] < (720+crest[i]):
+                        z[j] = -0.01*(x[j]-(699+crest[i]))*(x[j]-(699+crest[i]))+crestdepth[k]
+                        #Wall
+                    elif (719+crest[i]) < x[j] < (728+crest[i]):
+                        z [j] = (-10*x[j])+(10*(720+crest[i]))+crestdepth[k]-4
+
+
+                return z
+               
+
+
+            domain.set_quantity('elevation', topography) # Use function for elevation
+    ##        domain.set_quantity('friction', 0)         # Constant friction
+            domain.set_quantity('friction', Polygon_function( [(boundary_polygon, 0.05),(interior_polygon ,0.2), (interior_polygon2 , 0.05)] ) )#changing friction over two polygons
+            domain.set_quantity('stage', 0.)            # Constant negative initial stage
+
+
+            #------------------------------------------------------------------------------
+            # Setup boundary conditions
+            #------------------------------------------------------------------------------
+
+            from math import sin, pi, exp, cos, cosh, sqrt 
+            Br = Reflective_boundary(domain)      # Solid reflective wall
+            Bt = Transmissive_boundary(domain)    # Continue all values on boundary 
+            Bd = Dirichlet_boundary([0.,0.,0.]) # Constant boundary values
+            Bw = Time_boundary(domain=domain,     # Time dependent boundary  
+                               f=lambda t: [sin(2*pi*(t)/1010), -37, 0.0])
+            g = 9.81
+            offshore_depth = 90
+            H_d_ratio = 0.022
+            Xo = 40300
+            po = 0.004
+            def waveform(t):
+                return wave[l]*offshore_depth*(sqrt(g/offshore_depth)*t-Xo/offshore_depth)*sqrt(H_d_ratio*po)*H_d_ratio/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))/cosh(sqrt(3*H_d_ratio*po/4)*(sqrt(g/offshore_depth)*t-Xo/offshore_depth))
+            Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
+            # Associate boundary tags with boundary objects
+            domain.set_boundary({'left': Bd, 'right': Bf, 'top': Br, 'bottom': Br})
+
+
+            #------------------------------------------------------------------------------
+            # Evolve system through time
+            #------------------------------------------------------------------------------
+
+            for t in domain.evolve(yieldstep = 5 , finaltime = 4500):
+                domain.write_time()
+
+                """
+            Generate time series of nominated "gauges" 
+            Note, this script will only work if pylab is installed on the platform
+
+            Inputs:
+
+            production dirs: dictionary of production directories with a
+                             association to that simulation run, eg high tide,
+                             magnitude, etc.
+                                
+            Outputs:
+
+            * figures stored in same directory as sww file
+            * time series data stored in csv files in same directory as sww file
+            * elevation at nominated gauges (elev_output)
+            """
+
+            from os import getcwd, sep, altsep, mkdir, access, F_OK, remove
+            from anuga.abstract_2d_finite_volumes.util import sww2timeseries
+
+            # nominate directory location of sww file with associated attribute
+            production_dirs = {output_dir: str(name)}
+
+            # Generate figures
+            swwfiles = {}
+            for label_id in production_dirs.keys():
+                file_loc = label_id
+                swwfile = file_loc + str(name)+'.sww'
+                swwfiles[swwfile] = label_id
+                print 'hello', swwfile
+            texname, elev_output = sww2timeseries(swwfiles,
+                                                   sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'natural_hazard_impacts'+sep+'inundation'+sep+'sandpits'+sep+'jbrowning'+sep+'anuga'+sep+'anuga_work'+sep+'development'+sep+'idealised_bathymetry_study'+sep+'final_models'+sep+'general'+sep+'gauges_smflat.csv',
+                                                  production_dirs,
+                                                  report = False,
+                                                  reportname = '',
+                                                  plot_quantity = ['stage', 'speed'],
+                                                  generate_fig = False,
+                                                  surface = False,
+                                                  time_min = None,
+                                                  time_max = None,
+                                                  #time_unit = 'secs',
+                                                  title_on = True,
+                                                  verbose = True)
+##            remove(output_dir+sep+str(name)+'.sww')
+
+
Index: /anuga_work/development/solitary_waves/boundary_gauge.lic
===================================================================
--- /anuga_work/development/solitary_waves/boundary_gauge.lic	(revision 5066)
+++ /anuga_work/development/solitary_waves/boundary_gauge.lic	(revision 5066)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<ga_license_file>
+  <metadata>
+    <author>Jane Sexton</author>
+  </metadata>
+  
+  <datafile>
+    <filename>boundary_gauge.xya</filename>
+    <checksum></checksum>
+    <publishable>Yes</publishable>
+    <accountable>Jane Sexton</accountable>
+    <source>Generated by ANUGA development team</source>
+    <IP_owner>Geoscience Australia.</IP_owner>
+    <IP_info>Derived for use with examining output from solitary_wave_runup.py</IP_info>
+  </datafile>
+
+</ga_license_file>
Index: /anuga_work/development/solitary_waves/convergence_results.lic
===================================================================
--- /anuga_work/development/solitary_waves/convergence_results.lic	(revision 5066)
+++ /anuga_work/development/solitary_waves/convergence_results.lic	(revision 5066)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<ga_license_file>
+  <metadata>
+    <author>Jane Sexton</author>
+  </metadata>
+  
+  <datafile>
+    <filename>convergence_results.txt</filename>
+    <checksum></checksum>
+    <publishable>Yes</publishable>
+    <accountable>Ole Nielsen</accountable>
+    <source>Generated by ANUGA development team</source>
+    <IP_owner>Geoscience Australia. </IP_owner>
+    <IP_info>Results for a range of different model runs based on changing the mesh resolution in solitary_wave_runup.py</IP_info>
+  </datafile>
+
+</ga_license_file>
