Index: /anuga_work/production/bunbury_storm_surge_2009/build_elevation.py
===================================================================
--- /anuga_work/production/bunbury_storm_surge_2009/build_elevation.py	(revision 7656)
+++ /anuga_work/production/bunbury_storm_surge_2009/build_elevation.py	(revision 7657)
@@ -84,21 +84,27 @@
 keylist = project.ascii_grid_filenames + project.point_filenames
 
-G1 = geospatial_data['swwa_10m_IC'].clip_outside(project.elevation_clip_box)
-G2 = geospatial_data['bunbury_5m_IC'].clip(project.elevation_clip_box)
-#~ G2 = geospatial_data['bunbury_nth_a'].clip(project.elevation_clip_box)
-#~ G3 = geospatial_data['bunbury_nth_b'].clip(project.elevation_clip_box)
-#~ G4 = geospatial_data['bunbury_sth_a'].clip(project.elevation_clip_box)
-#~ G5 = geospatial_data['bunbury_sth_b'].clip(project.elevation_clip_box)
-G3 = geospatial_data['DPI.txt']
-G4 = geospatial_data['Busselton_Chart_Clip_ss.txt']
-G5 = geospatial_data['Busselton_NavyFinal_Clip_ss.txt']
-G6 = geospatial_data['Leschenault_TIN.txt']
-G7 = geospatial_data['Leschenault_Inlet_TIN.txt']
-G8 = geospatial_data['DPI5U1A02_01a_edited.txt']
-G9 = geospatial_data['DPI5U1A02_01b_edited.txt']
-G10 = geospatial_data['DPI5U1A02_01c_edited.txt']
-G11 = geospatial_data['DPI5U1A02_01d_edited.txt']
-G12 = geospatial_data['DPI5U1A02_01e_edited.txt']
+G1 = geospatial_data[keylist[0]].clip_outside(project.elevation_clip_box)
+G2 = geospatial_data[keylist[1]].clip(project.elevation_clip_box)
+G3 = geospatial_data[keylist[2]]
+G4 = geospatial_data[keylist[3]]
+G5 = geospatial_data[keylist[4]]
+G6 = geospatial_data[keylist[5]]
+G7 = geospatial_data[keylist[6]]
+G8 = geospatial_data[keylist[7]]
+G9 = geospatial_data[keylist[8]]
+G10 = geospatial_data[keylist[9]]
+G11 = geospatial_data[keylist[10]]
 
+
+# G = None
+
+# for i, key in enumerate(keylist):
+    # if key==keylist[0]:
+        # G[i] = geospatial_data[key].clip_outside(project.elevation_clip_box)
+    # elif key==keylist[1]:
+        # G[i] = geospatial_data[key].clip(project.elevation_clip_box)
+    # else
+        # G+ = geospatial_data[key]
+        
 #~ G_list = [G1, G2, G3, G4, G5, G6, G7, G8, G9, G10]
 
@@ -114,5 +120,5 @@
 #~ print 'G10', G10.attributes
 
-G = G1 + G2 + G3 + G4 + G5 + G6 + G7 + G8 + G9 + G10 + G11 + G12
+G = G1 + G2 + G3 + G4 + G5 + G6 + G7 + G8 + G9 + G10 + G11
 
 # G = None
@@ -134,15 +140,20 @@
 	#~ for i in keylist:
 	#~ g.export_points_file(join(project.topographies_folder, (str(keylist[i]) +'_export.txt')))
+
 G.export_points_file(project.combined_elevation + '.txt')
-G1.export_points_file(join(project.topographies_folder, keylist[0] +'_export.txt'))
-G2.export_points_file(join(project.topographies_folder, keylist[1] +'_export.txt'))
-G3.export_points_file(join(project.topographies_folder, keylist[2] +'_export.txt'))
-G4.export_points_file(join(project.topographies_folder, keylist[3] +'_export.txt'))
-G5.export_points_file(join(project.topographies_folder, keylist[4] +'_export.txt'))
-G6.export_points_file(join(project.topographies_folder, keylist[5] +'_export.txt'))
-G7.export_points_file(join(project.topographies_folder, keylist[6] +'_export.txt'))
-G8.export_points_file(join(project.topographies_folder, keylist[7] +'_export.txt'))
-G9.export_points_file(join(project.topographies_folder, keylist[8] +'_export.txt'))
-G10.export_points_file(join(project.topographies_folder, keylist[9] +'_export.txt'))
-G11.export_points_file(join(project.topographies_folder, keylist[10] +'_export.txt'))
-G12.export_points_file(join(project.topographies_folder, keylist[11] +'_export.txt'))
+
+print 'Export individual text files'
+for i in xrange(len(keylist)):
+    G[i+1].export_points_file(join(project.topographies_folder, keylist[i] +'_export.txt'))
+ 
+# G1.export_points_file(join(project.topographies_folder, keylist[0] +'_export.txt'))
+# G2.export_points_file(join(project.topographies_folder, keylist[1] +'_export.txt'))
+# G3.export_points_file(join(project.topographies_folder, keylist[2] +'_export.txt'))
+# G4.export_points_file(join(project.topographies_folder, keylist[3] +'_export.txt'))
+# G5.export_points_file(join(project.topographies_folder, keylist[4] +'_export.txt'))
+# G6.export_points_file(join(project.topographies_folder, keylist[5] +'_export.txt'))
+# G7.export_points_file(join(project.topographies_folder, keylist[6] +'_export.txt'))
+# G8.export_points_file(join(project.topographies_folder, keylist[7] +'_export.txt'))
+# G9.export_points_file(join(project.topographies_folder, keylist[8] +'_export.txt'))
+# G10.export_points_file(join(project.topographies_folder, keylist[9] +'_export.txt'))
+# G11.export_points_file(join(project.topographies_folder, keylist[10] +'_export.txt'))
Index: /anuga_work/production/bunbury_storm_surge_2009/project.py
===================================================================
--- /anuga_work/production/bunbury_storm_surge_2009/project.py	(revision 7656)
+++ /anuga_work/production/bunbury_storm_surge_2009/project.py	(revision 7657)
@@ -85,11 +85,10 @@
                    'Busselton_Chart_Clip_ss.txt',		# Clipped from Busselton_Chart  - see Busselton Tsunami Scenario 2009
                    'Busselton_NavyFinal_Clip_ss.txt',	# Clipped from Busselton_NavyFinal - see Busselton Tsunami Scenario 2009
-                   'Leschenault_TIN.txt',               # TIN created over the Leschenault Estuary
-                   'Leschenault_inlet_TIN.txt'          # TIN created over the Leschenault Inlet
-                   'DPI5U1A02_01a_edited.txt',          # Bathymetric LiDAR from DPI - split into manageable pieces
-                   'DPI5U1A02_01b_edited.txt',	
-                   'DPI5U1A02_01c_edited.txt',
+                   'DPI5U1A02_01a_edited.txt',          # Bathymetric LiDAR from DPI - split into manageable pieces and edited so 
+                   'DPI5U1A02_01b_edited.txt',	        # depths below 0 m are negative, and all soundings on land (ie positive) 
+                   'DPI5U1A02_01c_edited.txt',          # are removed as these are not corrected to "bare earth".
                    'DPI5U1A02_01d_edited.txt',
-                   'DPI5U1A02_01e_edited.txt']					
+                   'DPI5U1A02_01e_edited.txt',
+                   'Leschenault_TIN.txt']               # TIN created over the Leschenault Estuary and Inlet]					
 
 # BOUNDING POLYGON - for data clipping and estimate of triangles in mesh
@@ -105,5 +104,5 @@
                          ['area_of_interest.csv', 100],
                          ['storm_gate_area.csv', 1],
-                         ['floodgates.csv', floodgate_resolution]]
+                         ['stormgates.csv', 1]]
 
 # LAND - used to set the initial stage/water to be offcoast only
@@ -114,4 +113,9 @@
 # Format is index,northing, easting, elevation (without header)
 gems_order_filename = 'gems_boundary_order_thinned.csv'
+
+# Storm gate filename
+# Format is as for a building file to be read by csv2building_polygons, 
+# easting, northing, id, floors (with header)
+storm_gate_filename = 'storm_gates.csv'
 
 # GAUGES - for creating timeseries at a specific point
@@ -231,4 +235,9 @@
 log.log_filename = join(output_run, scenario_name) + '.log'
 
+# The absolute pathname for the storm gate file
+# Used for run_model.py
+if storm_gate_filename:
+	storm_gate = join(polygons_folder, storm_gate_filename)  
+
 # The absolute pathname for the gauges file
 # Used for get_timeseries.py
Index: /anuga_work/production/bunbury_storm_surge_2009/run_model.py
===================================================================
--- /anuga_work/production/bunbury_storm_surge_2009/run_model.py	(revision 7656)
+++ /anuga_work/production/bunbury_storm_surge_2009/run_model.py	(revision 7657)
@@ -113,4 +113,5 @@
 print domain.statistics()
 
+domain.set_starttime(project.starttime)
 domain.set_name(project.scenario_name)
 domain.set_datadir(project.output_run) 
@@ -137,4 +138,20 @@
                     verbose=True,
                     alpha=project.alpha)
+
+#--------------------------
+# Add storm surge gate
+#--------------------------
+storm_gate_polygon, storm_gate_height = csv2building_polygons(project.storm_gate, floor_height=4)
+
+gate = []
+for key in storm_gate_polygon:
+    poly = storm_gate_polygon[key]
+    elev = storm_gate_height[key]
+    gate.append((poly, elev))
+
+domain.add_quantity('elevation', 
+                    Polygon_function(gate, geo_reference=domain.geo_reference),
+                    use_cache=True,
+                    verbose=True)
 
 #-------------------------------------------------------------------------------
