예제 #1
0
    def test_XY(self):
        """A diagonal section"""

        grd = MyGrid()
        i0, j0 = 14, 4
        i1, j1 = 17, 7

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.all(sec.X == np.array([14, 15, 16, 17])))
        self.assertTrue(np.all(sec.Y == np.array([4, 5, 6, 7])))
예제 #2
0
    def test_X(self):
        """A section in the X direction"""

        grd = MyGrid()
        i0, j0 = 14, 4
        i1, j1 = 17, 4

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.all(sec.X == np.array([14, 15, 16, 17])))
        self.assertTrue(np.all(sec.Y == np.array([4, 4, 4, 4])))
예제 #3
0
    def test_Y(self):
        """A section in the Y direction"""

        grd = MyGrid()
        i0, j0 = 14, 4
        i1, j1 = 14, 7

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.all(sec.X == np.array([14, 14, 14, 14])))
        self.assertTrue(np.all(sec.Y == np.array([4, 5, 6, 7])))
예제 #4
0
    def test_Yminus(self):
        """Skew section, negative Y direction"""

        grd = MyGrid()
        i0, j0 = 15, 7
        i1, j1 = 14, 4

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.allclose(sec.X, np.array([15, 14.67, 14.33, 14]), atol=0.005))
        self.assertTrue(np.all(sec.Y == np.array([7, 6, 5, 4])))
예제 #5
0
    def test_Xminus(self):
        """Skew section, negative X direction"""

        grd = MyGrid()
        i0, j0 = 17, 4
        i1, j1 = 14, 5

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.all(sec.X == np.array([17, 16, 15, 14])))
        self.assertTrue(np.allclose(sec.Y, np.array([4, 4.33, 4.67, 5]), atol=0.005))
예제 #6
0
    def test_XY(self):
        """A diagonal section"""

        grd = MyGrid()
        i0, j0 = 14, 4
        i1, j1 = 17, 7

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.all(sec.X == np.array([14, 15, 16, 17])))
        self.assertTrue(np.all(sec.Y == np.array([4, 5, 6, 7])))
예제 #7
0
    def test_Y(self):
        """A section in the Y direction"""

        grd = MyGrid()
        i0, j0 = 14, 4
        i1, j1 = 14, 7

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.all(sec.X == np.array([14, 14, 14, 14])))
        self.assertTrue(np.all(sec.Y == np.array([4, 5, 6, 7])))
예제 #8
0
    def test_X(self):
        """A section in the X direction"""

        grd = MyGrid()
        i0, j0 = 14, 4
        i1, j1 = 17, 4

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.all(sec.X == np.array([14, 15, 16, 17])))
        self.assertTrue(np.all(sec.Y == np.array([4, 4, 4, 4])))
예제 #9
0
    def test_Yminus(self):
        """Skew section, negative Y direction"""

        grd = MyGrid()
        i0, j0 = 15, 7
        i1, j1 = 14, 4

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.allclose(sec.X, np.array([15, 14.67, 14.33, 14]),
                                    atol=0.005))
        self.assertTrue(np.all(sec.Y == np.array([7, 6, 5, 4])))
예제 #10
0
    def test_Xminus(self):
        """Skew section, negative X direction"""

        grd = MyGrid()
        i0, j0 = 17, 4
        i1, j1 = 14, 5

        sec = linear_section(i0, i1, j0, j1, grd)

        self.assertTrue(np.all(sec.X == np.array([17, 16, 15, 14])))
        self.assertTrue(np.allclose(sec.Y, np.array([4, 4.33, 4.67, 5]),
                                    atol=0.005))