Index: /inundation/geospatial_data/geospatial_data.py
===================================================================
--- /inundation/geospatial_data/geospatial_data.py	(revision 2939)
+++ /inundation/geospatial_data/geospatial_data.py	(revision 2940)
@@ -86,5 +86,6 @@
             dic['attributelist']['elevation'] = [[7.0,5.0]
                 
-        delimiter:
+        delimiter: is the file delimiter that will be used when 
+            importing the file
             
         verbose:
@@ -95,4 +96,6 @@
             # assume data point is really a file name
             file_name = data_points
+
+        self.set_verbose(verbose)
 
         if file_name is None:
@@ -100,5 +103,5 @@
                 msg = 'No file specified yet a delimiter is provided!'
                 raise ValueError, msg
-            self.file_name = None
+            file_name = None
             self.check_data_points(data_points)
             self.set_attributes(attributes)
@@ -106,16 +109,9 @@
             self.set_default_attribute_name(default_attribute_name)
 
-       
-        else:
-            if access(file_name, F_OK) == 0 :
-                msg = 'File %s does not exist or is not accessible' %file_name
-                raise IOError, msg
-            else:
-                data = {}    
+        else:
+###                data = {}    
                 # watch for case where file name and points, attributes etc are provided!!
                 # if file name then all provided info will be removed!
-                self.file_name = file_name
-                self.delimiter = delimiter
-                self.import_points_file(file_name, delimiter)
+                self.import_points_file(file_name, delimiter, verbose)
                 
                 self.check_data_points(self.data_points)
@@ -183,16 +179,4 @@
         self.default_attribute_name = default_attribute_name
 
-    def set_file_name(self, file_name = None):
-        if file_name is None:
-            self.file_name = None
-        else:
-            if access(file_name, F_OK) == 0 :
-                msg = 'Geospatial_data object needs have either data_points \n'
-                msg += ' or a file with data points'
-                raise msg
-            else:    
-                self.file_name = file_name
-                print 'file name from set', self.file_name
-    
     def set_verbose(self, verbose = False):
         if verbose is not False:
@@ -319,5 +303,5 @@
     ###
 
-    def import_points_file(self, ofile, delimiter = None, verbose = False):
+    def import_points_file(self, file_name, delimiter = None, verbose = False):
         """ load an .xya or .pts file
         Note: will throw an IOError if it can't load the file.
@@ -325,36 +309,40 @@
         """
         
+        if access(file_name, F_OK) == 0 :
+            msg = 'File %s does not exist or is not accessible' %file_name
+            raise IOError, msg
+        
         attributes = {}
-        if ofile[-4:]== ".xya":
+        if file_name[-4:]== ".xya":
             try:
                 if delimiter == None:
                     try:
-                        fd = open(ofile)
+                        fd = open(file_name)
                         data_points, attributes, geo_reference = _read_xya_file(fd, ',')
                     except SyntaxError:
                         fd.close()
-                        fd = open(ofile)
+                        fd = open(file_name)
                         data_points, attributes, geo_reference = _read_xya_file(fd, ' ')
                 else:
-                    fd = open(ofile)
+                    fd = open(file_name)
                     data_points, attributes, geo_reference = _read_xya_file(fd, delimiter)
                 fd.close()
             except (IndexError,ValueError,SyntaxError):
                 fd.close()    
-                msg = 'Could not open file %s ' %ofile
+                msg = 'Could not open file %s ' %file_name
                 raise IOError, msg
             except IOError, e:
                 # Catch this to add an error message
-                msg = 'Could not open file or incorrect file format %s:%s' %(ofile, e)
+                msg = 'Could not open file or incorrect file format %s:%s' %(file_name, e)
                 raise IOError, msg
                 
-        elif ofile[-4:]== ".pts":
+        elif file_name[-4:]== ".pts":
             try:
-                data_points, attributes, geo_reference = _read_pts_file(ofile, verbose)
+                data_points, attributes, geo_reference = _read_pts_file(file_name, verbose)
             except IOError, e:    
-                msg = 'Could not open file %s ' %ofile
+                msg = 'Could not open file %s ' %file_name
                 raise IOError, msg        
         else:      
-            msg = 'Extension %s is unknown' %ofile[-4:]
+            msg = 'Extension %s is unknown' %file_name[-4:]
             raise IOError, msg
         
@@ -368,9 +356,9 @@
 #        return all_data
     
-    def export_points_file(self, ofile, absolute=False):
-        
-        """
-        write a points file, ofile, as a text (.xya) or binary (.pts) file
-        ofile is the file name, including the extension
+    def export_points_file(self, file_name, absolute=True):
+        
+        """
+        write a points file, file_name, as a text (.xya) or binary (.pts) file
+        file_name is the file name, including the extension
         The point_dict is defined at the top of this file.
         
@@ -382,23 +370,23 @@
         """
     
-        if (ofile[-4:] == ".xya"):
+        if (file_name[-4:] == ".xya"):
             if absolute is True:         
-                _write_xya_file(ofile, self.get_data_points(absolute), 
+                _write_xya_file(file_name, self.get_data_points(absolute=True), 
                                    self.get_all_attributes())
             else:
-                _write_xya_file(ofile, self.get_data_points(absolute), 
+                _write_xya_file(file_name, self.get_data_points(absolute=False), 
                                    self.get_all_attributes(),
                                    self.get_geo_reference())
                                     
-        elif (ofile[-4:] == ".pts"):
+        elif (file_name[-4:] == ".pts"):
             if absolute is True:
-                _write_pts_file(ofile, self.get_data_points(absolute), 
+                _write_pts_file(file_name, self.get_data_points(absolute), 
                                    self.get_all_attributes())
             else:
-                _write_pts_file(ofile, self.get_data_points(absolute), 
+                _write_pts_file(file_name, self.get_data_points(absolute), 
                                    self.get_all_attributes(),
                                    self.get_geo_reference())
         else:
-            msg = 'Unknown file type %s ' %ofile
+            msg = 'Unknown file type %s ' %file_name
             raise IOError, msg 
     
@@ -462,10 +450,8 @@
 
 def _read_xya_file( fd, delimiter):
-#    print 'hello from read xya data'
     points = []
     pointattributes = []
     title = fd.readline()
     att_names = clean_line(title,delimiter)
-    
     att_dict = {}
     line = fd.readline()
@@ -480,7 +466,4 @@
                 numbers.pop(0)
                 numbers.pop(0)
-                #attributes = []
-                #print "att_names",att_names
-                #print "numbers",numbers 
                 if len(att_names) != len(numbers):
                     fd.close()
@@ -493,139 +476,21 @@
                         #attributes.append(float(num))
                         att_dict.setdefault(att_names[i],[]).append(float(num))
-                        
             except ValueError:
                 raise SyntaxError
         line = fd.readline()
         numbers = clean_line(line,delimiter)
-    
     if line == '':
             # end of file
         geo_reference = None
+        
     else:
         geo_reference = Geo_reference(ASCIIFile=fd,read_title=line)
-    
-#    xya_dict = {}
-#    xya_dict['pointlist'] = array(points).astype(Float)
+        
+    
     pointlist = array(points).astype(Float)
-    
     for key in att_dict.keys():
         att_dict[key] = array(att_dict[key]).astype(Float)
-#    xya_dict['attributelist'] = att_dict
-    
-#    xya_dict['geo_reference'] = geo_reference
-    #print "xya_dict",xya_dict 
+    
     return pointlist, att_dict, geo_reference
-
-
-def _old_read_pts_file(file_name, verbose = False):
-    """Read .pts NetCDF file
-    
-    Return a dic of array of points, and dic of array of attribute
-    eg
-    dic['points'] = [[1.0,2.0],[3.0,5.0]]
-    dic['attributelist']['elevation'] = [[7.0,5.0]
-    """    
-    #FIXME: (DSG) This format has issues.
-    # There can't be an attribute called points 
-    # consider format change
-
-#    print 'hi for read points file'
-    from Scientific.IO.NetCDF import NetCDFFile
-    
-    if verbose: print 'Reading ', file_name
-    
-        
-    # see if the file is there.  Throw a QUIET IO error if it isn't
-    fd = open(file_name,'r')
-    fd.close()
-    
-    #throws prints to screen if file not present
-    fid = NetCDFFile(file_name, 'r') 
-    
-    point_atts = {}  
-        # Get the variables
-    point_atts['pointlist'] = array(fid.variables['points'])
-    keys = fid.variables.keys()
-    if verbose: print 'Got %d variables: %s' %(len(keys), keys)
-    try:
-        keys.remove('points')
-    except IOError, e:       
-        fid.close()    
-        msg = 'Expected keyword "points" but could not find it'
-        raise IOError, msg
-    
-    attributes = {}
-    for key in keys:
-        if verbose: print "reading attribute '%s'" %key
-            
-        attributes[key] = array(fid.variables[key])
-    
-    point_atts['attributelist'] = attributes
-    
-    try:
-        geo_reference = Geo_reference(NetCDFObject=fid)
-        point_atts['geo_reference'] = geo_reference
-    except AttributeError, e:
-        #geo_ref not compulsory 
-        point_atts['geo_reference'] = None
-    
-    fid.close()
-    return point_atts
-
-
-def _old_read_xya_file( fd, delimiter):
-    points = []
-    pointattributes = []
-    title = fd.readline()
-    att_names = clean_line(title,delimiter)
-    
-    att_dict = {}
-    line = fd.readline()
-    numbers = clean_line(line,delimiter)
-    #print 'read xya numbers', numbers
-    while len(numbers) > 1:
-        if numbers != []:
-            try:
-                x = float(numbers[0])
-                y = float(numbers[1])
-                points.append([x,y])
-                numbers.pop(0)
-                numbers.pop(0)
-                #attributes = []
-                #print "att_names",att_names
-                #print "numbers",numbers 
-                if len(att_names) != len(numbers):
-                    fd.close()
-                    # It might not be a problem with the title
-                    #raise TitleAmountError
-                    raise IOError
-                for i,num in enumerate(numbers):
-                    num.strip()
-                    if num != '\n' and num != '':
-                        #attributes.append(float(num))
-                        att_dict.setdefault(att_names[i],[]).append(float(num))
-                        
-            except ValueError:
-                raise SyntaxError
-        line = fd.readline()
-        numbers = clean_line(line,delimiter)
-    
-    if line == '':
-            # end of file
-        geo_reference = None
-    else:
-        geo_reference = Geo_reference(ASCIIFile=fd,read_title=line)
-    
-    xya_dict = {}
-    xya_dict['pointlist'] = array(points).astype(Float)
-    
-    for key in att_dict.keys():
-        att_dict[key] = array(att_dict[key]).astype(Float)
-    xya_dict['attributelist'] = att_dict
-    
-    xya_dict['geo_reference'] = geo_reference
-    #print "xya_dict",xya_dict 
-    return xya_dict
-
 
 def _write_pts_file(file_name, write_data_points,
@@ -686,5 +551,5 @@
                                     delimiter = ','):
     """
-    export a file, ofile, with the xya format
+    export a file, file_name, with the xya format
     
     """
@@ -782,5 +647,5 @@
     return numbers
             
-def add_points_files(add_file1, add_file2, results_file):
+def xxx_add_points_files(add_file1, add_file2, results_file):
     """ adds the points and attruibutes of 2 pts or xya files and
     writes it to a pts file
Index: /inundation/geospatial_data/test_geospatial_data.py
===================================================================
--- /inundation/geospatial_data/test_geospatial_data.py	(revision 2939)
+++ /inundation/geospatial_data/test_geospatial_data.py	(revision 2940)
@@ -52,5 +52,5 @@
         attributes = [2, 4]
         G = Geospatial_data(points, attributes,
-                            geo_reference = Geo_reference(56, 100, 200))
+                            geo_reference=Geo_reference(56, 100, 200))
 
         assert G.geo_reference.zone == 56
@@ -64,11 +64,11 @@
         attributes = [2, 4]
         G = Geospatial_data(points, attributes,
-                            geo_reference = Geo_reference(56, 100, 200))
-
-
-        P = G.get_data_points(absolute = False)
+                            geo_reference=Geo_reference(56, 100, 200))
+
+
+        P = G.get_data_points(absolute=False)
         assert allclose(P, [[1.0, 2.1], [3.0, 5.3]])        
 
-        P = G.get_data_points(absolute = True)
+        P = G.get_data_points(absolute=True)
         assert allclose(P, [[101.0, 202.1], [103.0, 205.3]])        
 
@@ -87,9 +87,9 @@
         attributes = {'a0': [0, 0], 'a1': [2, 4], 'a2': [79.4, -7]}
         G = Geospatial_data(points, attributes,
-                            geo_reference = Geo_reference(56, 100, 200),
-                            default_attribute_name = 'a1')
-
-
-        P = G.get_data_points(absolute = False)
+                            geo_reference=Geo_reference(56, 100, 200),
+                            default_attribute_name='a1')
+
+
+        P = G.get_data_points(absolute=False)
         assert allclose(P, [[1.0, 2.1], [3.0, 5.3]])        
         
@@ -122,6 +122,6 @@
         attributes = {'a0': [0, 0], 'a1': [2, 4], 'a2': [79.4, -7]}
         G = Geospatial_data(points, attributes,
-                            geo_reference = Geo_reference(56, 100, 200),
-                            default_attribute_name = 'a1')
+                            geo_reference=Geo_reference(56, 100, 200),
+                            default_attribute_name='a1')
 
 
@@ -165,5 +165,5 @@
         G = points_dictionary2geospatial_data(points_dict)
 
-        P = G.get_data_points(absolute = False)
+        P = G.get_data_points(absolute=False)
         assert allclose(P, [[1.0, 2.1], [3.0, 5.3]])        
         
@@ -342,11 +342,11 @@
         G1 = Geospatial_data(points, att_dict, geo_ref)
 
-        G1.export_points_file(FN, absolute = True)
+        G1.export_points_file(FN, absolute=True)
 
         #Create object from file
         G = Geospatial_data(file_name = FN)
         
-        assert allclose(G.get_data_points(absolute = True), 
-                        G1.get_data_points(absolute = True))
+        assert allclose(G.get_data_points(absolute=True), 
+                        G1.get_data_points(absolute=True))
         assert allclose(G.get_attributes('att1'), attributes)
         assert allclose(G.get_attributes('att2'), array(attributes) + 1)
@@ -365,10 +365,10 @@
 1.0, 0.0, 10.4, 40.0\n")
         file.close()
-        results = Geospatial_data(fileName, delimiter = ',')
+        results = Geospatial_data(fileName, delimiter=',')
         os.remove(fileName)
 #        print 'data', results.get_data_points()
         assert allclose(results.get_data_points(), [[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
-        assert allclose(results.get_attributes(attribute_name = 'elevation'), [10.0, 0.0, 10.4])
-        assert allclose(results.get_attributes(attribute_name = 'speed'), [0.0, 10.0, 40.0])
+        assert allclose(results.get_attributes(attribute_name='elevation'), [10.0, 0.0, 10.4])
+        assert allclose(results.get_attributes(attribute_name='speed'), [0.0, 10.0, 40.0])
 
     def test_loadxya2(self):
@@ -386,11 +386,11 @@
         file.close()
 
-        results = Geospatial_data(fileName, delimiter = ' ')
+        results = Geospatial_data(fileName, delimiter=' ')
 
         os.remove(fileName)
 
         assert allclose(results.get_data_points(), [[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
-        assert allclose(results.get_attributes(attribute_name = 'elevation'), [10.0, 0.0, 10.4])
-        assert allclose(results.get_attributes(attribute_name = 'speed'), [0.0, 10.0, 40.0])
+        assert allclose(results.get_attributes(attribute_name='elevation'), [10.0, 0.0, 10.4])
+        assert allclose(results.get_attributes(attribute_name='speed'), [0.0, 10.0, 40.0])
      
     def test_loadxya3(self):
@@ -412,10 +412,10 @@
         file.close()
 
-        results = Geospatial_data(fileName, delimiter = ' ')
-
-        os.remove(fileName)
-        assert allclose(results.get_data_points(absolute = False), [[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
-        assert allclose(results.get_attributes(attribute_name = 'elevation'), [10.0, 0.0, 10.4])
-        assert allclose(results.get_attributes(attribute_name = 'speed'), [0.0, 10.0, 40.0])
+        results = Geospatial_data(fileName, delimiter=' ')
+
+        os.remove(fileName)
+        assert allclose(results.get_data_points(absolute=False), [[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
+        assert allclose(results.get_attributes(attribute_name='elevation'), [10.0, 0.0, 10.4])
+        assert allclose(results.get_attributes(attribute_name='speed'), [0.0, 10.0, 40.0])
 
     def test_read_write_points_file_bad2(self):
@@ -424,5 +424,5 @@
         att_dict['elevation'] = array([10.0, 0.0, 10.4])
         att_dict['brightness'] = array([10.0, 0.0, 10.4])
-        geo_reference = Geo_reference(56,1.9,1.9)
+        geo_reference=Geo_reference(56,1.9,1.9)
         
         G = Geospatial_data(pointlist, att_dict, geo_reference)
@@ -451,5 +451,5 @@
         #print fileName
         try:
-            results = Geospatial_data(fileName, delimiter = ' ')
+            results = Geospatial_data(fileName, delimiter=' ')
         except IOError:
             pass
@@ -473,5 +473,5 @@
         #print fileName
         try:
-            results = Geospatial_data(fileName, delimiter = ' ')
+            results = Geospatial_data(fileName, delimiter=' ')
         except IOError:
             pass
@@ -495,5 +495,5 @@
         file.close()
         try:
-            results = Geospatial_data(fileName, delimiter = ' ')
+            results = Geospatial_data(fileName, delimiter=' ')
         except IOError:
             pass
@@ -505,8 +505,7 @@
     def test_loadxy_bad4(self):
         """
-        specifying wrong delimiter
+         specifying wrong delimiter
         """
         import os
-       
         fileName = tempfile.mktemp(".xya")
         file = open(fileName,"w")
@@ -515,11 +514,12 @@
 0.0 1.0 0.0 10.0\n\
 1.0 0.0 10.4 40.0\n\
-#geocrap")
+#geo\n\
+56\n\
+1.1\n\
+1.0\n")
+
         file.close()
         try:
-#            dict = import_points_file(fileName,delimiter = ' ')
-#            results = Geospatial_data()
-            results = Geospatial_data(fileName, delimiter = ',')
-#            results.import_points_file(fileName, delimiter = ' ')
+            results = Geospatial_data(fileName, delimiter=',')
         except IOError:
             pass
@@ -528,6 +528,4 @@
             raise msg
 
-#            self.failUnless(0 ==1,
-#                        'bad xya file did not raise error!')    
         os.remove(fileName)
 
@@ -548,8 +546,8 @@
         file.close()
         try:
-#            dict = import_points_file(fileName,delimiter = ' ')
+#            dict = import_points_file(fileName,delimiter=' ')
 #            results = Geospatial_data()
-            results = Geospatial_data(fileName, delimiter = ' ')
-#            results.import_points_file(fileName, delimiter = ' ')
+            results = Geospatial_data(fileName, delimiter=' ', verbose=True)
+#            results.import_points_file(fileName, delimiter=' ')
         except IOError:
             pass
@@ -567,5 +565,5 @@
         fileName = tempfile.mktemp(".xya")
         try:
-            results = Geospatial_data(fileName, delimiter = ' ')
+            results = Geospatial_data(fileName, delimiter=' ')
         except IOError:
             pass
@@ -590,10 +588,10 @@
         att_dict['brightness'] = array([10.0, 0.0, 10.4])
 #        dict['attributelist'] = att_dict
-        geo_reference = Geo_reference(56,1.9,1.9)
+        geo_reference=Geo_reference(56,1.9,1.9)
         
         
         fileName = tempfile.mktemp(".xya")
         G = Geospatial_data(pointlist, att_dict, geo_reference)
-        G.export_points_file(fileName)
+        G.export_points_file(fileName, False)
 
 #        dict2 = import_points_file(fileName)
@@ -603,7 +601,7 @@
         
         assert allclose(results.get_data_points(absolute=False),[[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
-        assert allclose(results.get_attributes(attribute_name = 'elevation'), [10.0, 0.0, 10.4])
+        assert allclose(results.get_attributes(attribute_name='elevation'), [10.0, 0.0, 10.4])
         answer = [10.0, 0.0, 10.4]
-        assert allclose(results.get_attributes(attribute_name = 'brightness'), answer)
+        assert allclose(results.get_attributes(attribute_name='brightness'), answer)
         #print "dict2['geo_reference']",dict2['geo_reference'] 
         self.failUnless(results.get_geo_reference() == geo_reference,
@@ -637,5 +635,5 @@
         att_dict['elevation'] = array([10.0, 0.0, 10.4])
         att_dict['brightness'] = array([10.0, 0.0, 10.4])
-        geo_reference = Geo_reference(56,1.9,1.9)
+        geo_reference=Geo_reference(56,1.9,1.9)
         
         
@@ -650,8 +648,8 @@
         assert allclose(results.get_data_points(),
                         [[2.9, 1.9],[1.9, 2.9],[2.9, 1.9]])
-        assert allclose(results.get_attributes(attribute_name = 'elevation'),
+        assert allclose(results.get_attributes(attribute_name='elevation'),
                          [10.0, 0.0, 10.4])
         answer = [10.0, 0.0, 10.4]
-        assert allclose(results.get_attributes(attribute_name = 'brightness'), answer)
+        assert allclose(results.get_attributes(attribute_name='brightness'), answer)
         self.failUnless(results.get_geo_reference() == geo_reference,
                          'test_writepts failed. Test geo_reference')                         
@@ -676,7 +674,7 @@
         
         assert allclose(results.get_data_points(),[[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
-        assert allclose(results.get_attributes(attribute_name = 'elevation'), [10.1, 0.0, 10.4])
+        assert allclose(results.get_attributes(attribute_name='elevation'), [10.1, 0.0, 10.4])
         answer = [10.0, 1.0, 10.4]
-        assert allclose(results.get_attributes(attribute_name = 'brightness'), answer)
+        assert allclose(results.get_attributes(attribute_name='brightness'), answer)
 
     def test_new_export_absolute_pts_file(self):
@@ -698,7 +696,7 @@
         
         assert allclose(results.get_data_points(), G.get_data_points(True))
-        assert allclose(results.get_attributes(attribute_name = 'elevation'), [10.1, 0.0, 10.4])
+        assert allclose(results.get_attributes(attribute_name='elevation'), [10.1, 0.0, 10.4])
         answer = [10.0, 1.0, 10.4]
-        assert allclose(results.get_attributes(attribute_name = 'brightness'), answer)
+        assert allclose(results.get_attributes(attribute_name='brightness'), answer)
 
     def test_loadpts(self):
@@ -736,5 +734,5 @@
         answer =  [[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]]
         assert allclose(results.get_data_points(), [[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
-        assert allclose(results.get_attributes(attribute_name = 'elevation'), [10.0, 0.0, 10.4])
+        assert allclose(results.get_attributes(attribute_name='elevation'), [10.0, 0.0, 10.4])
         
     def test_writepts(self):
@@ -743,5 +741,5 @@
         att_dict['elevation'] = array([10.0, 0.0, 10.4])
         att_dict['brightness'] = array([10.0, 0.0, 10.4])
-        geo_reference = Geo_reference(56,1.9,1.9)
+        geo_reference=Geo_reference(56,1.9,1.9)
         
         fileName = tempfile.mktemp(".pts")
@@ -749,5 +747,5 @@
         G = Geospatial_data(pointlist, att_dict, geo_reference)
         
-        G.export_points_file(fileName)
+        G.export_points_file(fileName, False)
         
         results = Geospatial_data(file_name = fileName)
@@ -837,5 +835,5 @@
         xll = 0.1
         yll = 20
-        geo_reference = Geo_reference(56, xll, yll)
+        geo_reference=Geo_reference(56, xll, yll)
         geo_reference.write_NetCDF(outfile)
 
@@ -875,6 +873,7 @@
 
         
-    def test_add_points_files(self):
-        '''adds an xya and pts files and checks resulting file is correct
+    def test_add_(self):
+        '''adds an xya and pts files, reads the files and adds them
+           checking results are correct
         '''
 
@@ -882,18 +881,14 @@
         
         # create files
-#        dict1 = {}
         att_dict1 = {}
         pointlist1 = array([[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
         att_dict1['elevation'] = array([-10.0, 0.0, 10.4])
         att_dict1['brightness'] = array([10.0, 0.0, 10.4])
-#        dict1['attributelist'] = att_dict1
         geo_reference1 = Geo_reference(56, 2.0, 1.0)
         
-#        dict2 = {}
         att_dict2 = {}
         pointlist2 = array([[2.0, 1.0],[1.0, 2.0],[2.0, 1.0]])
         att_dict2['elevation'] = array([1.0, 15.0, 1.4])
         att_dict2['brightness'] = array([14.0, 1.0, -12.4])
-#        dict2['attributelist'] = att_dict2
         geo_reference2 = Geo_reference(56, 1.0, 2.0) #FIXME (Ole): I changed this, why does it still pass
         #OK - it fails now, after the fix revealed by test_create_from_pts_file_with_geo')
@@ -918,13 +913,16 @@
         
         #read results
-        assert allclose(G.get_data_points(absolute = False),
-                        [[2.0, 0.0],[1.0, 1.0],
-                         [2.0, 0.0],[2.0, 2.0],
-                         [1.0, 3.0],[2.0, 2.0]])
-        assert allclose(G.get_attributes(attribute_name = 'elevation'),
+#        print'res', G.get_data_points()
+#        print'res1', G.get_data_points(False)
+        assert allclose(G.get_data_points(),
+                        [[ 3.0, 1.0], [ 2.0, 2.0],
+                         [ 3.0, 1.0], [ 3.0, 3.0],
+                         [ 2.0, 4.0], [ 3.0, 3.0]])
+                         
+        assert allclose(G.get_attributes(attribute_name='elevation'),
                         [-10.0, 0.0, 10.4, 1.0, 15.0, 1.4])
         
         answer = [10.0, 0.0, 10.4, 14.0, 1.0, -12.4]
-        assert allclose(G.get_attributes(attribute_name = 'brightness'), answer)
+        assert allclose(G.get_attributes(attribute_name='brightness'), answer)
         
         self.failUnless(G.get_geo_reference() == geo_reference1,
@@ -962,5 +960,5 @@
         #print "data_points",data_points     
         new_points = ensure_absolute(data_points,
-                                             geo_reference = mesh_origin)
+                                             geo_reference=mesh_origin)
         #print "new_points",new_points
         #print "ab_points",ab_points
@@ -972,5 +970,5 @@
         data_points = geo.change_points_geo_ref(ab_points)   
         new_points = ensure_absolute(data_points,
-                                             geo_reference = geo)
+                                             geo_reference=geo)
         #print "new_points",new_points
         #print "ab_points",ab_points
@@ -985,5 +983,5 @@
         #print "geo in points", points
         G = Geospatial_data(points, attributes,
-                            geo_reference = geo_reference)
+                            geo_reference=geo_reference)
           
         new_points = ensure_absolute(G)
@@ -1011,7 +1009,7 @@
         results = Geospatial_data(fileName)
         
-        assert allclose(results.get_data_points(absolute = False), [[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
-        assert allclose(results.get_attributes(attribute_name = 'elevation'), [10.0, 0.0, 10.4])
-        assert allclose(results.get_attributes(attribute_name = 'speed'), [0.0, 10.0, 40.0])
+        assert allclose(results.get_data_points(absolute=False), [[1.0, 0.0],[0.0, 1.0],[1.0, 0.0]])
+        assert allclose(results.get_attributes(attribute_name='elevation'), [10.0, 0.0, 10.4])
+        assert allclose(results.get_attributes(attribute_name='speed'), [0.0, 10.0, 40.0])
 
         os.remove(fileName)
@@ -1020,5 +1018,5 @@
         
         try:
-            G = Geospatial_data(delimiter = ',')
+            G = Geospatial_data(delimiter=',')
 #            results = Geospatial_data(file_name = fileName)
 #            dict = import_points_file(fileName)
@@ -1042,4 +1040,57 @@
             raise msg        
 
+    def xxx_test_check_geo_reference(self):
+        """
+        checks geo reference details are OK. eg can be called '#geo reference'
+        if not throws a clear error message
+        """
+        import os
+        fileName = tempfile.mktemp(".xya")
+        file = open(fileName,"w")
+        file.write("  elevation  \n\
+1.0 0.0 10.0\n\
+0.0 1.0 0.0\n\
+1.0 0.0 10.4\n\
+#geo reference\n\
+56\n\
+1.1\n\
+1.0\n")
+
+        file.close()
+        results = Geospatial_data(fileName)
+        assert allclose(results.get_geo_reference().get_xllcorner(), 1.1)
+        assert allclose(results.get_geo_reference().get_yllcorner(), 1.0)
+
+    def xxx_test_check_geo_reference1(self):
+        """
+        checks geo reference details are OK. eg can be called '#geo reference'
+        if not throws a clear error message
+        """
+        import os
+        fileName = tempfile.mktemp(".xya")
+        file = open(fileName,"w")
+        file.write("  elevation  \n\
+1.0 0.0 10.0\n\
+0.0 1.0 0.0\n\
+1.0 0.0 10.4\n\
+#geo reference\n\
+56\n\
+1.1\n"
+)
+        file.close()
+
+#        try:
+        results = Geospatial_data(fileName)
+#        except ValueError or SyntaxError:
+#            pass
+#        else:
+#            msg = 'Geo reference data format is incorrect'
+#            raise msg        
+
+
+
+        assert allclose(results.get_geo_reference().get_xllcorner(), 1.1)
+        assert allclose(results.get_geo_reference().get_yllcorner(), 1.0)
+        
 
 
