Index: /anuga_work/production/perth/asc2raster_GDA94z50.py
===================================================================
--- /anuga_work/production/perth/asc2raster_GDA94z50.py	(revision 6031)
+++ /anuga_work/production/perth/asc2raster_GDA94z50.py	(revision 6032)
@@ -13,31 +13,36 @@
 gp = arcgisscripting.create()
 
+# Check out any necessary licenses
+gp.CheckOutExtension("spatial")
+
 # Load required toolboxes...
+gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")
 gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx")
 gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
 gp.overwriteoutput = 1
 
-output_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\"
-scenario_dir="perth_tsunami_scenario\\anuga\\outputs\\"
+scenario_dir="\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\perth_tsunami_scenario\\"
+output_dir = "anuga\\outputs\\"
 
 
 time_dir1 = '20081031_133353_run_final_0.6_68693_alpha0.1_kvanputt'
-time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
-time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
-time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
-time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
-time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
+##time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
+##time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
+##time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
+##time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
+##time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
 
 
-time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
+time_dirs = [time_dir1]#, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
 
 for time_dir in time_dirs:
 
     # Local variables...
-    folder = output_dir + scenario_dir + time_dir + '\\'
+    folder =  scenario_dir + output_dir + time_dir + '\\'
     raster_gbd = folder + 'raster.gdb'
+    land = scenario_dir + "map_work\\Perth.gdb\\poly_all_cut"
     
     # Process: Create File GDB...
-    gp.CreateFileGDB_management(folder, "raster")
+    #gp.CreateFileGDB_management(folder, "raster")
 
     gp.Workspace = raster_gbd
@@ -47,10 +52,10 @@
     #replication dictionary
     replicate = (('perth', ''),('time_39900_0', 'b'), ('time_79800_0', 'c'),
-                 ('_', ''),('Geordie', 'Geo'),('Sorrento', 'Sor'),
-                 ('Fremantle', 'Fre'),('Rockingham', 'Roc'),('depth','_depth'),
-                 ('speed', '_speed'), ('elevation', '_elev_'), ('stage','_stage'))
+                 ('_', ''),('Geordie', 'Geo'),('Sorrento', 'Sor'), ('max','M_'),
+                 ('Fremantle', 'Fre'),('Rockingham', 'Roc'),('depth','_dep_'),
+                 ('speed', '_spe_'), ('elevation', '_ele_'), ('stage','_sta_'))
 
     generate_filename = []
-    input_ascii = glob.glob(folder + '*max.asc')
+    input_ascii = glob.glob(folder + '*elevation.asc')
 
     for infile in input_ascii:
@@ -63,15 +68,18 @@
             sys.exit(10)
         generate_filename.append(output_DEM)
-
-        #print 'input %s and output %s' %(infile,output_DEM)
-
-        # Process: ASCII to Raster (4)...
+        print 'Output DEM ',output_DEM
+        output_extract = output_DEM + 'E'
+        print 'Output Extract ',output_extract
+        
+        print 'Process: ASCII to Raster'
         gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
 
-        # Process: Define Projection (3)...
+        print 'Process: Define Projection' 
         gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_50',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
                                                    ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996]"
                                                    ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
 
+##        print 'Process: Extract by Mask'
+##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
 
 
Index: uga_work/production/perth/export_results_all.py
===================================================================
--- /anuga_work/production/perth/export_results_all.py	(revision 6031)
+++ 	(revision )
@@ -1,111 +1,0 @@
-"""
-Generates ascii grids of nominated areas -
-Input: sww file from run_perth.py
-       boundaries for grids from project.py
-Outputs: ascii grids of specified variables
-Stored in the 'outputs_dir' folder for respective .sww file
-
-Note:
-If producing a grid for the enitre extent cellsize should be greater than 30m
-If producing grids for inundation area resolution should be greater than mesh (ie ~22m)
-"""
-
-import project, os
-import sys
-from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
-from anuga.shallow_water.data_manager import sww2dem
-from os import sep
-
-
-directory = project.output_dir
-
-
-##time_dir1 = '20080924_123601_run_final_0_27283_250m_none_kvanputt' # This uses the 250m bathymetry without any interior polygons
-##time_dir2 = '20080924_123626_run_final_0_27283_250m_all_kvanputt' # This uses the 250m bathymetry with all interior polygons
-##time_dir3 = '20080912_154716_run_final_0_27283_alpha0.1_kvanputt' # This uses original bathyemetry data
-
-time_dir1 = '20081031_133353_run_final_0.6_68693_alpha0.1_kvanputt'
-time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
-time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
-time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
-time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
-time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
-
-
-time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
-
-cellsize = 20
-#cellsize = 250
-
-timestep = None    # None means no timestep!
-#timestep = 0
-
-######
-# Set the special areas of interest.  If none, do: area='All'
-######
-#area = ['Geordie', 'Sorrento', 'Fremantle', 'Rockingham']  # strings must match keys in var_equations below
-area = ['All']      # 'All' means no special areas - the whole thing
-
-######
-# Define allowed variable names and associated equations to generate values.
-# This would not normally change.
-######
-var_equations = {'stage':     'stage',
-                 'momentum':  '(xmomentum**2 + ymomentum**2)**0.5',
-                 'depth':     'stage-elevation',
-                 'speed':     '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)',
-                 'elevation': 'elevation' }
-
-# one or more key strings from var_equations above
-var = ['depth', 'speed']
-
-######
-# Start running the various conversions we require.
-######
-for time_dir in time_dirs:
-    name1 = directory+time_dir+sep+project.scenario_name
-    name2 = directory+time_dir+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything
-    name3 = directory+time_dir+sep++project.scenario_name+'_time_79800_0' #need to get assistance on how to make this into anything
-
-    names = [name1, name2, name3]
- 
-    for name in names:
-        for which_area in area:
-            if which_area == 'All':
-                easting_min = None
-                easting_max = None
-                northing_min = None
-                northing_max = None
-            else:
-                try:
-                    easting_min = eval('project.xmin%s' % which_area)
-                    easting_max = eval('project.xmax%s' % which_area)
-                    northing_min = eval('project.ymin%s' % which_area)
-                    northing_max = eval('project.ymax%s' % which_area)
-                except AttributeError:
-                    print 'Unrecognized area name: %s' % which_area
-                    break
-              
-            for which_var in var:
-                if which_var not in var_equations:
-                    print 'Unrecognized variable name: %s' % which_var
-                    break
-
-                outname = name + '_' + which_area + '_' + which_var
-                quantityname = var_equations[which_var]
-
-                print 'start sww2dem: time_dir=%s' % time_dir
-                
-                sww2dem(name, basename_out = outname,
-                            quantity = quantityname,
-                            timestep = timestep,
-                            cellsize = cellsize,      
-                            easting_min = easting_min,
-                            easting_max = easting_max,
-                            northing_min = northing_min,
-                            northing_max = northing_max,        
-                            reduction = max, 
-                            verbose = True,
-                            format = 'asc')
-
-     
Index: /anuga_work/production/perth/export_results_max.py
===================================================================
--- /anuga_work/production/perth/export_results_max.py	(revision 6031)
+++ /anuga_work/production/perth/export_results_max.py	(revision 6032)
@@ -13,8 +13,8 @@
 import project, os
 import sys
+from anuga.lib.maxasc.maxasc import MaxAsc
 from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
 from anuga.shallow_water.data_manager import sww2dem
 from os import sep
-import maxasc
 
 directory = project.output_dir
@@ -27,11 +27,11 @@
 
 time_dir1 = '20081031_133353_run_final_0.6_68693_alpha0.1_kvanputt'
-time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
-time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
-time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
-time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
-time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
+##time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
+##time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
+##time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
+##time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
+##time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
 
-time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
+time_dirs = [time_dir1]#, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
 
   
@@ -40,6 +40,6 @@
 #cellsize = 250
 
-timestep = None    # None means no timestep!
-#timestep = 0
+#timestep = None    # None means no timestep!
+timestep = 0
 
 ######
@@ -47,6 +47,6 @@
 ######
 
-area = ['Rockingham', 'Sorrento', 'Fremantle','Geordie' ]  # strings must match keys in var_equations below
-#area = ['All']      # 'All' means no special areas - the whole thing
+#area = ['Perth'] #Rockingham', 'Sorrento', 'Fremantle','Geordie' ]  # strings must match keys in var_equations below
+area = ['All']      # 'All' means no special areas - the whole thing
 
 ######
@@ -61,5 +61,5 @@
 
 # one or more key strings from var_equations above
-var = ['depth', 'speed']
+var = ['elevation']
 
 ######
@@ -91,8 +91,8 @@
 
             name1 = directory+time_dir+sep+project.scenario_name
-            name2 = directory+time_dir+sep+project.scenario_name+'_time_39900_0'
-            name3 = directory+time_dir+sep+project.scenario_name+'_time_79800_0'
+            #name2 = directory+time_dir+sep+project.scenario_name+'_time_39180_0'
+            #name3 = directory+time_dir+sep+project.scenario_name+'_time_78360_0'
 
-            names = [name1, name2, name3]
+            names = [name1] #, name2, name3]
       
             asc_name = []   
Index: /anuga_work/production/perth/get_timeseries.py
===================================================================
--- /anuga_work/production/perth/get_timeseries.py	(revision 6031)
+++ /anuga_work/production/perth/get_timeseries.py	(revision 6032)
@@ -12,29 +12,38 @@
 """
 
-from os import sep
+from os import sep, rename, listdir, system
 from anuga.abstract_2d_finite_volumes.util import sww2csv_gauges,csv2timeseries_graphs
 import project
 
-timestamp1='20080815_103442_run_final_0.0_polyline_alpha0.1_kvanputt'
-timestamp2='20080815_103336_run_final_0.6_polyline_alpha0.1_kvanputt'
+directory = project.output_dir
 
-timestamps = [timestamp1, timestamp2]
-for timestamp in timestamps:
+##time_dir1 = '20081031_133353_run_final_0.6_68693_alpha0.1_kvanputt'
+##time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
+##time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
+##time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
+##time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
+time_dir6 = '20081117_141914_run_final_0.6_27283_Rockingham_kvanputt'
 
-    filename1=project.output_dir+timestamp+sep+project.scenario_name+'.sww'
-    filename2=project.output_dir+timestamp+sep+'sww2'+sep+project.scenario_name+'_time_39900_0.sww'
+time_dirs = [time_dir6] #1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
 
-    filenames = [filename1, filename2]
-    for filename in filenames:
+for time_dir in time_dirs:
+    
+    name1 = directory+time_dir+sep+project.scenario_name 
+    name2 = directory+time_dir+sep+project.scenario_name+'_time_43380_0'
+    #name3 = directory+time_dir+sep+project.scenario_name+'_time_78360_0'
 
-        gauges = [project.gauges_dir_name, project.gauges_dir_name2]
-        for gauge in gauges:
-            
-            sww2csv_gauges(filename,gauge,
-                            quantities = ['stage','speed','depth','elevation'],
-                            verbose=True)
-                        
+    names = [name1, name2] #, name3]
 
-    
-
-
+    for i, name in enumerate(names):
+        gauge = project.gauges_dir_name
+        out_name = 'gauge_%d_' % i
+        sww2csv_gauges(name+'.sww',gauge,out_name = out_name,
+                        quantities = ['stage','speed','depth','elevation'],
+                        verbose=True)
+##        for out_name in listdir(directory+time_dir):
+##            #total_filename = directory+time_dir+sep+'All_' + out_name
+##            if i == 0:
+##                
+##            else:
+##                system('cat %s %s > %s' %(,out_name,))
+##   
Index: /anuga_work/production/perth/project.py
===================================================================
--- /anuga_work/production/perth/project.py	(revision 6031)
+++ /anuga_work/production/perth/project.py	(revision 6032)
@@ -43,8 +43,8 @@
 # Model specific parameters. One or all can be changed each time the
 # run_scenario script is executed
-tide = 0.6                #0.6
+tide = 0.6               #0.6
 #event_number = 27255 # Java 9.3 worst case for Perth
-event_number = 68693 # Sumatra 9.2
-#event_number = 27283  # Java 9.3 original
+#event_number = 68693 # Sumatra 9.2
+event_number = 27283  # Java 9.3 original
 alpha = 0.1             # smoothing parameter for mesh
 friction=0.01           # manning's friction coefficient
@@ -77,5 +77,5 @@
 # Important to distinguish each run - ensure str(user) is included!
 # Note, the user is free to include as many parameters as desired
-dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
+dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'Rockingham_'+str(user)
 
 #------------------------------------------------------------------------------
@@ -101,5 +101,8 @@
 # gauges - used in get_timeseries.py
 gauge_name = 'perth.csv'
-gauge_name2 = 'thinned_MGA50.csv'
+
+#buildings - used in run_building_inundation.py
+building = 'perth_res_combined'
+
 
 # BOUNDING POLYGON - used in build_boundary.py and run_perth.py respectively
@@ -182,6 +185,6 @@
 
 #w here the directory of the gauges sit
-gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
-gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
+gauges_dir_name = gauges_dir + gauge_name      #used for get_timeseries.py
+building_in_dir_name = gauges_dir + building + '.csv'    #used for run_building_inundation.py
 
 #------------------------------------------------------------------------------
@@ -205,4 +208,8 @@
 res_poly_all = 100000*res_factor
 
+### Area of Interest 1 (Fremantle, increase to reach Perth)
+##poly_aoi1 = read_polygon(polygons_dir+'CBD_increase.csv')
+##res_aoi1 = 500*res_factor
+
 # Area of Interest 1 (Fremantle)
 poly_aoi1 = read_polygon(polygons_dir+'CBD_coastal.csv')
@@ -210,4 +217,8 @@
 
 # Area of Interest 2 (Rockingham)
+poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin_increase.csv')
+res_aoi2 = 500*res_factor
+
+# Area of Interest 2 (Rockingham)
 poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin.csv')
 res_aoi2 = 500*res_factor
@@ -226,5 +237,5 @@
 
 # Area of Significance 1 (Garden Island and sand bank infront of Rockingham)
-poly_aos1 = read_polygon(polygons_dir+'garden_rockingham.csv')
+poly_aos1 = read_polygon(polygons_dir+'garden_rockingham_increase.csv')
 res_aos1 = 1000*res_factor
 
@@ -248,4 +259,8 @@
 
 # Combined all regions, must check that all are included!
+##interior_regions = [[poly_aoi2,res_aoi2], [poly_aos1,res_aos1]
+##                     ,[poly_aos2,res_aos2],[poly_aos3,res_aos3]
+##                     ,[poly_sw1,res_sw1], [poly_dw1,res_dw1]]
+
 interior_regions = [[poly_aoi1,res_aoi1],[poly_aoi2,res_aoi2]
                      ,[poly_aoi2a,res_aoi2a],[poly_aoi3,res_aoi3]
@@ -287,2 +302,8 @@
 ymaxRockingham = 6433000
 
+#Fremantle and Perth extract ascii grid
+xminPerth = 376000
+xmaxPerth = 396000
+yminPerth = 6449000
+ymaxPerth = 6467000
+
Index: /anuga_work/production/perth/run_perth.py
===================================================================
--- /anuga_work/production/perth/run_perth.py	(revision 6031)
+++ /anuga_work/production/perth/run_perth.py	(revision 6032)
@@ -226,4 +226,5 @@
     
     kwargs={}
+    kwargs['file_name']=project.dir_comment
     kwargs['finaltime']=project.finaltime
     kwargs['output_dir']=project.output_run_time_dir
Index: /anuga_work/production/perth/run_perth_250m.py
===================================================================
--- /anuga_work/production/perth/run_perth_250m.py	(revision 6031)
+++ /anuga_work/production/perth/run_perth_250m.py	(revision 6032)
@@ -224,4 +224,5 @@
     
     kwargs={}
+    kwargs['file_name']=project.dir_comment
     kwargs['finaltime']=project_250m.finaltime
     kwargs['output_dir']=project_250m.output_run_time_dir
