Index: anuga_work/production/australia_ph2/bamaga/export_results.py
===================================================================
--- anuga_work/production/australia_ph2/bamaga/export_results.py	(revision 6939)
+++ anuga_work/production/australia_ph2/bamaga/export_results.py	(revision 6939)
@@ -0,0 +1,121 @@
+"""
+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 os.path import join
+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
+
+
+directory = project.output_folder
+
+time_dir1 = '20090408_152655_run_final_0_31975_2000_Tb__mhingee'
+time_dir2 = '20090421_135412_run_final_0_31975_2000_Tb_internal_lfountai'
+##time_dir3 = ''
+##time_dir4 = ''
+##time_dir5 = ''
+##time_dir6 = ''
+##
+time_dirs = [time_dir1, time_dir2]# , time_dir4, time_dir5, time_dir6]
+  
+
+cellsize = 250
+##cellsize = 5
+
+#timestep = None    # None means no timestep!
+timestep = 0
+
+######
+# Set the special areas of interest.  If none, do: area='All'
+######
+
+#area = ['Bunbury', 'Busselton']  # 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 = ['elevation']
+
+######
+# Start running the various conversions we require.
+######
+
+for which_var in var:
+    if which_var not in var_equations:
+        print 'Unrecognized variable name: %s' % which_var
+        break
+
+    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 time_dir in time_dirs:
+
+            name1 = join(directory, time_dir, project.scenario_name)
+            #name2 = join(directory, time_dir, project.scenario_name)+'_time_39600_0'
+            #name3 = join(directory, time_dir, project.scenario_name)+'_time_79200_0'
+
+            names = [name1] #, name2]#, name3]
+      
+           # asc_name = []   
+               
+            for name in names:
+                         
+                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')
+
+##                asc_name.append(outname + '.asc')
+##    
+##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
+##
+##            print 'max asc outname ', maxasc_outname
+##            print 'asc_name ', str(asc_name)
+##            
+##            MaxAsc(maxasc_outname, asc_name)
Index: anuga_work/production/australia_ph2/bamaga/export_results_max.py
===================================================================
--- anuga_work/production/australia_ph2/bamaga/export_results_max.py	(revision 6938)
+++ anuga_work/production/australia_ph2/bamaga/export_results_max.py	(revision 6939)
@@ -22,9 +22,11 @@
 directory = project.output_folder
 
-time_dir1 = '20090424_103709_run_final_0_64977_1914_Tb__jgriffin'
-#time_dir2 = '20090424_165617_run_final_0_71114_1914_Tb__jgriffin'
-#time_dir3 = '20090410_110658_run_final_0_63735_2000_Tb__mhingee'
+##time_dir1 = '20090408_152655_run_final_0_31975_2000_Tb__mhingee'
+##time_dir2 = '20090409_123239_run_final_0_51390_2000_Tb__mhingee'
+##time_dir3 = '20090410_110658_run_final_0_63735_2000_Tb__mhingee'
 
-time_dirs = [time_dir1]#, time_dir2]#, time_dir3]
+time_dir1 = '20090421_135412_run_final_0_31975_2000_Tb_internal_lfountai'
+
+time_dirs = [time_dir1]#, time_dir2, time_dir3]
 
 cellsize = 250
@@ -52,5 +54,5 @@
 
 # one or more key strings from var_equations above
-var = ['stage','elevation']
+var = ['stage']
 
 ######
@@ -82,8 +84,8 @@
 
             name1 = join(directory, time_dir, project.scenario_name)
-            name2 = join(directory, time_dir, project.scenario_name)+'_time_35040_0'
-            name3 = join(directory, time_dir, project.scenario_name)+'_time_70080_0'
-
-            names = [name1, name2, name3]
+##            name2 = join(directory, time_dir, project.scenario_name)+'_time_37920_0'
+            name2 = join(directory, time_dir, project.scenario_name)+'_time_37860_0'
+            
+            names = [name1, name2]
 
             asc_name = []
Index: anuga_work/production/australia_ph2/bundaberg/Arc_asc2raster_GDA94z50.py
===================================================================
--- anuga_work/production/australia_ph2/bundaberg/Arc_asc2raster_GDA94z50.py	(revision 6939)
+++ anuga_work/production/australia_ph2/bundaberg/Arc_asc2raster_GDA94z50.py	(revision 6939)
@@ -0,0 +1,84 @@
+# ---------------------------------------------------------------------------
+# This python script is an ArcGIS script that can only be run on a computer
+# with and ArcGIS licence and version 2.4.1 python.
+# This script is designed to read in .asc files and deliever rasters with
+# projection (GDA94z50) held in a file geodatabase (called raster)
+# written by Kristy Van Putten and Ross Wilson
+# ---------------------------------------------------------------------------
+
+# Import system modules
+import sys, string, os, arcgisscripting, glob, os.path
+
+# Create the Geoprocessor object
+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
+
+scenario_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\australia_ph2\\bundaberg\\"
+output_dir="anuga\\outputs\\"
+
+time_dir1 = '20090408_153233_run_final_0_31756_3274_Tb__mhingee'
+time_dir2 = '20090409_015134_run_final_0_51469_3274_Tb__mhingee'
+time_dir3 = '20090409_112941_run_final_0_62840_3274_Tb__mhingee'
+
+time_dir4 = '20090421_143037_run_final_0_31756_3274_Tb_internal_lfountai'
+
+##time_dirs = [time_dir1, time_dir2, time_dir3]
+time_dirs = [time_dir4]#, time_dir3] time_dir1, 
+
+for time_dir in time_dirs:
+    # Local variables...
+    folder = scenario_dir + output_dir +  time_dir +'\\'
+    raster_gbd = folder + 'raster.gdb'
+##    land = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_condition"
+##    ocean = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_conditions_ocean"
+
+##    print 'Process: Create File GDB'
+##    gp.CreateFileGDB_management(folder, "raster")
+
+    gp.Workspace = raster_gbd
+
+    print gp.Workspace
+    
+    #replication dictionary
+    replicate = (('bundaberg', ''),('_', ''),('max','_M'),
+                 ('CBD', 'CDB'),('All',''),
+                 ('depth','_depth'),('speed', '_speed'),
+                 ('elevation', 'ele_'), ('stage','_stage'))
+
+    generate_filename = []
+    input_ascii = glob.glob(folder + '*elevation.asc')
+
+    for infile in input_ascii:
+        output_DEM = os.path.basename(infile)[:-4]
+        for (key, rep) in replicate:
+            output_DEM = output_DEM.replace(key,rep)
+        output_DEM = output_DEM[:10]
+        if output_DEM in generate_filename:
+            print 'Output_DEM filename (%s) already in use' % output_DEM
+            sys.exit(10)
+        generate_filename.append(output_DEM)
+
+        print 'Output DEM ',output_DEM
+        
+        print 'Process: ASCII to Raster'
+        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
+
+        print 'Process: Define Projection'
+        #GDA_1994_MGA_Zone_54
+        gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_56',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',153.0],PARAMETER['Scale_Factor',0.9996]"
+                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
+##        output_extract = output_DEM + 'E'
+##        print 'Output Extract ',output_extract
+##        print 'Process: Extract by Mask'
+##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
+
+
Index: anuga_work/production/australia_ph2/bundaberg/export_results.py
===================================================================
--- anuga_work/production/australia_ph2/bundaberg/export_results.py	(revision 6939)
+++ anuga_work/production/australia_ph2/bundaberg/export_results.py	(revision 6939)
@@ -0,0 +1,121 @@
+"""
+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 os.path import join
+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
+
+
+directory = project.output_folder
+
+time_dir1 = '20090408_153233_run_final_0_31756_3274_Tb__mhingee'
+time_dir2 = '20090421_143037_run_final_0_31756_3274_Tb_internal_lfountai'
+##time_dir3 = ''
+##time_dir4 = ''
+##time_dir5 = ''
+##time_dir6 = ''
+##
+time_dirs = [time_dir1, time_dir2]# , time_dir4, time_dir5, time_dir6]
+  
+
+cellsize = 250
+##cellsize = 5
+
+#timestep = None    # None means no timestep!
+timestep = 0
+
+######
+# Set the special areas of interest.  If none, do: area='All'
+######
+
+#area = ['Bunbury', 'Busselton']  # 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 = ['elevation']
+
+######
+# Start running the various conversions we require.
+######
+
+for which_var in var:
+    if which_var not in var_equations:
+        print 'Unrecognized variable name: %s' % which_var
+        break
+
+    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 time_dir in time_dirs:
+
+            name1 = join(directory, time_dir, project.scenario_name)
+            #name2 = join(directory, time_dir, project.scenario_name)+'_time_39600_0'
+            #name3 = join(directory, time_dir, project.scenario_name)+'_time_79200_0'
+
+            names = [name1] #, name2]#, name3]
+      
+           # asc_name = []   
+               
+            for name in names:
+                         
+                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')
+
+##                asc_name.append(outname + '.asc')
+##    
+##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
+##
+##            print 'max asc outname ', maxasc_outname
+##            print 'asc_name ', str(asc_name)
+##            
+##            MaxAsc(maxasc_outname, asc_name)
Index: anuga_work/production/australia_ph2/bundaberg/export_results_max.py
===================================================================
--- anuga_work/production/australia_ph2/bundaberg/export_results_max.py	(revision 6938)
+++ anuga_work/production/australia_ph2/bundaberg/export_results_max.py	(revision 6939)
@@ -22,9 +22,11 @@
 directory = project.output_folder
 
-time_dir1 = '20090408_153233_run_final_0_31756_3274_Tb__mhingee'
-time_dir2 = '20090409_015134_run_final_0_51469_3274_Tb__mhingee'
-time_dir3 = '20090409_112941_run_final_0_62840_3274_Tb__mhingee'
+##time_dir1 = '20090408_153233_run_final_0_31756_3274_Tb__mhingee'
+##time_dir2 = '20090409_015134_run_final_0_51469_3274_Tb__mhingee'
+##time_dir3 = '20090409_112941_run_final_0_62840_3274_Tb__mhingee'
 
-time_dirs = [time_dir1, time_dir2, time_dir3]
+time_dir1 = '20090421_143037_run_final_0_31756_3274_Tb_internal_lfountai'
+
+time_dirs = [time_dir1]#, time_dir2, time_dir3]
 
 cellsize = 250
Index: anuga_work/production/australia_ph2/cairns/Arc_asc2raster_GDA94z50.py
===================================================================
--- anuga_work/production/australia_ph2/cairns/Arc_asc2raster_GDA94z50.py	(revision 6939)
+++ anuga_work/production/australia_ph2/cairns/Arc_asc2raster_GDA94z50.py	(revision 6939)
@@ -0,0 +1,84 @@
+# ---------------------------------------------------------------------------
+# This python script is an ArcGIS script that can only be run on a computer
+# with and ArcGIS licence and version 2.4.1 python.
+# This script is designed to read in .asc files and deliever rasters with
+# projection (GDA94z50) held in a file geodatabase (called raster)
+# written by Kristy Van Putten and Ross Wilson
+# ---------------------------------------------------------------------------
+
+# Import system modules
+import sys, string, os, arcgisscripting, glob, os.path
+
+# Create the Geoprocessor object
+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
+
+scenario_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\australia_ph2\\cairns\\"
+output_dir="anuga\\outputs\\"
+
+time_dir1 = '20090408_153044_run_final_0_31975_2172_Tb__mhingee'
+time_dir2 = '20090408_223355_run_final_0_51469_2172_Tb__mhingee'
+time_dir3 = '20090409_055521_run_final_0_63737_2172_Tb__mhingee'
+
+time_dir4 = '20090421_140811_run_final_0_31975_2172_Tb_internal_lfountai'
+
+time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4]
+##time_dirs = [time_dir2, time_dir3]
+
+for time_dir in time_dirs:
+    # Local variables...
+    folder = scenario_dir + output_dir +  time_dir +'\\'
+    raster_gbd = folder + 'raster.gdb'
+##    land = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_condition"
+##    ocean = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_conditions_ocean"
+
+    print 'Process: Create File GDB'
+    gp.CreateFileGDB_management(folder, "raster")
+
+    gp.Workspace = raster_gbd
+
+    print gp.Workspace
+    
+    #replication dictionary
+    replicate = (('cairns', ''),('_', ''),('max','_M'),
+                 ('CBD', 'CDB'),('All',''),
+                 ('depth','_depth'),('speed', '_speed'),
+                 ('elevation', 'ele_'), ('stage','_stage'))
+
+    generate_filename = []
+    input_ascii = glob.glob(folder + '*.asc')
+
+    for infile in input_ascii:
+        output_DEM = os.path.basename(infile)[:-4]
+        for (key, rep) in replicate:
+            output_DEM = output_DEM.replace(key,rep)
+        output_DEM = output_DEM[:10]
+        if output_DEM in generate_filename:
+            print 'Output_DEM filename (%s) already in use' % output_DEM
+            sys.exit(10)
+        generate_filename.append(output_DEM)
+
+        print 'Output DEM ',output_DEM
+        
+        print 'Process: ASCII to Raster'
+        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
+
+        print 'Process: Define Projection'
+        #GDA_1994_MGA_Zone_54
+        gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_55',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',147.0],PARAMETER['Scale_Factor',0.9996]"
+                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
+##        output_extract = output_DEM + 'E'
+##        print 'Output Extract ',output_extract
+##        print 'Process: Extract by Mask'
+##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
+
+
Index: anuga_work/production/australia_ph2/cairns/export_results.py
===================================================================
--- anuga_work/production/australia_ph2/cairns/export_results.py	(revision 6939)
+++ anuga_work/production/australia_ph2/cairns/export_results.py	(revision 6939)
@@ -0,0 +1,121 @@
+"""
+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 os.path import join
+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
+
+
+directory = project.output_folder
+
+time_dir1 = '20090408_153044_run_final_0_31975_2172_Tb__mhingee'
+time_dir2 = '20090421_140811_run_final_0_31975_2172_Tb_internal_lfountai'
+##time_dir3 = ''
+##time_dir4 = ''
+##time_dir5 = ''
+##time_dir6 = ''
+##
+time_dirs = [time_dir1, time_dir2]# , time_dir4, time_dir5, time_dir6]
+  
+
+cellsize = 250
+##cellsize = 5
+
+#timestep = None    # None means no timestep!
+timestep = 0
+
+######
+# Set the special areas of interest.  If none, do: area='All'
+######
+
+#area = ['Bunbury', 'Busselton']  # 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 = ['elevation']
+
+######
+# Start running the various conversions we require.
+######
+
+for which_var in var:
+    if which_var not in var_equations:
+        print 'Unrecognized variable name: %s' % which_var
+        break
+
+    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 time_dir in time_dirs:
+
+            name1 = join(directory, time_dir, project.scenario_name)
+            #name2 = join(directory, time_dir, project.scenario_name)+'_time_39600_0'
+            #name3 = join(directory, time_dir, project.scenario_name)+'_time_79200_0'
+
+            names = [name1] #, name2]#, name3]
+      
+           # asc_name = []   
+               
+            for name in names:
+                         
+                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')
+
+##                asc_name.append(outname + '.asc')
+##    
+##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
+##
+##            print 'max asc outname ', maxasc_outname
+##            print 'asc_name ', str(asc_name)
+##            
+##            MaxAsc(maxasc_outname, asc_name)
Index: anuga_work/production/australia_ph2/cairns/export_results_max.py
===================================================================
--- anuga_work/production/australia_ph2/cairns/export_results_max.py	(revision 6938)
+++ anuga_work/production/australia_ph2/cairns/export_results_max.py	(revision 6939)
@@ -22,9 +22,11 @@
 directory = project.output_folder
 
-time_dir1 = '20090408_153044_run_final_0_31975_2172_Tb__mhingee'
-time_dir2 = '20090408_223355_run_final_0_51469_2172_Tb__mhingee'
-time_dir3 = '20090409_055521_run_final_0_63737_2172_Tb__mhingee'
+##time_dir1 = '20090408_153044_run_final_0_31975_2172_Tb__mhingee'
+##time_dir2 = '20090408_223355_run_final_0_51469_2172_Tb__mhingee'
+##time_dir3 = '20090409_055521_run_final_0_63737_2172_Tb__mhingee'
 
-time_dirs = [time_dir1, time_dir2, time_dir3]
+time_dir1 = '20090421_140811_run_final_0_31975_2172_Tb_internal_lfountai'
+
+time_dirs = [time_dir1]#, time_dir2, time_dir3]
 
 cellsize = 250
Index: anuga_work/production/australia_ph2/cooktown/Arc_asc2raster_GDA94z50.py
===================================================================
--- anuga_work/production/australia_ph2/cooktown/Arc_asc2raster_GDA94z50.py	(revision 6938)
+++ anuga_work/production/australia_ph2/cooktown/Arc_asc2raster_GDA94z50.py	(revision 6939)
@@ -26,10 +26,10 @@
 
 time_dir1 = '20090408_153032_run_final_0_31977_2065_Tb__mhingee'
-time_dir2 = '20090408_214931_run_final_0_51469_2065_Tb__mhingee'
-time_dir3 = '20090409_050811_run_final_0_63735_2065_Tb__mhingee'
+##time_dir2 = '20090408_214931_run_final_0_51469_2065_Tb__mhingee'
+##time_dir3 = '20090409_050811_run_final_0_63735_2065_Tb__mhingee'
 
-##time_dir1 = '20090421_135741_run_final_0_31977_2065_Tb_internal_lfountai'
+##time_dir2 = '20090421_135741_run_final_0_31977_2065_Tb_internal_lfountai'
 
-time_dirs = [time_dir1, time_dir2, time_dir3]
+time_dirs = [time_dir1]#, time_dir2]#, time_dir3]
 
 for time_dir in time_dirs:
@@ -40,6 +40,6 @@
 ##    ocean = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_conditions_ocean"
 
-    print 'Process: Create File GDB'
-    gp.CreateFileGDB_management(folder, "raster")
+##    print 'Process: Create File GDB'
+##    gp.CreateFileGDB_management(folder, "raster")
 
     gp.Workspace = raster_gbd
Index: anuga_work/production/australia_ph2/cooktown/export_results.py
===================================================================
--- anuga_work/production/australia_ph2/cooktown/export_results.py	(revision 6939)
+++ anuga_work/production/australia_ph2/cooktown/export_results.py	(revision 6939)
@@ -0,0 +1,121 @@
+"""
+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 os.path import join
+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
+
+
+directory = project.output_folder
+
+time_dir1 = '20090408_153032_run_final_0_31977_2065_Tb__mhingee'
+time_dir2 = '20090421_135741_run_final_0_31977_2065_Tb_internal_lfountai'
+##time_dir3 = ''
+##time_dir4 = ''
+##time_dir5 = ''
+##time_dir6 = ''
+##
+time_dirs = [time_dir1, time_dir2]# , time_dir4, time_dir5, time_dir6]
+  
+
+cellsize = 250
+##cellsize = 5
+
+#timestep = None    # None means no timestep!
+timestep = 0
+
+######
+# Set the special areas of interest.  If none, do: area='All'
+######
+
+#area = ['Bunbury', 'Busselton']  # 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 = ['elevation']
+
+######
+# Start running the various conversions we require.
+######
+
+for which_var in var:
+    if which_var not in var_equations:
+        print 'Unrecognized variable name: %s' % which_var
+        break
+
+    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 time_dir in time_dirs:
+
+            name1 = join(directory, time_dir, project.scenario_name)
+            #name2 = join(directory, time_dir, project.scenario_name)+'_time_39600_0'
+            #name3 = join(directory, time_dir, project.scenario_name)+'_time_79200_0'
+
+            names = [name1] #, name2]#, name3]
+      
+           # asc_name = []   
+               
+            for name in names:
+                         
+                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')
+
+##                asc_name.append(outname + '.asc')
+##    
+##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
+##
+##            print 'max asc outname ', maxasc_outname
+##            print 'asc_name ', str(asc_name)
+##            
+##            MaxAsc(maxasc_outname, asc_name)
Index: anuga_work/production/australia_ph2/lucinda/Arc_asc2raster_GDA94z50.py
===================================================================
--- anuga_work/production/australia_ph2/lucinda/Arc_asc2raster_GDA94z50.py	(revision 6939)
+++ anuga_work/production/australia_ph2/lucinda/Arc_asc2raster_GDA94z50.py	(revision 6939)
@@ -0,0 +1,84 @@
+# ---------------------------------------------------------------------------
+# This python script is an ArcGIS script that can only be run on a computer
+# with and ArcGIS licence and version 2.4.1 python.
+# This script is designed to read in .asc files and deliever rasters with
+# projection (GDA94z50) held in a file geodatabase (called raster)
+# written by Kristy Van Putten and Ross Wilson
+# ---------------------------------------------------------------------------
+
+# Import system modules
+import sys, string, os, arcgisscripting, glob, os.path
+
+# Create the Geoprocessor object
+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
+
+scenario_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\australia_ph2\\lucinda\\"
+output_dir="anuga\\outputs\\"
+
+time_dir1 = '20090408_153121_run_final_0_31982_2313_Tb__mhingee'
+time_dir2 = '20090408_202614_run_final_0_51311_2313_Tb__mhingee'
+time_dir3 = '20090409_022558_run_final_0_63735_2313_Tb__mhingee'
+
+##time_dir2 = '20090421_140629_run_final_0_31982_2313_Tb_internal_lfountai'
+
+##time_dirs = [time_dir1, time_dir2]#, time_dir3]
+time_dirs = [time_dir2, time_dir3]
+
+for time_dir in time_dirs:
+    # Local variables...
+    folder = scenario_dir + output_dir +  time_dir +'\\'
+    raster_gbd = folder + 'raster.gdb'
+##    land = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_condition"
+##    ocean = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_conditions_ocean"
+
+    print 'Process: Create File GDB'
+    gp.CreateFileGDB_management(folder, "raster")
+
+    gp.Workspace = raster_gbd
+
+    print gp.Workspace
+    
+    #replication dictionary
+    replicate = (('lucinda', ''),('_', ''),('max','_M'),
+                 ('CBD', 'CDB'),('All',''),
+                 ('depth','_depth'),('speed', '_speed'),
+                 ('elevation', '_ele_'), ('stage','_stage'))
+
+    generate_filename = []
+    input_ascii = glob.glob(folder + '*stage.asc')
+
+    for infile in input_ascii:
+        output_DEM = os.path.basename(infile)[:-4]
+        for (key, rep) in replicate:
+            output_DEM = output_DEM.replace(key,rep)
+        output_DEM = output_DEM[:10]
+        if output_DEM in generate_filename:
+            print 'Output_DEM filename (%s) already in use' % output_DEM
+            sys.exit(10)
+        generate_filename.append(output_DEM)
+
+        print 'Output DEM ',output_DEM
+        
+        print 'Process: ASCII to Raster'
+        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
+
+        print 'Process: Define Projection'
+        #GDA_1994_MGA_Zone_54
+        gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_55',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',147.0],PARAMETER['Scale_Factor',0.9996]"
+                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
+##        output_extract = output_DEM + 'E'
+##        print 'Output Extract ',output_extract
+##        print 'Process: Extract by Mask'
+##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
+
+
Index: anuga_work/production/australia_ph2/lucinda/export_results.py
===================================================================
--- anuga_work/production/australia_ph2/lucinda/export_results.py	(revision 6939)
+++ anuga_work/production/australia_ph2/lucinda/export_results.py	(revision 6939)
@@ -0,0 +1,121 @@
+"""
+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 os.path import join
+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
+
+
+directory = project.output_folder
+
+time_dir1 = '20090408_153121_run_final_0_31982_2313_Tb__mhingee'
+time_dir2 = '20090421_140629_run_final_0_31982_2313_Tb_internal_lfountai'
+##time_dir3 = ''
+##time_dir4 = ''
+##time_dir5 = ''
+##time_dir6 = ''
+##
+time_dirs = [time_dir1, time_dir2]# , time_dir4, time_dir5, time_dir6]
+  
+
+cellsize = 250
+##cellsize = 5
+
+#timestep = None    # None means no timestep!
+timestep = 0
+
+######
+# Set the special areas of interest.  If none, do: area='All'
+######
+
+#area = ['Bunbury', 'Busselton']  # 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 = ['elevation']
+
+######
+# Start running the various conversions we require.
+######
+
+for which_var in var:
+    if which_var not in var_equations:
+        print 'Unrecognized variable name: %s' % which_var
+        break
+
+    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 time_dir in time_dirs:
+
+            name1 = join(directory, time_dir, project.scenario_name)
+            #name2 = join(directory, time_dir, project.scenario_name)+'_time_39600_0'
+            #name3 = join(directory, time_dir, project.scenario_name)+'_time_79200_0'
+
+            names = [name1] #, name2]#, name3]
+      
+           # asc_name = []   
+               
+            for name in names:
+                         
+                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')
+
+##                asc_name.append(outname + '.asc')
+##    
+##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
+##
+##            print 'max asc outname ', maxasc_outname
+##            print 'asc_name ', str(asc_name)
+##            
+##            MaxAsc(maxasc_outname, asc_name)
Index: anuga_work/production/australia_ph2/lucinda/export_results_max.py
===================================================================
--- anuga_work/production/australia_ph2/lucinda/export_results_max.py	(revision 6938)
+++ anuga_work/production/australia_ph2/lucinda/export_results_max.py	(revision 6939)
@@ -22,9 +22,11 @@
 directory = project.output_folder
 
-time_dir1 = '20090408_153121_run_final_0_31982_2313_Tb__mhingee'
-time_dir2 = '20090408_202614_run_final_0_51311_2313_Tb__mhingee'
-time_dir3 = '20090409_022558_run_final_0_63735_2313_Tb__mhingee'
+##time_dir1 = '20090408_153121_run_final_0_31982_2313_Tb__mhingee'
+##time_dir2 = '20090408_202614_run_final_0_51311_2313_Tb__mhingee'
+##time_dir3 = '20090409_022558_run_final_0_63735_2313_Tb__mhingee'
 
-time_dirs = [time_dir1, time_dir2, time_dir3]
+time_dir1 = '20090421_140629_run_final_0_31982_2313_Tb_internal_lfountai'
+
+time_dirs = [time_dir1]#, time_dir2, time_dir3]
 
 cellsize = 250
Index: anuga_work/production/australia_ph2/rockhampton/Arc_asc2raster_GDA94z50.py
===================================================================
--- anuga_work/production/australia_ph2/rockhampton/Arc_asc2raster_GDA94z50.py	(revision 6939)
+++ anuga_work/production/australia_ph2/rockhampton/Arc_asc2raster_GDA94z50.py	(revision 6939)
@@ -0,0 +1,84 @@
+# ---------------------------------------------------------------------------
+# This python script is an ArcGIS script that can only be run on a computer
+# with and ArcGIS licence and version 2.4.1 python.
+# This script is designed to read in .asc files and deliever rasters with
+# projection (GDA94z50) held in a file geodatabase (called raster)
+# written by Kristy Van Putten and Ross Wilson
+# ---------------------------------------------------------------------------
+
+# Import system modules
+import sys, string, os, arcgisscripting, glob, os.path
+
+# Create the Geoprocessor object
+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
+
+scenario_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\australia_ph2\\rockhampton\\"
+output_dir="anuga\\outputs\\"
+
+time_dir1 = '20090408_153436_run_final_0_31939_3163_Tb__mhingee'
+time_dir2 = '20090409_043830_run_final_0_51314_3163_Tb__mhingee'
+time_dir3 = '20090409_192933_run_final_0_63737_3163_Tb__mhingee'
+
+time_dir4 = '20090421_142658_run_final_0_31939_3163_Tb_internal_lfountai'
+
+##time_dirs = [time_dir1, time_dir2, time_dir3]
+time_dirs = [time_dir1, time_dir4]#, time_dir3]
+
+for time_dir in time_dirs:
+    # Local variables...
+    folder = scenario_dir + output_dir +  time_dir +'\\'
+    raster_gbd = folder + 'raster.gdb'
+##    land = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_condition"
+##    ocean = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_conditions_ocean"
+
+##    print 'Process: Create File GDB'
+##    gp.CreateFileGDB_management(folder, "raster")
+
+    gp.Workspace = raster_gbd
+
+    print gp.Workspace
+    
+    #replication dictionary
+    replicate = (('rockhampton', ''),('_', ''),('max','_M'),
+                 ('CBD', 'CDB'),('All',''),
+                 ('depth','_depth'),('speed', '_speed'),
+                 ('elevation', 'ele_'), ('stage','_stage'))
+
+    generate_filename = []
+    input_ascii = glob.glob(folder + '*elevation.asc')
+
+    for infile in input_ascii:
+        output_DEM = os.path.basename(infile)[:-4]
+        for (key, rep) in replicate:
+            output_DEM = output_DEM.replace(key,rep)
+        output_DEM = output_DEM[:10]
+        if output_DEM in generate_filename:
+            print 'Output_DEM filename (%s) already in use' % output_DEM
+            sys.exit(10)
+        generate_filename.append(output_DEM)
+
+        print 'Output DEM ',output_DEM
+        
+        print 'Process: ASCII to Raster'
+        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
+
+        print 'Process: Define Projection'
+        #GDA_1994_MGA_Zone_54
+        gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_56',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',153.0],PARAMETER['Scale_Factor',0.9996]"
+                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
+##        output_extract = output_DEM + 'E'
+##        print 'Output Extract ',output_extract
+##        print 'Process: Extract by Mask'
+##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
+
+
Index: anuga_work/production/australia_ph2/rockhampton/export_results.py
===================================================================
--- anuga_work/production/australia_ph2/rockhampton/export_results.py	(revision 6939)
+++ anuga_work/production/australia_ph2/rockhampton/export_results.py	(revision 6939)
@@ -0,0 +1,121 @@
+"""
+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 os.path import join
+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
+
+
+directory = project.output_folder
+
+time_dir1 = '20090408_153436_run_final_0_31939_3163_Tb__mhingee'
+time_dir2 = '20090421_142658_run_final_0_31939_3163_Tb_internal_lfountai'
+##time_dir3 = ''
+##time_dir4 = ''
+##time_dir5 = ''
+##time_dir6 = ''
+##
+time_dirs = [time_dir1, time_dir2]# , time_dir4, time_dir5, time_dir6]
+  
+
+cellsize = 250
+##cellsize = 5
+
+#timestep = None    # None means no timestep!
+timestep = 0
+
+######
+# Set the special areas of interest.  If none, do: area='All'
+######
+
+#area = ['Bunbury', 'Busselton']  # 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 = ['elevation']
+
+######
+# Start running the various conversions we require.
+######
+
+for which_var in var:
+    if which_var not in var_equations:
+        print 'Unrecognized variable name: %s' % which_var
+        break
+
+    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 time_dir in time_dirs:
+
+            name1 = join(directory, time_dir, project.scenario_name)
+            #name2 = join(directory, time_dir, project.scenario_name)+'_time_39600_0'
+            #name3 = join(directory, time_dir, project.scenario_name)+'_time_79200_0'
+
+            names = [name1] #, name2]#, name3]
+      
+           # asc_name = []   
+               
+            for name in names:
+                         
+                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')
+
+##                asc_name.append(outname + '.asc')
+##    
+##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
+##
+##            print 'max asc outname ', maxasc_outname
+##            print 'asc_name ', str(asc_name)
+##            
+##            MaxAsc(maxasc_outname, asc_name)
Index: anuga_work/production/australia_ph2/rockhampton/export_results_max.py
===================================================================
--- anuga_work/production/australia_ph2/rockhampton/export_results_max.py	(revision 6938)
+++ anuga_work/production/australia_ph2/rockhampton/export_results_max.py	(revision 6939)
@@ -26,5 +26,7 @@
 time_dir3 = '20090409_192933_run_final_0_63737_3163_Tb__mhingee'
 
-time_dirs = [time_dir1, time_dir2, time_dir3]
+time_dir1 = '20090421_142658_run_final_0_31939_3163_Tb_internal_lfountai'
+
+time_dirs = [time_dir1]#, time_dir2, time_dir3]
 
 cellsize = 250
@@ -82,6 +84,7 @@
 
             name1 = join(directory, time_dir, project.scenario_name)
-            name2 = join(directory, time_dir, project.scenario_name)+'_time_54300_0'
-
+##            name2 = join(directory, time_dir, project.scenario_name)+'_time_54300_0'
+            name2 = join(directory, time_dir, project.scenario_name)+'_time_54240_0'
+            
             names = [name1, name2]
 
Index: anuga_work/production/australia_ph2/townsville/Arc_asc2raster_GDA94z50.py
===================================================================
--- anuga_work/production/australia_ph2/townsville/Arc_asc2raster_GDA94z50.py	(revision 6939)
+++ anuga_work/production/australia_ph2/townsville/Arc_asc2raster_GDA94z50.py	(revision 6939)
@@ -0,0 +1,84 @@
+# ---------------------------------------------------------------------------
+# This python script is an ArcGIS script that can only be run on a computer
+# with and ArcGIS licence and version 2.4.1 python.
+# This script is designed to read in .asc files and deliever rasters with
+# projection (GDA94z50) held in a file geodatabase (called raster)
+# written by Kristy Van Putten and Ross Wilson
+# ---------------------------------------------------------------------------
+
+# Import system modules
+import sys, string, os, arcgisscripting, glob, os.path
+
+# Create the Geoprocessor object
+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
+
+scenario_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\australia_ph2\\townsville\\"
+output_dir="anuga\\outputs\\"
+
+time_dir1 = '20090414_104809_run_final_0_31965_2740_Tb__kvanputt'
+time_dir2 = '20090420_064036_run_final_0_51469_2740_Tb__kvanputt'
+##time_dir3 = '20090429_145415_run_final_0_62890_2740_Tb__mhingee'
+
+time_dir3 = '20090421_141635_run_final_0_31965_2740_Tb_internal_lfountai'
+
+##time_dirs = [time_dir1, time_dir2, time_dir3]
+time_dirs = [time_dir1, time_dir3]
+
+for time_dir in time_dirs:
+    # Local variables...
+    folder = scenario_dir + output_dir +  time_dir +'\\'
+    raster_gbd = folder + 'raster.gdb'
+##    land = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_condition"
+##    ocean = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_conditions_ocean"
+
+##    print 'Process: Create File GDB'
+##    gp.CreateFileGDB_management(folder, "raster")
+
+    gp.Workspace = raster_gbd
+
+    print gp.Workspace
+    
+    #replication dictionary
+    replicate = (('townsville', ''),('_', ''),('max','_M'),
+                 ('CBD', 'CDB'),('All',''),
+                 ('depth','_depth'),('speed', '_speed'),
+                 ('elevation', 'ele_'), ('stage','_stage'))
+
+    generate_filename = []
+    input_ascii = glob.glob(folder + '*elevation.asc')
+
+    for infile in input_ascii:
+        output_DEM = os.path.basename(infile)[:-4]
+        for (key, rep) in replicate:
+            output_DEM = output_DEM.replace(key,rep)
+        output_DEM = output_DEM[:10]
+        if output_DEM in generate_filename:
+            print 'Output_DEM filename (%s) already in use' % output_DEM
+            sys.exit(10)
+        generate_filename.append(output_DEM)
+
+        print 'Output DEM ',output_DEM
+        
+        print 'Process: ASCII to Raster'
+        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
+
+        print 'Process: Define Projection'
+        #GDA_1994_MGA_Zone_54
+        gp.DefineProjection_management(output_DEM, "PROJCS['CM_149',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',149.0],PARAMETER['Scale_Factor',0.9996]"
+                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
+##        output_extract = output_DEM + 'E'
+##        print 'Output Extract ',output_extract
+##        print 'Process: Extract by Mask'
+##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
+
+
Index: anuga_work/production/australia_ph2/townsville/export_results.py
===================================================================
--- anuga_work/production/australia_ph2/townsville/export_results.py	(revision 6939)
+++ anuga_work/production/australia_ph2/townsville/export_results.py	(revision 6939)
@@ -0,0 +1,121 @@
+"""
+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 os.path import join
+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
+
+
+directory = project.output_folder
+
+time_dir1 = '20090414_104809_run_final_0_31965_2740_Tb__kvanputt'
+time_dir2 = '20090421_141635_run_final_0_31965_2740_Tb_internal_lfountai'
+##time_dir3 = ''
+##time_dir4 = ''
+##time_dir5 = ''
+##time_dir6 = ''
+##
+time_dirs = [time_dir1, time_dir2]# , time_dir4, time_dir5, time_dir6]
+  
+
+cellsize = 250
+##cellsize = 5
+
+#timestep = None    # None means no timestep!
+timestep = 0
+
+######
+# Set the special areas of interest.  If none, do: area='All'
+######
+
+#area = ['Bunbury', 'Busselton']  # 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 = ['elevation']
+
+######
+# Start running the various conversions we require.
+######
+
+for which_var in var:
+    if which_var not in var_equations:
+        print 'Unrecognized variable name: %s' % which_var
+        break
+
+    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 time_dir in time_dirs:
+
+            name1 = join(directory, time_dir, project.scenario_name)
+            #name2 = join(directory, time_dir, project.scenario_name)+'_time_39600_0'
+            #name3 = join(directory, time_dir, project.scenario_name)+'_time_79200_0'
+
+            names = [name1] #, name2]#, name3]
+      
+           # asc_name = []   
+               
+            for name in names:
+                         
+                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')
+
+##                asc_name.append(outname + '.asc')
+##    
+##            maxasc_outname = join(directory, time_dir, project.scenario_name)+'_'+which_area+'_'+which_var+'_max.asc'
+##
+##            print 'max asc outname ', maxasc_outname
+##            print 'asc_name ', str(asc_name)
+##            
+##            MaxAsc(maxasc_outname, asc_name)
Index: anuga_work/production/australia_ph2/townsville/export_results_max.py
===================================================================
--- anuga_work/production/australia_ph2/townsville/export_results_max.py	(revision 6938)
+++ anuga_work/production/australia_ph2/townsville/export_results_max.py	(revision 6939)
@@ -22,12 +22,12 @@
 directory = project.output_folder
 
-time_dir1 = '20090306_131720_run_final_0_64448_1889_Tb_mhingee'
-time_dir2 = '20090306_165354_run_final_0_58331_1889_Tb_mhingee'
-time_dir3 = '20090306_165528_run_final_0_27347_1889_Tb_mhingee'
-##time_dir4 = ''
+time_dir1 = '20090414_104809_run_final_0_31965_2740_Tb__kvanputt'
+time_dir2 = '20090420_064036_run_final_0_51469_2740_Tb__kvanputt'
+time_dir3 = '20090421_141635_run_final_0_31965_2740_Tb_internal_lfountai'
+time_dir4 = ''
 ##time_dir5 = ''
 ##time_dir6 = ''
 ##
-time_dirs = [time_dir1, time_dir2, time_dir3] #time_dir2]# , time_dir4, time_dir5, time_dir6]
+time_dirs = [time_dir1]#, time_dir2, time_dir3] #time_dir2]# , time_dir4, time_dir5, time_dir6]
   
 
@@ -56,5 +56,5 @@
 
 # one or more key strings from var_equations above
-var = ['elevation','stage']
+var = ['stage']
 
 ######
@@ -86,10 +86,10 @@
 
             name1 = join(directory, time_dir, project.scenario_name)
-            #name2 = join(directory, time_dir, project.scenario_name)+'_time_39600_0'
-            #name3 = join(directory, time_dir, project.scenario_name)+'_time_79200_0'
+            name2 = join(directory, time_dir, project.scenario_name)+'_time_24060_0'
+            name3 = join(directory, time_dir, project.scenario_name)+'_time_48120_0'
 
-            names = [name1] #, name2]#, name3]
+            names = [name1, name2, name3]
       
-           # asc_name = []   
+            asc_name = []   
                
             for name in names:
Index: anuga_work/production/australia_ph2/townsville/project.py
===================================================================
--- anuga_work/production/australia_ph2/townsville/project.py	(revision 6938)
+++ anuga_work/production/australia_ph2/townsville/project.py	(revision 6939)
@@ -32,7 +32,7 @@
     event_number = int(sys.argv[1])
 else:    
-    event_number = 31965    # the event number or the mux file name
-
-event_number_list = [31965, 51469, 65840] # To piggy back multiple events
+    event_number = 62890    # the event number or the mux file name
+
+event_number_list = [31965, 51469, 62890] # To piggy back multiple events
 
 tide = 0                # difference between MSL and HAT
