コード例 #1
0
ファイル: testing.py プロジェクト: cccs-ip/inasafe
def combine_coordinates(x, y):
    """Make list of all combinations of points for x and y coordinates
    :param x:
    :param y:
    """

    return axes_to_points(x, y)
コード例 #2
0
def combine_coordinates(x, y):
    """Make list of all combinations of points for x and y coordinates
    :param x:
    :param y:
    """

    return axes_to_points(x, y)
コード例 #3
0
    def test_axes2points(self):
        """Grid axes can be converted to point coordinates for all pixels
        """

        # Test 1
        x = numpy.linspace(1, 3, 3)
        y = numpy.linspace(10, 20, 2)
        P = axes_to_points(x, y)
        assert numpy.allclose(
            P,
            [[1., 20.], [2., 20.], [3., 20.], [1., 10.], [2., 10.], [3., 10.]],
            rtol=0.0,
            atol=0.0)

        # Test 2
        x = numpy.linspace(1, 5, 11)
        y = numpy.linspace(10, 20, 5)
        P = axes_to_points(x, y)
        assert numpy.allclose(P[12, :], [1.4, 17.5])
コード例 #4
0
    def test_axes2points(self):
        """Grid axes can be converted to point coordinates for all pixels
        """

        # Test 1
        x = numpy.linspace(1, 3, 3)
        y = numpy.linspace(10, 20, 2)
        P = axes_to_points(x, y)
        assert numpy.allclose(P, [[1., 20.],
                                  [2., 20.],
                                  [3., 20.],
                                  [1., 10.],
                                  [2., 10.],
                                  [3., 10.]],
                              rtol=0.0, atol=0.0)

        # Test 2
        x = numpy.linspace(1, 5, 11)
        y = numpy.linspace(10, 20, 5)
        P = axes_to_points(x, y)
        assert numpy.allclose(P[12, :], [1.4, 17.5])