Ejemplo n.º 1
0
 def test_centroid_to_polyvert(self):
     np.testing.assert_array_equal(
         georef.centroid_to_polyvert(np.array([0., 1.]), [0.5, 1.5]),
         np.array([[-0.5, -0.5], [-0.5, 2.5], [0.5, 2.5], [0.5, -0.5],
                   [-0.5, -0.5]]))
     np.testing.assert_array_equal(
         georef.centroid_to_polyvert(np.arange(4).reshape((2, 2)), 0.5),
         np.array([[[-0.5, 0.5], [-0.5, 1.5], [0.5, 1.5], [0.5, 0.5],
                    [-0.5, 0.5]],
                   [[1.5, 2.5], [1.5, 3.5], [2.5, 3.5], [2.5, 2.5],
                    [1.5, 2.5]]]))
     with self.assertRaises(ValueError):
         georef.centroid_to_polyvert([[0.], [1.]], [0.5, 1.5])
Ejemplo n.º 2
0
 def test_centroid_to_polyvert(self):
     np.testing.assert_array_equal(
         georef.centroid_to_polyvert(np.array([0., 1.]),
                                     [0.5, 1.5]),
         np.array([[-0.5, -0.5],
                   [-0.5, 2.5],
                   [0.5, 2.5],
                   [0.5, -0.5],
                   [-0.5, -0.5]]))
     np.testing.assert_array_equal(
         georef.centroid_to_polyvert(np.arange(4).reshape((2, 2)), 0.5),
         np.array([[[-0.5, 0.5],
                    [-0.5, 1.5],
                    [0.5, 1.5],
                    [0.5, 0.5],
                    [-0.5, 0.5]],
                   [[1.5, 2.5],
                    [1.5, 3.5],
                    [2.5, 3.5],
                    [2.5, 2.5],
                    [1.5, 2.5]]]))
     self.assertRaises(ValueError,
                       lambda: georef.centroid_to_polyvert([[0.], [1.]],
                                                           [0.5, 1.5]))