def test_center_coords(self): grid = RegularGrid((0.0, 0.0, 30.0, 30.0, 0.0, 0.0), values=np.zeros([49, 49])) ans = np.meshgrid(np.arange(15.0, 1471.0, 30.0), np.arange(15.0, 1471.0, 30.0)) self.assertEqual(0.0, np.sum(grid.center_coords()[0] - ans[0])) self.assertEqual(0.0, np.sum(grid.center_coords()[1] - ans[1]))
def test_center_coords_skewed(self): grid = RegularGrid((15.0, 15.0, 30.0, 30.0, 20.0, 10.0), values=np.zeros([5, 5])) X, Y = grid.center_coords() self.assertEqual(X[0, 0], 40.0) self.assertEqual(Y[0, 0], 35.0) self.assertEqual(X[-1, 0], 120.0) self.assertEqual(Y[-1, 0], 155.0) self.assertEqual(X[-1, -1], 240.0) self.assertEqual(Y[-1, -1], 195.0)