Index: /anuga_core/documentation/user_manual/anuga_user_manual.tex
===================================================================
--- /anuga_core/documentation/user_manual/anuga_user_manual.tex	(revision 5729)
+++ /anuga_core/documentation/user_manual/anuga_user_manual.tex	(revision 5730)
@@ -18,4 +18,13 @@
 %   makeindex modanuga_user_manual.idx
 % To produce the modanuga_user_manual.ind file.
+
+
+%%%%%%%%%%%%%% TODO %%%%%%%%%%%%%%%%
+%
+% ensure_geospatial
+% ensure_absolute
+% set_geo_reference
+
+
 
 
Index: /anuga_core/source/anuga/coordinate_transforms/geo_reference.py
===================================================================
--- /anuga_core/source/anuga/coordinate_transforms/geo_reference.py	(revision 5729)
+++ /anuga_core/source/anuga/coordinate_transforms/geo_reference.py	(revision 5730)
@@ -385,5 +385,5 @@
         geo_ref = None
     else:
-        geo_ref = apply(Geo_reference,origin)       
+        geo_ref = apply(Geo_reference, origin)       
     return geo_ref
 
Index: /anuga_core/source/anuga/geospatial_data/geospatial_data.py
===================================================================
--- /anuga_core/source/anuga/geospatial_data/geospatial_data.py	(revision 5729)
+++ /anuga_core/source/anuga/geospatial_data/geospatial_data.py	(revision 5730)
@@ -228,26 +228,33 @@
         self.attributes = attributes    
 
+    #def set_geo_reference(self, geo_reference):
+    #    # FIXME (Ole): Backwards compatibility - deprecate
+    #    self.setgeo_reference(geo_reference)
 
     def set_geo_reference(self, geo_reference):
-        """
-        Set's the georeference of geospatial.
-        It can also be used to change the georeference
+        """Set the georeference of geospatial data.
+        
+        It can also be used to change the georeference and will ensure that
+        the absolute coordinate values are unchanged.
         """
         from anuga.coordinate_transforms.geo_reference import Geo_reference
 
         if geo_reference is None:
-            geo_reference = Geo_reference() # Use default
+            # Use default - points are in absolute coordinates
+            geo_reference = Geo_reference()
+            
+        # Allow for tuple (zone, xllcorner, yllcorner)    
         geo_reference = ensure_geo_reference(geo_reference)
+        
         if not isinstance(geo_reference, Geo_reference):
+            # FIXME (Ole): This exception will be raised if geo_reference is None
             msg = 'Argument geo_reference must be a valid Geo_reference \n'
             msg += 'object or None.'
             raise msg
 
-        # if a geo ref already exists, change the point data to
-        # represent the new geo-ref
+        # If a geo_reference already exists, change the point data according to
+        # the new geo reference
         if  self.geo_reference is not None:
-            #FIXME: Maybe put out a warning here...
-            self.data_points = self.get_data_points \
-                               (geo_reference=geo_reference)
+            self.data_points = self.get_data_points(geo_reference=geo_reference)
             
         self.geo_reference = geo_reference
@@ -376,9 +383,11 @@
             lats_longs = []
             for point in self.get_data_points(True):
-                ### UTMtoLL(northing, easting, zone,
+            
+                # UTMtoLL(northing, easting, zone,
                 lat_calced, long_calced = UTMtoLL(point[1],point[0], 
                                                   zone, isSouthHemisphere)
                 lats_longs.append((lat_calced, long_calced)) # to hash
             return lats_longs
+            
         if absolute is True and geo_reference is None:
             return self.geo_reference.get_absolute(self.data_points)
@@ -388,4 +397,5 @@
                                 self.geo_reference)
         else:
+            # If absolute is False 
             return self.data_points
 
@@ -1315,10 +1325,11 @@
             
 def ensure_absolute(points, geo_reference=None):
-    """
+    """Ensure that points are in absolute coordinates.
+    
     This function inputs several formats and
     outputs one format. - a numeric array of absolute points.
 
-    Inputed formats are;
-    points: List or numeric array of coordinate pairs [xi, eta] of
+    Input formats are;
+      points: List or numeric array of coordinate pairs [xi, eta] of
               points or geospatial object or points file name
 
@@ -1328,17 +1339,18 @@
                  relative to their respective origins.
     """
-    if isinstance(points,type('')):
-        #It's a string
-        #assume it is a point file
-        points = Geospatial_data(file_name = points)
-        
-    if isinstance(points,Geospatial_data):
-        points = points.get_data_points( \
-                absolute = True)
-        msg = "Use a Geospatial_data object or a mesh origin. Not both."
+
+    # Input check
+    if isinstance(points, basestring):
+        #It's a string - assume it is a point file
+        points = Geospatial_data(file_name=points)
+        
+    if isinstance(points, Geospatial_data):
+        points = points.get_data_points(absolute=True)
+        msg = 'Use a Geospatial_data object or a mesh origin. Not both.'
         assert geo_reference == None, msg
-            
     else:
         points = ensure_numeric(points, Float)
+        
+    # Sort of geo_reference and convert points
     if geo_reference is None:
         geo = None #Geo_reference()
@@ -1351,4 +1363,6 @@
                                 geo_reference[2])
         points = geo.get_absolute(points)
+        
+    # Return    
     return points
      
@@ -1368,10 +1382,15 @@
                  relative to their respective origins.
     """
-    if isinstance(points,Geospatial_data):
+    
+    # Input check
+    if isinstance(points, Geospatial_data):
         msg = "Use a Geospatial_data object or a mesh origin. Not both."
-        assert geo_reference == None, msg
+        assert geo_reference is None, msg
         return points    
     else:
+        # List or numeric array of absolute points
         points = ensure_numeric(points, Float)
+
+    # Sort out geo reference    
     if geo_reference is None:
         geo = None
@@ -1383,4 +1402,6 @@
                                 geo_reference[1],
                                 geo_reference[2])
+                                
+    # Create Geospatial_data object with appropriate geo reference and return                            
     points = Geospatial_data(data_points=points, geo_reference=geo)        
     return points
Index: /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py
===================================================================
--- /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py	(revision 5729)
+++ /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py	(revision 5730)
@@ -205,4 +205,10 @@
               
     def test_set_geo_reference(self):
+        """test_set_georeference
+        
+        Test that georeference can be changed without changing the 
+        absolute values.
+        """
+            
         points_ab = [[12.5,34.7],[-4.5,-60.0]]
         x_p = -10
@@ -210,18 +216,22 @@
         geo_ref = Geo_reference(56, x_p, y_p)
         points_rel = geo_ref.change_points_geo_ref(points_ab)
-        spatial = Geospatial_data(points_rel)
-        # since the geo_ref wasn't set
-        assert not allclose( points_ab, spatial.get_data_points(absolute=True))
-        
-        spatial = Geospatial_data(points_rel, geo_reference=geo_ref)
-        assert allclose( points_ab, spatial.get_data_points(absolute=True))
-        
+        
+        # Create without geo_ref properly set
+        G = Geospatial_data(points_rel)        
+        assert not allclose(points_ab, G.get_data_points(absolute=True))
+        
+        # Create the way it should be
+        G = Geospatial_data(points_rel, geo_reference=geo_ref)
+        assert allclose(points_ab, G.get_data_points(absolute=True))
+        
+        # Change georeference and check that absolute values are unchanged.
         x_p = 10
         y_p = 400
         new_geo_ref = Geo_reference(56, x_p, y_p)
-        spatial.set_geo_reference(new_geo_ref)
-        assert allclose( points_ab, spatial.get_data_points(absolute=True))
-        
-        
+        G.set_geo_reference(new_geo_ref)
+        assert allclose(points_ab, G.get_data_points(absolute=True))
+        
+
+                
         
     def test_conversions_to_points_dict(self):
Index: /anuga_core/source/anuga/shallow_water/shallow_water_domain.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/shallow_water_domain.py	(revision 5729)
+++ /anuga_core/source/anuga/shallow_water/shallow_water_domain.py	(revision 5730)
@@ -97,4 +97,6 @@
 
 from anuga.utilities.numerical_tools import gradient, mean, ensure_numeric
+from anuga.geospatial_data.geospatial_data import ensure_geospatial
+
 from anuga.config import minimum_storable_height
 from anuga.config import minimum_allowed_height, maximum_allowed_speed
@@ -409,5 +411,8 @@
         
         # FIXME (Ole): HACK - need to make midpoints Geospatial instances
-        midpoints = self.geo_reference.get_absolute(midpoints)        
+        #midpoints = self.geo_reference.get_absolute(midpoints)        
+        
+        # Make midpoints Geospatial instances
+        midpoints = ensure_geospatial(midpoints, self.geo_reference)        
         
         # Compute flow        
Index: /anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py	(revision 5729)
+++ /anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py	(revision 5730)
@@ -5905,7 +5905,7 @@
 if __name__ == "__main__":
 
-    #suite = unittest.makeSuite(Test_Shallow_Water,'test')
-
-    suite = unittest.makeSuite(Test_Shallow_Water,'test_get_flow_through_cross_section_with_geo')    
+    suite = unittest.makeSuite(Test_Shallow_Water,'test')
+
+    #suite = unittest.makeSuite(Test_Shallow_Water,'test_get_flow_through_cross_section_with_geo')    
     #suite = unittest.makeSuite(Test_Shallow_Water,'test_fitting_using_shallow_water_domain')    
     #suite = unittest.makeSuite(Test_Shallow_Water,'test_tight_slope_limiters')
