Index: /anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
===================================================================
--- /anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py	(revision 4134)
+++ /anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py	(revision 4135)
@@ -741,8 +741,9 @@
         triangles = self.domain.triangles      #FIXME
 
-        
-        # FIXME handle attribute name 
         vertex_attributes = fit_to_mesh(coordinates, triangles,filename,
-                                alpha=alpha) #, max_read_lines=max_read_lines)
+                                        alpha=alpha,
+                                        attribute_name = attribute_name,
+                                        use_cache = use_cache)
+                                #, max_read_lines=max_read_lines)
         
         #Call underlying method using array values
Index: /anuga_core/source/anuga/fit_interpolate/fit.py
===================================================================
--- /anuga_core/source/anuga/fit_interpolate/fit.py	(revision 4134)
+++ /anuga_core/source/anuga/fit_interpolate/fit.py	(revision 4135)
@@ -304,4 +304,5 @@
             verbose=False,
             point_origin=None,
+            attribute_name=None,
             max_read_lines=500):
         """Fit a smooth surface to given 1d array of data points z.
@@ -320,4 +321,6 @@
         # use blocking to load in the point info
         if type(point_coordinates_or_filename) == types.StringType:
+            msg = "Don't set a point origin when reading from a file"
+            assert point_origin is None, msg
             filename = point_coordinates_or_filename
             for geo_block in  Geospatial_data(filename,
@@ -326,5 +329,5 @@
                 # build the array
                 points = geo_block.get_data_points(absolute=True)
-                z = geo_block.get_attributes()
+                z = geo_block.get_attributes(attribute_name=attribute_name)
                 self.build_fit_subset(points, z)
             point_coordinates = None
@@ -423,4 +426,5 @@
                 data_origin=None,
                 max_read_lines=None,
+                attribute_name=None,
                 use_cache = False):
     """
@@ -472,6 +476,6 @@
         interp = Fit(vertex_coordinates,
                      triangles,
-                     verbose = verbose,
-                     mesh_origin = mesh_origin,
+                     verbose=verbose,
+                     mesh_origin=mesh_origin,
                      alpha=alpha)
         
@@ -480,4 +484,5 @@
                                    point_origin=data_origin,
                                    max_read_lines=max_read_lines,
+                                   attribute_name=attribute_name,
                                    verbose=verbose)
 
Index: /anuga_core/source/anuga/fit_interpolate/test_fit.py
===================================================================
--- /anuga_core/source/anuga/fit_interpolate/test_fit.py	(revision 4134)
+++ /anuga_core/source/anuga/fit_interpolate/test_fit.py	(revision 4135)
@@ -240,5 +240,5 @@
         assert allclose(f, answer)
 
-    def test_fit_2_mesh(self):
+    def test_fit_to_mesh(self):
 
         a = [-1.0, 0.0]
@@ -272,4 +272,43 @@
         f = fit_to_mesh(vertices, triangles,fileName,
                                 alpha=0.0, max_read_lines=2)
+        answer = linear_function(vertices)
+        #print "f\n",f
+        #print "answer\n",answer
+        assert allclose(f, answer)
+        
+    def test_fit_to_mesh_2_atts(self):
+
+        a = [-1.0, 0.0]
+        b = [3.0, 4.0]
+        c = [4.0,1.0]
+        d = [-3.0, 2.0] #3
+        e = [-1.0,-2.0]
+        f = [1.0, -2.0] #5
+
+        vertices = [a, b, c, d,e,f]
+        triangles = [[0,1,3], [1,0,2], [0,4,5], [0,5,2]] #abd bac aef afc
+
+
+        fileName = tempfile.mktemp(".ddd")
+        file = open(fileName,"w")
+        # the 2nd att name is wacky so it's the first key off a hash table
+        file.write(" x,y, elevation, afriqction \n\
+-2.0, 2.0, 0., 0.\n\
+-1.0, 1.0, 0., 0.\n\
+0.0, 2.0 , 2., 20.\n\
+1.0, 1.0 , 2., 20.\n\
+ 2.0,  1.0 ,3., 30. \n\
+ 0.0,  0.0 , 0., 0.\n\
+ 1.0,  0.0 , 1., 10.\n\
+ 0.0,  -1.0, -1., -10.\n\
+ -0.2, -0.5, -0.7, -7.\n\
+ -0.9, -1.5, -2.4, -24. \n\
+ 0.5,  -1.9, -1.4, -14. \n\
+ 3.0,  1.0 , 4., 40. \n")
+        file.close()
+        
+        f = fit_to_mesh(vertices, triangles,fileName,
+                        alpha=0.0, 
+                        attribute_name='elevation', max_read_lines=2)
         answer = linear_function(vertices)
         #print "f\n",f
Index: /anuga_core/source/anuga/geospatial_data/geospatial_data.py
===================================================================
--- /anuga_core/source/anuga/geospatial_data/geospatial_data.py	(revision 4134)
+++ /anuga_core/source/anuga/geospatial_data/geospatial_data.py	(revision 4135)
@@ -838,5 +838,6 @@
                     # It might not be a problem with the header
                     #raise TitleAmountError
-                    raise IOError
+                    msg = "File load error.  There might be a problem with the file header"
+                    raise IOError, msg
                 for i,num in enumerate(numbers):
                     num.strip()
@@ -844,4 +845,5 @@
                         #attributes.append(float(num))
                         att_dict.setdefault(header[i],[]).append(float(num))
+            #except IOError:           
             except ValueError:
                 raise SyntaxError
Index: /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py
===================================================================
--- /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py	(revision 4134)
+++ /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py	(revision 4135)
@@ -943,4 +943,33 @@
            
         os.remove(fileName)             
+        
+    def test_load_csv_bad(self):
+        """
+        space delimited
+        """
+        import os
+       
+        fileName = tempfile.mktemp(".txt")
+        file = open(fileName,"w")
+        file.write(" elevation ,  speed \n\
+1.0, 0.0, 10.0, 0.0\n\
+0.0, 1.0, 0.0, 10.0\n\
+1.0, 0.0 ,10.4, 40.0\n")
+        file.close()
+
+        results = Geospatial_data(fileName, max_read_lines=2,
+                                  load_file_now=False)
+
+        # Blocking
+        geo_list = []
+        try:
+            for i in results:
+                geo_list.append(i)
+        except IOError:
+            pass
+        else:
+            msg = 'bad file did not raise error!'
+            raise msg
+        os.remove(fileName)
         
     def test_export_xya_file(self):
