Index: anuga_validation/automated_validation_tests/README.txt
===================================================================
--- anuga_validation/automated_validation_tests/README.txt	(revision 7267)
+++ anuga_validation/automated_validation_tests/README.txt	(revision 7276)
@@ -4,5 +4,22 @@
 
 The validation tests take the form of automated unit tests except that they 
-all test the whole system rather than individual components and that they generally take considerably longer time to execute than normal unittests.
+all test the whole system rather than individual components and that they
+generally take considerably longer time to execute than normal unittests.
 
 The master script, validate_all.py, will run through all tests.  
+
+NOTE: In some circumstances there may be problems running validate_all.py
+IF MORE THAN ONE PYTHON IS INSTALLED.  The workaround is to:
+1. Decide which python you want to use, and get the absolute path to that
+   executable ('which python2.5', for example)
+2. Create a local 'bin' directory:
+       mkdir ~/bin
+3. Create a 'python' link in that directory to the python executable:
+       ln -s ~/bin/python <path_from_step_1>
+4. Create or modify your PATH variable in ~/.bashrc to include:
+       export PATH=$HOME/bin:$PATH
+   That is, ensure your 'local' bin is searched first
+5. Remove any 'python' alias you may have defined in ~/.bashrc (or elsewhere)
+6. Ensure all the above changes are in effect by opening a new terminal
+
+The above workaround was tested under Linux.  Not sure about Windows.
Index: anuga_validation/automated_validation_tests/UQ_runup_2006/Dam break_240406_0011.lic
===================================================================
--- anuga_validation/automated_validation_tests/UQ_runup_2006/Dam break_240406_0011.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/UQ_runup_2006/Dam break_240406_0011.lic	(revision 7276)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-  <ga_license_file>
+<?xml version='1.0' encoding='iso-8859-1'?>
+<ga_license_file>
     <metadata>
       <author>Duncan Gray</author>
Index: anuga_validation/automated_validation_tests/UQ_runup_2006/actual.lic
===================================================================
--- anuga_validation/automated_validation_tests/UQ_runup_2006/actual.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/UQ_runup_2006/actual.lic	(revision 7276)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-  <ga_license_file>
+<?xml version='1.0' encoding='iso-8859-1'?>
+<ga_license_file>
     <metadata>
       <author>Duncan Gray</author>
Index: anuga_validation/automated_validation_tests/fitting/validate_benchmark_fit.py
===================================================================
--- anuga_validation/automated_validation_tests/fitting/validate_benchmark_fit.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/fitting/validate_benchmark_fit.py	(revision 7276)
@@ -24,4 +24,8 @@
 mem 30200
 
+2009 June 22 - RW
+Changed the time/memory values to be exactly those found on the hardware.
+Took 10 measurements, used maximum in found values.
+
 """
 
@@ -34,5 +38,4 @@
     def setUp(self):
         pass
-        
 
     def tearDown(self):
@@ -45,80 +48,52 @@
     # That's because v4872 is using geo-ref, whereas the
     # previous version did not.
+
     def test_fit_time_and_mem(self):
         import socket
+
+        # get hostname - for *nix and Windows
         host =  socket.gethostname()
-        #print "host", host
+
+        # define dictionary of expected time/memory usage per machine.
+        # key must be unique *prefix* of machine name, lowercase.
+        # value is tuple: (time, memory) in seconds and KiB.
+        expected_results = {'tornado':  (10.8, 40468),  # tornado headnode
+                            'cyclone':  (7.4,  40468),  # cyclone headnode
+                            'compute':  (10.8, 40468),  # cluster computenode
+                            'nautilus': (8.1,  16104),  # Ole's 32bit Ubuntu
+                            'bogong':   (14.2, 30000),  # ANU?
+                            'pc-31569': (31.6, 15000),  # DSG's PC?
+                            'pc-32572': (12.8, 15788),  # Ross' 32bit work Ubuntu
+                            'saturn':   (12.8, 39404)   # Ross' 64bit home Ubuntu
+                           } 
+
+        # run trial, report on time and memory
         ben = BenchmarkLeastSquares()
-        time, mem, num_tri, one_t, more_t, quad_t = ben.trial(
-            num_of_points=1000
-            ,maxArea=0.0001
-            ,is_fit=True
-            ,segments_in_mesh=False
-            ,use_file_type='pts'
-            ,save=False
-            )
-            
-            
-        #print "time", time
-        #print "mem", mem
+        (time, mem, num_tri, one_t,
+         more_t, quad_t) = ben.trial(num_of_points=1000,
+                                     maxArea=0.0001,
+                                     is_fit=True,
+                                     segments_in_mesh=False,
+                                     use_file_type='pts',
+                                     save=False
+                                    )
 
-        #Defaults
-        time_standard = 120.
-        mem_standard = 50000
-        
-        if host.find('tornado') == 0:
-            # Tornado headnode
-            #time_standard = 14.5
-            time_standard = 24.
-            mem_standard = 40468 
-            
-        elif host.find('compute') == 0: # cyclone or tornado node
-            time_standard = 19.0
-            mem_standard = 40468
+        # Get expected machine values, else a default set of values
+        time_standard = 15.0        # max of above, plus a little
+        mem_standard = 40000
+        for key in expected_results:
+            if host.lower().startswith(key):
+                (time_standard, mem_standard) = expected_results[key]
+                break
 
-        elif host.find('cyclone') == 0: # cyclone headnode
-            time_standard = 13.3
-            mem_standard = 40468
-            #mem_standard = 29424
-
-        elif host.find('nautilus') == 0:
-            time_standard = 27.6
-            
-            # v 4910 is giving a mem of 15572
-            mem_standard = 16104 
-            
-
-        elif host.find('bogong') == 0:
-            time_standard = 14.2
-            mem_standard = 30000 # Updated by Ole 20080507
-
-
-        elif host.find('pc-31569') == 0: # DSG's PC
-            time_standard = 31.6
-            mem_standard = 15000 #?
-
-        elif host.find('PC-32572') == 0: # Ross' Ubuntu box - nump trunk
-            time_standard = 12.8
-            mem_standard = 15788 #?
-
-            """
-            test_fit_time_and_mem (__main__.Test_uq) ...  very start mem_usage() 98076
- before fitting mem_usage() 120012
- after fitting mem_usage() 150212
-time 15.19490695
-mem 30200
-
-test_fit_time_and_mem (__main__.Test_uq) ...  very start mem_usage() 98108
- before fitting mem_usage() 134696
- after fitting mem_usage() 155820
-
-            """
-        
-        # Do the assertions here
+        # don't want exception here, report on time *and* memory
+        got_error = False
         msg = ('Time used was %.1f s, standard is %.1f s +20%% (%.1f s)'
                % (time, time_standard, int(time_standard*1.2)))
-        assert time < time_standard*1.2, msg
-
-
+        #print msg
+        #assert time < time_standard*1.2, msg
+        if time > time_standard*1.2:
+            print msg
+            got_error = True
 
         if sys.platform == 'win32':
@@ -135,5 +110,9 @@
         msg = ('Memory used was %d KiB, standard is %d KiB +20%% (%d KiB)'
                % (mem, mem_standard, int(mem_standard*1.2)))
+        #print msg
         assert mem < mem_standard*1.2, msg            
+
+        if got_error:
+            raise RuntimeError
             
 #-------------------------------------------------------------
Index: anuga_validation/automated_validation_tests/flow_tests/test_inflow_using_flowline.py
===================================================================
--- anuga_validation/automated_validation_tests/flow_tests/test_inflow_using_flowline.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/flow_tests/test_inflow_using_flowline.py	(revision 7276)
@@ -9,5 +9,5 @@
 
 verbose = True
-import Numeric as num
+import numpy as num
 
 #------------------------------------------------------------------------------
Index: anuga_validation/automated_validation_tests/okushiri_tank_validation/Benchmark_2_Bathymetry.lic
===================================================================
--- anuga_validation/automated_validation_tests/okushiri_tank_validation/Benchmark_2_Bathymetry.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/okushiri_tank_validation/Benchmark_2_Bathymetry.lic	(revision 7276)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
+<?xml version='1.0' encoding='iso-8859-1'?>
 <ga_license_file>
   <metadata>
Index: anuga_validation/automated_validation_tests/okushiri_tank_validation/Benchmark_2_input.lic
===================================================================
--- anuga_validation/automated_validation_tests/okushiri_tank_validation/Benchmark_2_input.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/okushiri_tank_validation/Benchmark_2_input.lic	(revision 7276)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
+<?xml version='1.0' encoding='iso-8859-1'?>
 <ga_license_file>
   <metadata>
Index: anuga_validation/automated_validation_tests/okushiri_tank_validation/compare_timeseries_with_measures.py
===================================================================
--- anuga_validation/automated_validation_tests/okushiri_tank_validation/compare_timeseries_with_measures.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/okushiri_tank_validation/compare_timeseries_with_measures.py	(revision 7276)
@@ -6,5 +6,5 @@
 """
 
-import Numeric as num
+import numpy as num
 from Scientific.IO.NetCDF import NetCDFFile
 
Index: anuga_validation/automated_validation_tests/okushiri_tank_validation/create_okushiri.py
===================================================================
--- anuga_validation/automated_validation_tests/okushiri_tank_validation/create_okushiri.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/okushiri_tank_validation/create_okushiri.py	(revision 7276)
@@ -3,5 +3,5 @@
 
 
-import Numeric as num
+import numpy as num
 
 from anuga.pmesh.mesh import *
@@ -9,4 +9,5 @@
 from anuga.coordinate_transforms.geo_reference import Geo_reference
 from anuga.geospatial_data import Geospatial_data
+from anuga.config import netcdf_float
 
 import project
@@ -111,6 +112,6 @@
 
     N = len(lines)
-    T = num.zeros(N, num.Float)  #Time
-    Q = num.zeros(N, num.Float)  #Values
+    T = num.zeros(N, num.float)  #Time
+    Q = num.zeros(N, num.float)  #Values
 
     for i, line in enumerate(lines):
@@ -128,14 +129,14 @@
     fid.starttime = 0.0
     fid.createDimension('number_of_timesteps', len(T))
-    fid.createVariable('time', num.Float, ('number_of_timesteps',))
+    fid.createVariable('time', netcdf_float, ('number_of_timesteps',))
     fid.variables['time'][:] = T
 
-    fid.createVariable('stage', num.Float, ('number_of_timesteps',))
+    fid.createVariable('stage', netcdf_float, ('number_of_timesteps',))
     fid.variables['stage'][:] = Q[:]
 
-    fid.createVariable('xmomentum', num.Float, ('number_of_timesteps',))
+    fid.createVariable('xmomentum', netcdf_float, ('number_of_timesteps',))
     fid.variables['xmomentum'][:] = 0.0
 
-    fid.createVariable('ymomentum', num.Float, ('number_of_timesteps',))
+    fid.createVariable('ymomentum', netcdf_float, ('number_of_timesteps',))
     fid.variables['ymomentum'][:] = 0.0
 
Index: anuga_validation/automated_validation_tests/okushiri_tank_validation/output_ch5-7-9.lic
===================================================================
--- anuga_validation/automated_validation_tests/okushiri_tank_validation/output_ch5-7-9.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/okushiri_tank_validation/output_ch5-7-9.lic	(revision 7276)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
+<?xml version='1.0' encoding='iso-8859-1'?>
 <ga_license_file>
   <metadata>
@@ -8,5 +7,5 @@
   <datafile>
     <filename>output_ch5-7-9.txt</filename>
-    <checksum>-1044604103</checksum>
+    <checksum>3250363193</checksum>
     <publishable>Yes</publishable>
     <accountable>Ole Nielsen</accountable>
Index: anuga_validation/automated_validation_tests/okushiri_tank_validation/test_caching_of_set_quantity.py
===================================================================
--- anuga_validation/automated_validation_tests/okushiri_tank_validation/test_caching_of_set_quantity.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/okushiri_tank_validation/test_caching_of_set_quantity.py	(revision 7276)
@@ -13,5 +13,5 @@
 from anuga.fit_interpolate.fit import _fit_to_mesh
 import project
-import Numeric as num
+import numpy as num
 import time
 
Index: anuga_validation/automated_validation_tests/patong_beach_validation/build_urs_boundary.py
===================================================================
--- anuga_validation/automated_validation_tests/patong_beach_validation/build_urs_boundary.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/patong_beach_validation/build_urs_boundary.py	(revision 7276)
@@ -11,9 +11,7 @@
 
 from Scientific.IO.NetCDF import NetCDFFile
-import Numeric as num
+import numpy as num
 
 from anuga.shallow_water.data_manager import urs2sts
-
-import Numeric as num
 
 
@@ -148,5 +146,5 @@
 
         weight_factor = 1.0
-        mux_weights = weight_factor*num.ones(len(mux_filenames), num.Float)
+        mux_weights = weight_factor*num.ones(len(mux_filenames), num.float)
             
         order_filename = project.urs_order
Index: anuga_validation/automated_validation_tests/patong_beach_validation/cmpsww.py
===================================================================
--- anuga_validation/automated_validation_tests/patong_beach_validation/cmpsww.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/patong_beach_validation/cmpsww.py	(revision 7276)
@@ -13,5 +13,5 @@
 import getopt
 from Scientific.IO.NetCDF import NetCDFFile
-import Numeric as num
+import numpy as num
 from anuga.config import netcdf_mode_r
 
@@ -21,6 +21,10 @@
 #####
 
-# allowable 'slop' when testing two float values
-epsilon = 1.0e-9
+# Global for the '-q' quiet flag
+quiet = None
+
+# default tolerances - same as numpy defaults
+default_abs_tolerance = 1.0e-08
+default_rel_tolerance = 1.0000000000000001e-05
 
 # Global attributes that should exist and be same in both files
@@ -69,5 +73,7 @@
 # @param variables A list of variable names to compare.
 # @return Returns if files 'equal', else raises RuntimeError.
-def files_are_the_same(files, globals=None, timesteps=None, variables=None):
+def files_are_the_same(files, globals=None, timesteps=None, variables=None,
+                       rel_tolerance=default_rel_tolerance,
+                       abs_tolerance=default_abs_tolerance):
     # split out the filenames and check they exist
     (file1, file2) = files
@@ -222,14 +228,21 @@
     #####
 
+    error_msg = ''
+    glob_vars_bad = {}
+    data_vars_bad = {}
+
     # check values of global attributes
     for glob_name in globals:
         if getattr(fid1, glob_name) != getattr(fid2, glob_name):
-            error_msg += ("\nFiles differ in global '%s':\n"
-                          "%s: '%s',\n"
-                          "%s: '%s'\n"
-                          % (glob_name, filename1, str(g1), filename2, str(g2)))
+            print("\nFiles differ in global '%s':\n"
+                  "%s: '%s',\n"
+                  "%s: '%s'"
+                  % (glob_name, filename1, str(g1), filename2, str(g2)))
+            glob_vars_bad[glob_name] = glob_vars_bad.get(glob_name, 0) + 1
             error = True
 
     # check data variables, be clever with time series data
+    max_rel_difference = -1
+    diff_count = 0
     for var_name in variables:
         var_dims = expected_variables[var_name]
@@ -239,35 +252,70 @@
                 var1 = num.array(fid1.variables[var_name][t,:])
                 var2 = num.array(fid2.variables[var_name][t,:])
-                if var1 != var2:
+                if not num.allclose(var1, var2,
+                                    rtol=rel_tolerance, atol=abs_tolerance):
+                    error = True
                     for i in xrange(len(var1)):
-                        if var1[i] != var2[i]:
-                            error_msg += ('\nFiles differ in variable '
-                                              '%s[%d,%d]:\n'
-                                          '%s: %f\n'
-                                          '%s: %f\n'
-                                          'difference=%f\n'
-                                          % (var_name, t, i,
-                                             filename1, var1[i],
-                                             filename2, var2[i],
-                                             var1[i]-var2[i]))
-                            break
-                    error = True
+                        if not num.allclose(var1[i], var2[i],
+                                            rtol=rel_tolerance,
+                                            atol=abs_tolerance):
+                            abs_difference = num.abs(var1[i]-var2[i])
+                            max_a_b = num.max(num.abs(var1[i]),
+                                              num.abs(var2[i]))
+                            rel_difference = num.abs(abs_difference/max_a_b)
+
+                            if not quiet:
+                                print('\nFiles differ in variable '
+                                      '%s[%d,%d]:\n'
+                                      '%s: %f\n'
+                                      '%s: %f\n'
+                                      'abs. difference=%e, rel. difference=%e\n'
+                                      % (var_name, t, i,
+                                         filename1, var1[i],
+                                         filename2, var2[i],
+                                         abs_difference,
+                                         rel_difference))
+
+                            if rel_difference > max_rel_difference:
+                                max_rel_difference = rel_difference
+                                max_rel_difference_abs = abs_difference
+                                max_rel_difference_a = var1[i]
+                                max_rel_difference_b = var2[i]
+
+                            data_vars_bad[var_name] = data_vars_bad.get(var_name, 0) + 1
+                            diff_count += 1
         else:
             # simple data, check whole thing at once
             var1 = num.array(fid1.variables[var_name][:])
             var2 = num.array(fid2.variables[var_name][:])
-            if not num.allclose(var1, var2):
+            if not num.allclose(var1, var2,
+                                rtol=rel_tolerance, atol=abs_tolerance):
                 for j in xrange(len(var1)):
-                    if abs(var1[j] - var2[j]) > epsilon:
-                        error_msg += ('\nFiles differ in variable '
-                                      '%s[%d]:\n'
-                                      '%s: %f\n'
-                                      '%s: %f\n'
-                                      'difference=%f\n'
-                                       % (var_name, j,  
-                                          filename1, var1[j],
-                                          filename2, var2[j],
-                                          var1[j]-var2[j]))
-                        break
+                    if not num.allclose(var1[j], var2[j],
+                                          rtol=rel_tolerance, atol=abs_tolerance):
+                        abs_difference = num.abs(var1[j]-var2[j])
+                        max_a_b = num.max(num.abs(var1[j]),
+                                          num.abs(var2[j]))
+                        rel_difference = num.abs(abs_difference/max_a_b)
+
+                        if not quiet:
+                            print('\nFiles differ in variable '
+                                  '%s[%d]:\n'
+                                  '%s: %f\n'
+                                  '%s: %f\n'
+                                  'abs. difference=%e, rel. difference=%e\n'
+                                   % (var_name, j,  
+                                      filename1, var1[j],
+                                      filename2, var2[j],
+                                      abs_difference,
+                                      rel_difference))
+
+                        if rel_difference > max_rel_difference:
+                            max_rel_difference = rel_difference
+                            max_rel_difference_abs = abs_difference
+                            max_rel_difference_a = var1[j]
+                            max_rel_difference_b = var2[j]
+
+                        data_vars_bad[var_name] = data_vars_bad.get(var_name, 0) + 1
+                        diff_count += 1
                 error = True
 
@@ -280,4 +328,13 @@
 
     if error:
+        error_msg += ('\nNumber of data differences=%d\n'
+                      'Maximum relative data difference=%e\n'
+                      'associated absolute difference=%e\n'
+                      "associated 'a' value=%e\n"
+                      "associated 'b' value=%e\n"
+                      % (diff_count, max_rel_difference, max_rel_difference_abs,
+                         max_rel_difference_a, max_rel_difference_b))
+        error_msg += ('\nglob_vars bad=%s\n' % str(glob_vars_bad))
+        error_msg += ('\ndata_vars bad=%s\n' % str(data_vars_bad))
         raise RuntimeError, error_msg
 
@@ -293,4 +350,5 @@
     a('where <options> is zero or more of:\n')
     a('                   -h        print this help\n')
+    a('                   -q        be quiet, print only summary of differences\n')
     a("                   -a <val>  set absolute threshold of 'equivalent'\n")
     a("                   -r <val>  set relative threshold of 'equivalent'\n")
@@ -319,4 +377,6 @@
 # @return The status code the program will exit with.
 def main(argv=None):
+    global quiet
+
     if argv is None:
         argv = sys.argv
@@ -324,5 +384,5 @@
     try:
         try:
-            opts, args = getopt.getopt(argv[1:], 'hg:t:v:',
+            opts, args = getopt.getopt(argv[1:], 'hqa:g:r:t:v:',
                                        ['help', 'globals',
                                         'variables', 'timesteps'])
@@ -338,8 +398,17 @@
     timesteps = None
     variables = None
+    quiet = False
+    rel_tolerance = default_rel_tolerance
+    abs_tolerance = default_abs_tolerance
     for opt, arg in opts:
         if opt in ('-h', '--help'):
             print usage()
             sys.exit(0)
+        elif opt in ('-q', '--quiet'):
+            quiet = True
+        elif opt in ('-a', '--absolute'):
+            abs_tolerance = float(arg)
+        elif opt in ('-r', '--relative'):
+            rel_tolerance = float(arg)
         elif opt in ('-g', '--globals'):
             globals = arg.split(',')
@@ -357,5 +426,7 @@
     try:
         files_are_the_same(args, globals=globals,
-                           timesteps=timesteps, variables=variables)
+                           timesteps=timesteps, variables=variables,
+                           rel_tolerance=rel_tolerance,
+                           abs_tolerance=abs_tolerance)
     except RuntimeError, msg:
          print msg
Index: anuga_validation/automated_validation_tests/patong_beach_validation/project.py
===================================================================
--- anuga_validation/automated_validation_tests/patong_beach_validation/project.py	(revision 7276)
+++ anuga_validation/automated_validation_tests/patong_beach_validation/project.py	(revision 7276)
@@ -0,0 +1,257 @@
+"""
+This file contains all your file and directory definitions 
+for elevation, meshes and outputs.
+"""
+
+import os
+from anuga.utilities.system_tools import get_user_name, get_host_name
+from time import localtime, strftime, gmtime
+from os.path import join, exists
+
+
+#------------------------------------------------------------------------------
+# Directory setup
+#------------------------------------------------------------------------------
+
+# this section needs to be updated to reflect the modelled community.
+# Note, the user needs to set up the directory system accordingly
+state = 'thailand'
+scenario_name = 'patong'
+scenario_folder = 'patong_tsunami_scenario'
+
+#------------------------------------------------------------------------------
+# Initial Conditions
+#------------------------------------------------------------------------------
+
+# Model specific parameters.
+# One or all can be changed each time the run_model script is executed
+tide = 0.8              # difference between MSL and HAT
+zone = 47               # specify zone of model
+model = 'small'         # different size model 'small' or 'large'
+event_number = 'mux_' + model    # the event number or the mux file name
+alpha = 0.1             # smoothing parameter for mesh
+friction = 0.01         # manning's friction coefficient
+starttime = 0           # start time for simulation
+finaltime = 15000       # final time for simulation
+
+use_buildings = True
+setup = 'final'         # This can be one of three values
+                        #    trial - coarsest mesh, fast
+                        #    basic - coarse mesh
+                        #    final - fine mesh, slowest
+
+#------------------------------------------------------------------------------
+# Output filename
+#
+# Your output filename should be unique between different runs on different
+# data.
+# The list of items below will be used to create a file in your output
+# directory.
+# Your user name and time+date will be automatically added.  For example,
+#     [setup, tide, event_number]
+# will result in a filename like
+#     20090212_091046_run_final_0_27283_rwilson
+#------------------------------------------------------------------------------
+
+output_comment = [setup, tide, event_number, 'final']
+
+#------------------------------------------------------------------------------
+# Input Data
+#------------------------------------------------------------------------------
+
+# ELEVATION DATA
+# Used in build_elevation.py
+# Format for ascii grids, as produced in ArcGIS + a projection file
+ascii_grid_filenames = []
+
+# Format for point is x,y,elevation (with header)
+point_filenames = ['patong_10m_grid_msl_Project.txt',    # 10m main grid
+                   'patong_10m_small_grid_for_anuga_sub_Project.txt', # 10m saddle
+                   'patong_bay_1s_grid_Project.txt',   # 1s grid
+                   'andaman_3s_grid_Clip2_Project.txt'] #3s grid
+
+### Add csv header list to all files in point_filenames
+##headerlist = ['x', 'y', 'elevation'] 
+##for f in point_filenames:
+##    add_csv_header(join(topographies_folder, f), headerlist)
+
+extent_polygon_filenames = ['patong_10m.txt',
+                            'saddle_10m.txt',
+                            'patong_1s.txt']
+
+
+# BOUNDING POLYGON - for data clipping and estimate of triangles in mesh
+# Used in build_elevation.py
+# Format for points easting,northing (no header)
+bounding_polygon_filename = 'bounding_polygon_'+ model + '.csv'
+bounding_polygon_maxarea = 100000
+
+# INTERIOR REGIONS -  for designing the mesh
+# Used in run_model.py
+# Format for points easting,northing (no header)                    
+interior_regions_data = [['inundation_area.csv', 75],
+                         ['aoi.csv', 200],
+                         ['aos.csv', 900],
+                         ['sw_coast_original.csv', 7000],
+                         ['building_main.csv', 20],
+                         ['building_main_small.csv', 20],
+                         ['building_main_south.csv', 20],
+                         ['building_saddle.csv', 20]]
+
+
+# LAND - used to set the initial stage/water to be offcoast only
+# Used in run_model.py.  Format for points easting,northing (no header)
+land_initial_conditions_filename = [['initial_conditions_' + model +'.csv', 0]]
+
+# GAUGES - for creating timeseries at a specific point
+# Used in get_timeseries.py.  
+# Format easting,northing,name,elevation (with header)
+gauges_filename = 'gauges.csv'
+
+# BUILDINGS POLYOGN - for elevation of buildings
+# Used in run_model.py
+# Format easting,northing,id,floor (with header)
+building_polygon_filename = 'buildings.csv' 
+
+
+# BUILDINGS EXPOSURE - for identifying inundated houses
+# Used in run_building_inundation.py
+# Format latitude,longitude etc (geographic)
+building_exposure_filename = 'busselton_res_clip.csv' # from NEXIS
+
+# BOUNDING POLYGON - used in build_boundary.py and run_model.py respectively
+# NOTE: when files are put together the points must be in sequence
+# For ease go clockwise!
+# Check the run_model.py for boundary_tags
+
+# Thinned ordering file from Hazard Map (geographic)
+# Format is index,latitude,longitude (with header)
+urs_order_filename = 'urs_order_'+ model +'.csv'
+
+# Landward bounding points
+# Format easting,northing (no header)
+landward_boundary_filename = 'landward_boundary_'+ model +'.csv'
+
+# MUX input filename.
+# If a meta-file from EventSelection is used, set 'multi-mux' to True.
+# If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False.
+mux_input_filename = event_number # to be found in event_folder
+                                    # (ie boundaries/event_number/)
+multi_mux = False
+##mux_input_filename = 'event.list'
+##multi_mux = True
+
+#------------------------------------------------------------------------------
+# Clipping regions for export to asc and regions for clipping data
+# Final inundation maps should only be created in regions of the finest mesh
+#------------------------------------------------------------------------------
+
+#CBD extract ascii grid - coordinates from patong_1s extent
+xminCBD = 417445.1119
+xmaxCBD = 425601.7881
+yminCBD = 870663.4547
+ymaxCBD = 876965.3856
+
+
+################################################################################
+################################################################################
+####         NOTE: NOTHING WOULD NORMALLY CHANGE BELOW THIS POINT.          ####
+################################################################################
+################################################################################
+
+# Get system user and host names.
+# These values can be used to distinguish between two similar runs by two
+# different users or runs by the same user on two different machines.
+user = get_user_name()
+host = get_host_name()
+
+# Environment variable names.
+# The inundation directory, not the data directory.
+ENV_INUNDATIONHOME = 'INUNDATIONHOME'
+
+# Path to MUX data
+ENV_MUXHOME = 'MUXHOME'
+
+#-------------------------------------------------------------------------------
+# Output Elevation Data
+#-------------------------------------------------------------------------------
+
+# Output filename for elevation
+# this is a combination of all the data generated in build_elevation.py
+combined_elevation_basename = scenario_name + '_combined_elevation_' + model
+
+#-------------------------------------------------------------------------------
+# Directory Structure
+#-------------------------------------------------------------------------------
+
+# determines time for setting up output directories
+time = strftime('%Y%m%d_%H%M%S', localtime()) 
+gtime = strftime('%Y%m%d_%H%M%S', gmtime()) 
+build_time = time + '_build_' + model
+run_time = time + '_run_'
+
+# create paths generated from environment variables.
+home = join(os.getenv(ENV_INUNDATIONHOME), 'data') # Absolute path for data folder
+muxhome = os.getenv(ENV_MUXHOME)
+    
+# check various directories/files that must exist
+anuga_folder = join(home, state, scenario_folder, 'anuga')
+topographies_folder = join(anuga_folder, 'topographies')
+polygons_folder = join(anuga_folder, 'polygons')
+boundaries_folder = join(anuga_folder, 'boundaries')
+output_folder = join(anuga_folder, 'outputs')
+gauges_folder = join(anuga_folder, 'gauges')
+meshes_folder = join(anuga_folder, 'meshes')
+event_folder = join(boundaries_folder, str(event_number))
+
+# MUX data files
+# Directory containing the MUX data files to be used with EventSelection.
+mux_data_folder = join(muxhome, 'mux')
+
+#------------------------------------------------------------------------------
+# Location of input and output data
+#------------------------------------------------------------------------------
+
+# Convert the user output_comment to a string for run_model.py
+output_comment = ('_'.join([str(x) for x in output_comment if x != user])
+                  + '_' + user)
+
+# The absolute pathname of the all elevation, generated in build_elevation.py
+combined_elevation = join(topographies_folder, combined_elevation_basename)
+
+# The absolute pathname of the mesh, generated in run_model.py
+meshes = join(meshes_folder, scenario_name) + model +'.msh'
+
+# The pathname for the urs order points, used within build_urs_boundary.py
+urs_order = join(boundaries_folder, urs_order_filename)
+
+# The absolute pathname for the landward points of the bounding polygon,
+# Used within run_model.py)
+landward_boundary = join(boundaries_folder, landward_boundary_filename)
+
+# The absolute pathname for the .sts file, generated in build_boundary.py
+event_sts = join(event_folder, scenario_name)
+
+# The absolute pathname for the output folder names
+# Used for build_elevation.py
+output_build = join(output_folder, build_time) + '_' + str(user) 
+# Used for run_model.py
+output_run = join(output_folder, run_time) + output_comment 
+# Used by post processing
+output_run_time = join(output_run, scenario_name) 
+
+# The absolute pathname for the gauges file
+# Used for get_timeseries.py
+gauges = join(gauges_folder, gauges_filename)
+
+# The absolute pathname for the gauges file
+# Used for run_model.py
+building_polygon = join(polygons_folder, building_polygon_filename)
+
+# The absolute pathname for the building file
+# Used for run_building_inundation.py
+building_exposure = join(gauges_folder, building_exposure_filename)
+
+# full path to where MUX files (or meta-files) live
+mux_input = join(event_folder, mux_input_filename)
+
Index: anuga_validation/automated_validation_tests/patong_beach_validation/run_model.py
===================================================================
--- anuga_validation/automated_validation_tests/patong_beach_validation/run_model.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/patong_beach_validation/run_model.py	(revision 7276)
@@ -28,5 +28,5 @@
 # Related major packages
 from Scientific.IO.NetCDF import NetCDFFile
-import Numeric as num
+#import numpy as num
 
 from anuga.interface import create_domain_from_regions
@@ -44,4 +44,6 @@
 from anuga.utilities.polygon import read_polygon, Polygon_function
 from anuga.caching import cache
+
+import anuga.utilities.log as log
 
 # Application specific imports
@@ -70,5 +72,5 @@
 #-------------------------------------------------------------------------------
 
-print 'Create computational domain'
+log.critical('Create computational domain')
 
 # Create the STS file
@@ -76,5 +78,5 @@
 # We need to use caching instead!
 
-print 'project.mux_data_folder=%s' % project.mux_data_folder
+log.critical( 'project.mux_data_folder=%s' % project.mux_data_folder)
 if not os.path.exists(project.event_sts + '.sts'):
     bub.build_urs_boundary(project.mux_input_filename, project.event_sts)
@@ -111,5 +113,5 @@
                                     use_cache=True,
                                     verbose=True)
-print domain.statistics()
+log.critical(domain.statistics())
 
 # FIXME(Ole): How can we make this more automatic?
@@ -125,5 +127,5 @@
 #-------------------------------------------------------------------------------
 
-print 'Setup initial conditions'
+log.critical('Setup initial conditions')
 
 # Set the initial stage in the offcoast region only
@@ -144,13 +146,13 @@
 if project.use_buildings:
     # Add buildings from file
-    print 'Reading building polygons'    
+    log.critical('Reading building polygons')
     building_polygons, building_heights = csv2building_polygons(project.building_polygon)
     #clipping_polygons=project.building_area_polygons)
 
-    print 'Creating %d building polygons' % len(building_polygons)
+    log.critical('Creating %d building polygons' % len(building_polygons))
     def create_polygon_function(building_polygons, geo_reference=None):
         L = []
         for i, key in enumerate(building_polygons):
-            if i%100==0: print i
+            if i%100==0: log.critical(i)
             poly = building_polygons[key]
             elev = building_heights[key]
@@ -161,5 +163,5 @@
         return buildings
 
-    print 'Creating %d building polygons' % len(building_polygons)
+    log.critical('Creating %d building polygons' % len(building_polygons))
     buildings = cache(create_polygon_function,
                       building_polygons,
@@ -167,5 +169,5 @@
                       verbose=True)
 
-    print 'Adding buildings'
+    log.critical('Adding buildings')
     domain.add_quantity('elevation',
                         buildings,
@@ -178,5 +180,5 @@
 #-------------------------------------------------------------------------------
 
-print 'Set boundary - available tags:', domain.get_boundary_tags()
+log.critical('Set boundary - available tags:' % domain.get_boundary_tags())
 
 Br = Reflective_boundary(domain)
@@ -204,6 +206,6 @@
 for t in domain.evolve(yieldstep=2000,
                        finaltime=6000):
-    print domain.timestepping_statistics()
-    print domain.boundary_statistics(tags='ocean')
+    log.critical(domain.timestepping_statistics())
+    log.critical(domain.boundary_statistics(tags='ocean'))
 
 # Start detailed model
@@ -211,7 +213,7 @@
                        finaltime=project.finaltime,
                        skip_initial_step=True):
-    print domain.timestepping_statistics()
-    print domain.boundary_statistics(tags='ocean')
+    log.critical(domain.timestepping_statistics())
+    log.critical(domain.boundary_statistics(tags='ocean'))
     
-print 'Simulation took %.2f seconds' %(time.time()-t0)
+log.critical('Simulation took %.2f seconds' %(time.time()-t0))
       
Index: anuga_validation/automated_validation_tests/patong_beach_validation/validate.py
===================================================================
--- anuga_validation/automated_validation_tests/patong_beach_validation/validate.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/patong_beach_validation/validate.py	(revision 7276)
@@ -13,5 +13,4 @@
 import time
 import shutil
-import platform
 
 from anuga.utilities.system_tools import get_web_file, untar_file, file_length
@@ -33,4 +32,5 @@
            'http://dfn.dl.sourceforge.net/sourceforge/anuga/'             # de
           ]
+
 ### for testing
 ##MIRRORS = ['http://10.7.64.243/patong_validation_data/']       # local linux box
@@ -46,5 +46,6 @@
 # these names must be of the form <scene>.sww.<type>.tgz
 # as code below depends upon it.
-Optional_Data_Objects = ('patong.sww.TRIAL.tgz',
+Optional_Data_Objects = (
+                         'patong.sww.TRIAL.tgz',
                          'patong.sww.BASIC.tgz',
                          'patong.sww.FINAL.tgz'
@@ -66,13 +67,7 @@
 OUTPUT_SWW = 'patong.sww'
 
-# default name of python to run
-PythonName = 'python'
-
 
 def setup():
-    '''Prepare for the validation run.
-
-    Check we have required data set in project.py.
-    '''
+    '''Prepare for the validation run.'''
    
     pass
@@ -302,5 +297,5 @@
     # run the simulation, produce SWW file
     log.info('Running the simulation ...')
-    cmd = '%s run_model.py > %s' % (PythonName, RUNMODEL_STDOUT)
+    cmd = 'python run_model.py > %s' % RUNMODEL_STDOUT
     log.debug("run_simulation: doing '%s'" % cmd)
     res = os.system(cmd)
@@ -349,5 +344,5 @@
     # compare SWW files here and there
     new_output_sww = os.path.join(output_directory, expected_sww)
-    cmd = '%s cmpsww.py %s %s > cmpsww.stdout' % (PythonName, local_sww, new_output_sww)
+    cmd = 'python cmpsww.py %s %s > cmpsww.stdout' % (local_sww, new_output_sww)
     log.debug("check_that_output_is_as_expected: doing '%s'" % cmd)
     res = os.system(cmd)
@@ -381,18 +376,12 @@
 ################################################################################
 
-# determine what python we are, initialize PythonName
-py_tuple = platform.python_version_tuple()
-PythonName = 'python%s.%s' % (py_tuple[0], py_tuple[1])
-
 # set logging levels
 log.console_logging_level = log.INFO
 log.log_logging_level = log.DEBUG
-log_filename = log.log_filename
 
 setup()
 
 # prepare user for what is about to happen
-
-msg = '''
+log.critical('''
 Please note that this validation test is accurate only on 64bit Linux or
 Windows.  Running the validation on a 32bit operating system will result in
@@ -412,7 +401,6 @@
 if you wish.  If not supplied in environment variables you will be prompted for
 the information.
-'''
-
-log.critical(msg)
+''')
+
 
 # make sure local data is up to date
@@ -443,4 +431,5 @@
 for odo in Optional_Data_Objects:
     start_time = time.time()
+
     (_, vtype, _) = odo.rsplit('.', 2)
     vtype = vtype.lower()
@@ -452,8 +441,9 @@
         (expected_sww, _) = valid_sww.rsplit('.', 1)
         check_that_output_is_as_expected(expected_sww, valid_sww)
-    shutil.move(log_filename, '%s.%s' % (log_filename, vtype))
+
     stop_time = time.time()
-    log.critical("'%s' validation took %.1fs" % (vtype, stop_time - start_time))
+    log.critical("'%s' validation took %.1fs\n\n\n" % (vtype, stop_time - start_time))
 
 # clean up
+log.critical('Tearing down ...')
 teardown()
Index: anuga_validation/automated_validation_tests/urs_mux_files_validation/boundary_gauges.lic
===================================================================
--- anuga_validation/automated_validation_tests/urs_mux_files_validation/boundary_gauges.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/urs_mux_files_validation/boundary_gauges.lic	(revision 7276)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-  <ga_license_file>
+<?xml version='1.0' encoding='iso-8859-1'?>
+<ga_license_file>
     <metadata>
       <author>Duncan Gray</author>
@@ -7,5 +6,5 @@
     <datafile>
       <filename>boundary_gauges.txt</filename>
-      <checksum>-1553233046</checksum>
+      <checksum>2741734250</checksum>
       <publishable>Yes</publishable>
       <accountable>Duncan Gray</accountable>
Index: anuga_validation/automated_validation_tests/urs_mux_files_validation/gauges.lic
===================================================================
--- anuga_validation/automated_validation_tests/urs_mux_files_validation/gauges.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/urs_mux_files_validation/gauges.lic	(revision 7276)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-  <ga_license_file>
+<?xml version='1.0' encoding='iso-8859-1'?>
+<ga_license_file>
     <metadata>
       <author>Duncan Gray</author>
Index: anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-e-mux.lic
===================================================================
--- anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-e-mux.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-e-mux.lic	(revision 7276)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-  <ga_license_file>
+<?xml version='1.0' encoding='iso-8859-1'?>
+<ga_license_file>
     <metadata>
       <author>Duncan Gray</author>
@@ -7,5 +6,5 @@
     <datafile>
       <filename>o_test-e-mux</filename>
-      <checksum>-1664514244</checksum>
+      <checksum>2630453052</checksum>
       <publishable>Yes</publishable>
       <accountable>Duncan Gray</accountable>
Index: anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-n-mux.lic
===================================================================
--- anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-n-mux.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-n-mux.lic	(revision 7276)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-  <ga_license_file>
+<?xml version='1.0' encoding='iso-8859-1'?>
+<ga_license_file>
     <metadata>
       <author>Duncan Gray</author>
Index: anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-z-mux.lic
===================================================================
--- anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-z-mux.lic	(revision 7267)
+++ anuga_validation/automated_validation_tests/urs_mux_files_validation/o_test-z-mux.lic	(revision 7276)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-  <ga_license_file>
+<?xml version='1.0' encoding='iso-8859-1'?>
+<ga_license_file>
     <metadata>
       <author>Duncan Gray</author>
@@ -7,5 +6,5 @@
     <datafile>
       <filename>o_test-z-mux</filename>
-      <checksum>-1449856062</checksum>
+      <checksum>2845111234</checksum>
       <publishable>Yes</publishable>
       <accountable>Duncan Gray</accountable>
Index: anuga_validation/automated_validation_tests/urs_mux_files_validation/run_Bf.py
===================================================================
--- anuga_validation/automated_validation_tests/urs_mux_files_validation/run_Bf.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/urs_mux_files_validation/run_Bf.py	(revision 7276)
@@ -20,5 +20,5 @@
 # Related major packages
 from anuga.shallow_water import Domain,Dirichlet_boundary,File_boundary,Transmissive_boundary, Field_boundary
-import Numeric as num
+import numpy as num
 from anuga.pmesh.mesh_interface import create_mesh_from_regions
 from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files, sww2timeseries, get_data_from_file
Index: anuga_validation/automated_validation_tests/validate_all.py
===================================================================
--- anuga_validation/automated_validation_tests/validate_all.py	(revision 7267)
+++ anuga_validation/automated_validation_tests/validate_all.py	(revision 7276)
@@ -39,5 +39,4 @@
     os.chdir(path)
     s = 'python %s' %(filename)
-    print
     print s
     os.system(s)
