Index: /anuga_core/source/anuga/geospatial_data/geospatial_data.py
===================================================================
--- /anuga_core/source/anuga/geospatial_data/geospatial_data.py	(revision 4548)
+++ /anuga_core/source/anuga/geospatial_data/geospatial_data.py	(revision 4549)
@@ -416,79 +416,60 @@
         
         Always return absolute points!
-        """
+        This alse means, that if you add None to the object,
+        it will be turned into absolute coordinates
+
+        other can be None in which case nothing is added to self.
+        """
+
 
         # find objects zone and checks if the same
         geo_ref1 = self.get_geo_reference()
         zone1 = geo_ref1.get_zone()
-        
-        geo_ref2 = other.get_geo_reference()
-        zone2 = geo_ref2.get_zone()
-
-        geo_ref1.reconcile_zones(geo_ref2)
-
-
-        # sets xll and yll as the smallest from self and other
-        # FIXME (Duncan and Ole): use lower left corner derived from
-        # absolute coordinates
-        #if self.geo_reference.xllcorner <= other.geo_reference.xllcorner:
-        #    xll = self.geo_reference.xllcorner
-        #else:
-        #    xll = other.geo_reference.xllcorner
-
-        #if self.geo_reference.yllcorner <= other.geo_reference.yllcorner:
-        #    yll = self.geo_reference.yllcorner
-        #else:
-        #    yll = other.geo_reference.yllcorner
-            
-        #new_geo_ref = Geo_reference(geo_ref1.get_zone(), xll, yll)
-
-        #xll = yll = 0. 
-        
-#         relative_points1 = self.get_data_points(absolute = False)
-#         relative_points2 = other.get_data_points(absolute = False)
-
-        
-#         relative_points1 = new_geo_ref.\
-#                            change_points_geo_ref(relative_points1,
-#                                                  geo_ref1)
-#         relative_points2 = new_geo_ref.\
-#                            change_points_geo_ref(relative_points2,
-#                                                  geo_ref2)
-        
-#         # Now both point sets are relative to new_geo_ref and
-#         # zones have been reconciled
-
-#         # Concatenate points
-#         new_points = concatenate((relative_points1,
-#                                   relative_points2),
-#                                   axis = 0)
-        
-        new_points = concatenate((self.get_data_points(absolute = True),
-                                  other.get_data_points(absolute = True)),
-                                  axis = 0)        
+
+
+        if other is not None:
+
+            geo_ref2 = other.get_geo_reference()
+            zone2 = geo_ref2.get_zone()
+
+            geo_ref1.reconcile_zones(geo_ref2)
+
+        
+            new_points = concatenate((self.get_data_points(absolute=True),
+                                      other.get_data_points(absolute=True)),
+                                      axis = 0)        
 
         
       
-        # Concatenate attributes if any
-        if self.attributes is None:
-            if other.attributes is not None:
-                msg = 'Geospatial data must have the same \n'
-                msg += 'attributes to allow addition.'
-                raise Exception, msg
-            
-            new_attributes = None
-        else:    
-            new_attributes = {}
-            for x in self.attributes.keys():
-                if other.attributes.has_key(x):
-
-                    attrib1 = self.attributes[x]
-                    attrib2 = other.attributes[x]
-                    new_attributes[x] = concatenate((attrib1, attrib2))
-
-                else:
+            # Concatenate attributes if any
+            if self.attributes is None:
+                if other.attributes is not None:
                     msg = 'Geospatial data must have the same \n'
                     msg += 'attributes to allow addition.'
                     raise Exception, msg
+                
+                new_attributes = None
+            else:    
+                new_attributes = {}
+                for x in self.attributes.keys():
+                    if other.attributes.has_key(x):
+
+                        attrib1 = self.attributes[x]
+                        attrib2 = other.attributes[x]
+                        new_attributes[x] = concatenate((attrib1, attrib2))
+
+                    else:
+                        msg = 'Geospatial data must have the same \n'
+                        msg += 'attributes to allow addition.'
+                        raise Exception, msg
+
+
+        else:
+            #other is None:
+            
+            new_points = self.get_data_points(absolute=True)
+            new_attributes = self.attributes
+
+                    
 
         # Instantiate new data object and return absolute coordinates
@@ -497,4 +478,13 @@
                                new_attributes,
                                new_geo_ref)
+
+
+    def __radd__(self, other):
+        """Handle cases like None + Geospatial_data(...)
+        """
+
+        return self + other
+
+    
     
     ###
Index: /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py
===================================================================
--- /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py	(revision 4548)
+++ /anuga_core/source/anuga/geospatial_data/test_geospatial_data.py	(revision 4549)
@@ -433,4 +433,106 @@
 
         assert allclose(P, concatenate( (points1,points2) ))
+
+
+    def test_add_with_None(self):
+        """ test that None can be added to a geospatical objects
+        """
+        
+        points1 = array([[2.0, 4.1], [4.0, 7.3]])
+        points2 = array([[5.1, 9.1], [6.1, 6.3]])        
+
+        geo_ref1= Geo_reference(55, 1.0, 2.0)
+        geo_ref2 = Geo_reference(zone=55,
+                                 xllcorner=0.1,
+                                 yllcorner=3.0,
+                                 datum='wgs84',
+                                 projection='UTM',
+                                 units='m')
+        
+
+        attributes1 = {'depth':[2, 4.7], 'elevation':[6.1, 5]}
+        attributes2 = {'depth':[-2.3, 4], 'elevation':[2.5, 1]}
+
+
+        G1 = Geospatial_data(points1, attributes1, geo_ref1)
+        assert allclose(G1.get_geo_reference().get_xllcorner(), 1.0)
+        assert allclose(G1.get_geo_reference().get_yllcorner(), 2.0)
+        assert G1.attributes.has_key('depth')
+        assert G1.attributes.has_key('elevation')
+        assert allclose(G1.attributes['depth'], [2, 4.7])
+        assert allclose(G1.attributes['elevation'], [6.1, 5])        
+        
+        G2 = Geospatial_data(points2, attributes2, geo_ref2)
+        assert allclose(G2.get_geo_reference().get_xllcorner(), 0.1)
+        assert allclose(G2.get_geo_reference().get_yllcorner(), 3.0)
+        assert G2.attributes.has_key('depth')
+        assert G2.attributes.has_key('elevation')
+        assert allclose(G2.attributes['depth'], [-2.3, 4])
+        assert allclose(G2.attributes['elevation'], [2.5, 1])        
+
+        #Check that absolute values are as expected
+        P1 = G1.get_data_points(absolute=True)
+        assert allclose(P1, [[3.0, 6.1], [5.0, 9.3]])
+
+        P2 = G2.get_data_points(absolute=True)
+        assert allclose(P2, [[5.2, 12.1], [6.2, 9.3]])        
+
+        # Normal add
+        G = G1 + None
+
+        assert G.attributes.has_key('depth')
+        assert G.attributes.has_key('elevation')
+        assert allclose(G.attributes['depth'], [2, 4.7])
+        assert allclose(G.attributes['elevation'], [6.1, 5])        
+
+        # Points are now absolute.
+        assert allclose(G.get_geo_reference().get_xllcorner(), 0.0)
+        assert allclose(G.get_geo_reference().get_yllcorner(), 0.0)
+        P = G.get_data_points(absolute=True)        
+        assert allclose(P, [[3.0, 6.1], [5.0, 9.3]])
+
+
+        G = G2 + None
+        assert G.attributes.has_key('depth')
+        assert G.attributes.has_key('elevation')
+        assert allclose(G.attributes['depth'], [-2.3, 4])
+        assert allclose(G.attributes['elevation'], [2.5, 1])        
+
+        assert allclose(G.get_geo_reference().get_xllcorner(), 0.0)
+        assert allclose(G.get_geo_reference().get_yllcorner(), 0.0)
+        P = G.get_data_points(absolute=True)        
+        assert allclose(P, [[5.2, 12.1], [6.2, 9.3]])
+        
+
+
+        # Reverse add
+        G = None + G1
+
+        assert G.attributes.has_key('depth')
+        assert G.attributes.has_key('elevation')
+        assert allclose(G.attributes['depth'], [2, 4.7])
+        assert allclose(G.attributes['elevation'], [6.1, 5])        
+
+        # Points are now absolute.
+        assert allclose(G.get_geo_reference().get_xllcorner(), 0.0)
+        assert allclose(G.get_geo_reference().get_yllcorner(), 0.0)
+        P = G.get_data_points(absolute=True)        
+        assert allclose(P, [[3.0, 6.1], [5.0, 9.3]])        
+
+
+        G = None + G2
+        assert G.attributes.has_key('depth')
+        assert G.attributes.has_key('elevation')
+        assert allclose(G.attributes['depth'], [-2.3, 4])
+        assert allclose(G.attributes['elevation'], [2.5, 1])        
+
+        assert allclose(G.get_geo_reference().get_xllcorner(), 0.0)
+        assert allclose(G.get_geo_reference().get_yllcorner(), 0.0)
+        P = G.get_data_points(absolute=True)        
+        assert allclose(P, [[5.2, 12.1], [6.2, 9.3]])
+
+        
+
+        
                            
         
