コード例 #1
0
ファイル: test_spherical.py プロジェクト: pytroll/pyresample
 def test_mul(self):
     """Test multiplying (element-wise) cartesian vectors."""
     d = CCoordinate((1., 0., 0.))
     c = CCoordinate((0., 1., 0.))
     b = CCoordinate((0., 0., 0.))
     np.testing.assert_allclose((d * c).cart, b.cart)
     np.testing.assert_allclose((d * (0, 1, 0)).cart, b.cart)
     np.testing.assert_allclose(((0, 1, 0) * d).cart, b.cart)
コード例 #2
0
ファイル: test_spherical.py プロジェクト: pytroll/pyresample
 def test_add(self):
     """Test adding cartesian vectors."""
     d = CCoordinate((1., 0., 0.))
     c = CCoordinate((0., 1., 0.))
     b = CCoordinate((1., 1., 0.))
     np.testing.assert_allclose((d + c).cart, b.cart)
     np.testing.assert_allclose((d + (0, 1, 0)).cart, b.cart)
     np.testing.assert_allclose(((0, 1, 0) + d).cart, b.cart)
コード例 #3
0
ファイル: test_spherical.py プロジェクト: BENR0/pyresample
 def test_eq(self):
     """Test equality of two cartesian vectors."""
     d = CCoordinate((1., 0., 0.))
     c = CCoordinate((0., 1., 0.))
     self.assertFalse(c == d)
コード例 #4
0
ファイル: test_spherical.py プロジェクト: BENR0/pyresample
 def test_ne(self):
     """Test inequality of two cartesian vectors."""
     d = CCoordinate((1., 0., 0.))
     c = CCoordinate((0., 1., 0.))
     self.assertTrue(c != d)
コード例 #5
0
ファイル: test_spherical.py プロジェクト: BENR0/pyresample
 def test_dot(self):
     """Test the dot product of two cartesian vectors."""
     d = CCoordinate((1., 0., 0.))
     c = CCoordinate((0., 1., 0.))
     self.assertEqual(d.dot(c), 0)
コード例 #6
0
ファイル: test_spherical.py プロジェクト: BENR0/pyresample
 def test_cross(self):
     """Test cross product in cartesian coordinates."""
     d = CCoordinate((1., 0., 0.))
     c = CCoordinate((0., 1., 0.))
     self.assertTrue(np.allclose(d.cross(c).cart, [0., 0., 1.]))
コード例 #7
0
ファイル: test_spherical.py プロジェクト: BENR0/pyresample
 def test_normalize(self):
     """Normalize a cartesian vector."""
     d = CCoordinate((2., 0., 0.))
     self.assertTrue(np.allclose(d.normalize().cart, [1, 0, 0]))
コード例 #8
0
ファイル: test_spherical.py プロジェクト: BENR0/pyresample
 def test_norm(self):
     """Euclidean norm of a cartesian vector."""
     d = CCoordinate((1, 0, 0))
     self.assertEqual(d.norm(), 1.0)
コード例 #9
0
ファイル: test_spherical.py プロジェクト: BENR0/pyresample
 def test_repr(self):
     """Check the representation."""
     d = CCoordinate((0, 0, 0))
     self.assertEqual(repr(d), "[0 0 0]")
コード例 #10
0
ファイル: test_spherical.py プロジェクト: BENR0/pyresample
 def test_to_spherical(self):
     """Test converting to spherical coordinates."""
     d = CCoordinate((1., 0., 0.))
     c = SCoordinate(0, 0)
     self.assertEqual(d.to_spherical(), c)
コード例 #11
0
ファイル: test_spherical.py プロジェクト: pytroll/pyresample
 def test_eq(self):
     """Test equality of two cartesian vectors."""
     d = CCoordinate((1., 0., 0.))
     c = CCoordinate((0., 1., 0.))
     assert not c.__eq__(d)
コード例 #12
0
ファイル: test_spherical.py プロジェクト: pytroll/pyresample
 def test_normalize(self):
     """Normalize a cartesian vector."""
     d = CCoordinate((2., 0., 0.))
     np.testing.assert_allclose(d.normalize().cart, [1, 0, 0])
コード例 #13
0
 def test_str(self):
     """Check the string representation
     """
     d = CCoordinate((0, 0, 0))
     self.assertEqual(str(d), "[0 0 0]")