Index: /anuga_work/production/australia_ph2/bamaga/export_results.py
===================================================================
--- /anuga_work/production/australia_ph2/bamaga/export_results.py	(revision 6977)
+++ /anuga_work/production/australia_ph2/bamaga/export_results.py	(revision 6977)
@@ -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 6976)
+++ /anuga_work/production/australia_ph2/bamaga/export_results_max.py	(revision 6977)
@@ -22,9 +22,11 @@
 directory = project.output_folder
 
-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_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
@@ -82,6 +84,7 @@
 
             name1 = join(directory, time_dir, project.scenario_name)
-            name2 = join(directory, time_dir, project.scenario_name)+'_time_37920_0'
-
+##            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]
 
