Index: inundation/coordinate_transforms/geo_reference.py
===================================================================
--- inundation/coordinate_transforms/geo_reference.py	(revision 2940)
+++ inundation/coordinate_transforms/geo_reference.py	(revision 2941)
@@ -10,4 +10,7 @@
 from utilities.numerical_tools import ensure_numeric
 from utilities.anuga_exceptions import ANUGAError
+
+import exceptions
+class TitleError(exceptions.IOError): pass
 
 DEFAULT_ZONE = -1
@@ -34,4 +37,7 @@
         ASCIIFile - a handle to the text file
         read_title - the title of the georeference text, if it was read in.
+         If the function that calls this has already read the title line,
+         it can't unread it, so this info has to be passed.
+         If you know of a way to unread this info, then tell us.
         """
 
@@ -106,5 +112,7 @@
         #print "gr TITLE[0:2].upper()",TITLE[0:2].upper() 
         if read_title[0:2].upper() != TITLE[0:2].upper():
-            raise SyntaxError
+            msg = 'File error.  Expecting line: %s.  Got this line: %s' \
+                  %(TITLE, read_title)
+            raise TitleError, msg 
         self.zone = int(fd.readline())
         self.xllcorner = float(fd.readline())
Index: inundation/coordinate_transforms/test_geo_reference.py
===================================================================
--- inundation/coordinate_transforms/test_geo_reference.py	(revision 2940)
+++ inundation/coordinate_transforms/test_geo_reference.py	(revision 2941)
@@ -72,5 +72,5 @@
         self.failUnless(g == new_g, 'test_read_write_ASCII failed')
         
-    def test_read_write_ASCII2(self):
+    def test_read_write_ASCII3(self):
         from Scientific.IO.NetCDF import NetCDFFile
         g = Geo_reference(56,1.9,1.9)
@@ -86,5 +86,5 @@
             fd.close()
             os.remove(file_name)
-        except SyntaxError:
+        except TitleError:
             fd.close()
             os.remove(file_name)
@@ -254,10 +254,104 @@
             msg = 'Should have raised an exception'
             raise msg
-        
-        
-        
-        
-        
-        
+  
+    def test_bad_ASCII_title(self):      
+ # create an .xya file
+        point_file = tempfile.mktemp(".xya")
+        fd = open(point_file,'w')
+        fd.write("# hey! \n")
+        fd.close()
+        
+        fd = open(point_file,'r')
+        # 
+        #new_g = Geo_reference(ASCIIFile=fd)
+        try:
+            new_g = Geo_reference(ASCIIFile=fd)
+            fd.close()
+            os.remove(point_file)
+        except TitleError:
+            fd.close()
+            os.remove(point_file)
+        else:
+            self.failUnless(0 ==1,
+                        'bad text file did not raise error!')
+            os.remove(point_file)
+
+    def test_read_write_ASCII_test_and_fail(self):
+        from Scientific.IO.NetCDF import NetCDFFile
+
+        # This is to test a fail
+        g = Geo_reference(56,1.9,1.9)
+        file_name = tempfile.mktemp(".geo_referenceTest")
+        fd = open(file_name,'w')
+        g.write_ASCII(fd)
+        fd.close()       
+        fd = open(file_name,'r')
+        line = fd.readline()
+        line = " #Geo"
+        try:
+            new_g = Geo_reference(ASCIIFile=fd, read_title=line)
+            fd.close()
+            os.remove(file_name)
+        except TitleError:
+            fd.close()
+            os.remove(file_name)
+        else:
+            self.failUnless(0 ==1,
+                        'bad text file did not raise error!')
+
+        # this tests a pass
+        g = Geo_reference(56,1.9,1.9)
+        file_name = tempfile.mktemp(".geo_referenceTest")
+        fd = open(file_name,'w')
+        g.write_ASCII(fd)
+        fd.close()
+        
+        fd = open(file_name,'r')
+        line = fd.readline()
+        line = "#geo_yeah"
+        new_g = Geo_reference(ASCIIFile=fd, read_title=line)
+        fd.close()
+        os.remove(file_name)
+
+        self.failUnless(g == new_g, 'test_read_write_ASCII failed')
+        
+        # this tests a pass
+        g = Geo_reference(56,1.9,1.9)
+        file_name = tempfile.mktemp(".geo_referenceTest")
+        fd = open(file_name,'w')
+        g.write_ASCII(fd)
+        fd.close()
+        
+        fd = open(file_name,'r')
+        line = fd.readline()
+        line = "#geo crap"
+        new_g = Geo_reference(ASCIIFile=fd, read_title=line)
+        fd.close()
+        os.remove(file_name)
+
+        self.failUnless(g == new_g, 'test_read_write_ASCII failed')
+        
+    def xxtest_good_title(self):      
+ # create an .xya file
+        point_file = tempfile.mktemp(".xya")
+        fd = open(point_file,'w')
+        fd.write("#Geo crap \n 56\n ")
+        fd.close()
+        
+        fd = open(point_file,'r')
+        # 
+        #new_g = Geo_reference(ASCIIFile=fd)
+        try:
+            new_g = Geo_reference(ASCIIFile=fd)
+            fd.close()
+            os.remove(point_file)
+        except TitleError:
+            fd.close()
+            os.remove(point_file)
+        else:
+            self.failUnless(0 ==1,
+                        'bad text file did not raise error!')
+            os.remove(point_file)
+         
 #-------------------------------------------------------------
 if __name__ == "__main__":
Index: inundation/geospatial_data/geospatial_data.py
===================================================================
--- inundation/geospatial_data/geospatial_data.py	(revision 2940)
+++ inundation/geospatial_data/geospatial_data.py	(revision 2941)
@@ -9,5 +9,5 @@
 from Numeric import concatenate, array, Float, shape
 
-from coordinate_transforms.geo_reference import Geo_reference
+from coordinate_transforms.geo_reference import Geo_reference, TitleError
 
 from os import access, F_OK, R_OK
@@ -320,5 +320,5 @@
                         fd = open(file_name)
                         data_points, attributes, geo_reference = _read_xya_file(fd, ',')
-                    except SyntaxError:
+                    except TitleError:
                         fd.close()
                         fd = open(file_name)
@@ -333,4 +333,5 @@
                 raise IOError, msg
             except IOError, e:
+                fd.close()    
                 # Catch this to add an error message
                 msg = 'Could not open file or incorrect file format %s:%s' %(file_name, e)
Index: inundation/load_mesh/loadASCII.py
===================================================================
--- inundation/load_mesh/loadASCII.py	(revision 2940)
+++ inundation/load_mesh/loadASCII.py	(revision 2941)
@@ -82,5 +82,5 @@
 from os.path import splitext
 
-from coordinate_transforms.geo_reference import Geo_reference,TITLE
+from coordinate_transforms.geo_reference import Geo_reference,TITLE, TitleError
 
 import exceptions
@@ -105,5 +105,5 @@
             msg = 'Extension %s is unknown' %ofile[-4:]
             raise IOError, msg
-    except (SyntaxError,IndexError, ValueError): #FIXME No test for ValueError
+    except (TitleError,SyntaxError,IndexError, ValueError): #FIXME No test for ValueError
             msg = 'File could not be opened'
             raise IOError, msg  
@@ -993,4 +993,5 @@
 
     #FIXME (Ole): This function should really return a Geospatial_data object.      #FIXME (DSG): Do you know it does, in the points dic?
+    #No.  Where this function is used, geospatial objects should be used.
     
     if ofile[-4:]== ".xya":
@@ -1000,5 +1001,5 @@
                     fd = open(ofile)
                     points_dict = _read_xya_file(fd, ',')
-                except SyntaxError:
+                except TitleError: # this is catching the error thrown by geo_ref
                     fd.close()
                     fd = open(ofile)
@@ -1009,5 +1010,10 @@
             fd.close()
         except (IndexError,ValueError,SyntaxError):
-            fd.close()    
+            fd.close()
+            msg = 'Could not open file %s ' %ofile
+            raise IOError, msg
+        except TitleError:
+            print "reclassifying title error"
+            fd.close()
             msg = 'Could not open file %s ' %ofile
             raise IOError, msg
Index: inundation/pyvolution/cornell_room.py
===================================================================
--- inundation/pyvolution/cornell_room.py	(revision 2940)
+++ inundation/pyvolution/cornell_room.py	(revision 2941)
@@ -15,5 +15,6 @@
 from Numeric import array
 from math import sqrt
-from least_squares import Interpolation
+#from least_squares import Interpolation
+from fit_interpolate.interpolate import Interpolate
     
 
@@ -45,6 +46,6 @@
 #Compute smooth surface on new mesh based on values from old (regrid)
 print 'Interp'
-interp = Interpolation(mesh_points, vertices, data_points, alpha=10)
-mesh_values = interp.fit(data_values)
+interp = Interpolate(mesh_points, vertices, alpha=10)
+mesh_values = interp.fit( data_points, data_values) # this has not been tested
 print 'Len mesh values', len(mesh_values)
 print 'Len mesh points', len(mesh_points)
