Repository: fastscape-lem/fastscape

Issue:
grid__area computed value is wrong
It is currently computed as the product of total lengths along this x and y axes, which doesn't account of the "outer" area delineated by nodes (cell centers) and cell edges. It should be cell area times the total number of grid nodes.  

Discussion:

Patch:
diff --git a/fastscape/processes/grid.py b/fastscape/processes/grid.py
index d5510d5..01d4567 100644
--- a/fastscape/processes/grid.py
+++ b/fastscape/processes/grid.py
@@ -67,8 +67,8 @@ class UniformRectilinearGrid2D:
     def initialize(self):
         self._set_length_or_spacing()
         self.size = np.prod(self.shape)
-        self.area = np.prod(self.length)
         self.cell_area = np.prod(self.spacing)
+        self.area = self.cell_area * self.size
 
         self.dx = self.spacing[1]
         self.dy = self.spacing[0]


Test patch:
diff --git a/fastscape/tests/test_processes_grid.py b/fastscape/tests/test_processes_grid.py
index a47866f..8e03c87 100644
--- a/fastscape/tests/test_processes_grid.py
+++ b/fastscape/tests/test_processes_grid.py
@@ -17,7 +17,7 @@ def test_uniform_rectilinear_grid_2d():
     np.testing.assert_equal(p.origin, (0., 1.))
     np.testing.assert_equal(p.length, (10., 30.))
     assert p.size == 12
-    assert p.area == 300.
+    assert p.area == 600.
     assert p.cell_area == 50.
     assert p.dx == 10.
     assert p.dy == 5.