def test_round_off_error():
    (x, y) = sgrid.node_coords((135, 127),
                               (5.4563957090392, 5.4563957090392),
                               (0., 0.))

    assert_tuple_equal(x.shape, (135 * 127, ))
    assert_tuple_equal(y.shape, (135 * 127, ))
def test_round_off_error():
    (x, y) = sgrid.node_coords(
        (135, 127), (5.4563957090392, 5.4563957090392), (0.0, 0.0)
    )

    assert x.shape == (135 * 127,)
    assert y.shape == (135 * 127,)
    def test_round_off_error(self):
        (x, y) = sgrid.node_coords((135, 127),
                                   (5.4563957090392, 5.4563957090392),
                                   (0., 0.))

        self.assertTupleEqual(x.shape, (135 * 127, ))
        self.assertTupleEqual(y.shape, (135 * 127, ))
def test_round_off_error():
    (x, y) = sgrid.node_coords((135, 127),
                               (5.4563957090392, 5.4563957090392),
                               (0., 0.))

    assert x.shape == (135 * 127, )
    assert y.shape == (135 * 127, )
def test_node_y_2d_with_spacing():
    (_, y) = sgrid.node_coords((3, 2), (2., 10.))

    assert_array_equal(y, np.array([
        0.,
        0.,
        2.,
        2.,
        4.,
        4.,
    ]))
def test_node_x_2d_with_origin():
    (x, _) = sgrid.node_coords((3, 2), (2., 10.), (-1., 1.))

    assert_array_equal(x, np.array([
        1.,
        11.,
        1.,
        11.,
        1.,
        11.,
    ]))
def test_node_x_2d():
    (x, _) = sgrid.node_coords((3, 2))

    assert_array_equal(x, np.array([
        0.,
        1.,
        0.,
        1.,
        0.,
        1.,
    ]))
def test_node_x_2d_with_spacing():
    (x, _) = sgrid.node_coords((3, 2), (2., 10.))

    assert_array_equal(x, np.array([
        0.,
        10.,
        0.,
        10.,
        0.,
        10.,
    ]))
def test_node_y_2d():
    (_, y) = sgrid.node_coords((3, 2))

    assert_array_equal(y, np.array([
        0.,
        0.,
        1.,
        1.,
        2.,
        2.,
    ]))
def test_node_y_2d_with_origin():
    (_, y) = sgrid.node_coords((3, 2), (2., 10.), (-1., 1.))

    assert_array_equal(y, np.array([
        -1.,
        -1.,
        1.,
        1.,
        3.,
        3.,
    ]))
def test_node_x_2d():
    (x, _) = sgrid.node_coords((3, 2))

    assert_array_equal(x, np.array([0., 1., 0., 1., 0., 1.]))
def test_node_y_2d_with_origin():
    (_, y) = sgrid.node_coords((3, 2), (2., 10.), (-1., 1.))

    assert_array_equal(y, np.array([-1., -1., 1., 1., 3., 3.]))
def test_node_y_2d_with_spacing():
    (_, y) = sgrid.node_coords((3, 2), (2., 10.))

    assert_array_equal(y, np.array([0., 0., 2., 2., 4., 4.]))
    def test_node_y_2d_with_spacing(self):
        (_, y) = sgrid.node_coords((3,2), (2., 10.))

        self.assertArrayEqual(y, np.array([0., 0.,
                                        2., 2.,
                                        4., 4.,]))
def test_node_x_2d_with_origin():
    (x, _) = sgrid.node_coords((3, 2), (2., 10.), (-1., 1.))

    assert_array_equal(x, np.array([1., 11., 1., 11., 1., 11.]))
    def test_node_x_2d_with_spacing(self):
        (x, _) = sgrid.node_coords((3,2), (2., 10.))

        self.assertArrayEqual(x, np.array([0., 10.,
                                        0., 10.,
                                        0., 10.,]))
Exemple #17
0
def test_round_off_error():
    (x, y) = sgrid.node_coords((135, 127), (5.4563957090392, 5.4563957090392),
                               (0., 0.))

    assert_tuple_equal(x.shape, (135 * 127, ))
    assert_tuple_equal(y.shape, (135 * 127, ))
def test_node_y_2d_with_origin():
    (_, y) = sgrid.node_coords((3, 2), (2.0, 10.0), (-1.0, 1.0))

    assert_array_equal(y, np.array([-1.0, -1.0, 1.0, 1.0, 3.0, 3.0]))
    def test_node_x_2d_with_origin(self):
        (x, _) = sgrid.node_coords((3,2), (2., 10.), (-1., 1.))

        self.assertArrayEqual(x, np.array([1., 11.,
                                        1., 11.,
                                        1., 11.,]))
    def test_node_y_2d_with_origin(self):
        (_, y) = sgrid.node_coords((3,2), (2., 10.), (-1., 1.))

        self.assertArrayEqual(y, np.array([-1., -1.,
                                         1.,  1.,
                                         3.,  3.,]))
def test_node_y_2d():
    (_, y) = sgrid.node_coords((3, 2))

    assert_array_equal(y, np.array([0., 0., 1., 1., 2., 2.]))
    def test_node_x_2d(self):
        (x, _) = sgrid.node_coords((3,2))

        self.assertArrayEqual(x, np.array([0., 1.,
                                        0., 1.,
                                        0., 1.,]))
    def test_node_y_2d(self):
        (_, y) = sgrid.node_coords((3,2))

        self.assertArrayEqual(y, np.array([0., 0.,
                                        1., 1.,
                                        2., 2.,]))
def test_node_y_2d_with_origin():
    (_, y) = sgrid.node_coords((3, 2), (2.0, 10.0), (-1.0, 1.0))

    assert_array_equal(y, np.array([-1.0, -1.0, 1.0, 1.0, 3.0, 3.0]))
def test_node_x_2d_with_spacing():
    (x, _) = sgrid.node_coords((3, 2), (2., 10.))

    assert_array_equal(x, np.array([0., 10., 0., 10., 0., 10.]))