def test_error_ellipse(self): vcv = np.array([ [90, 0, 0], [0, 90, 0], [0, 0, 90], ]) expected_result = (9.486832980505138, 9.486832980505138, 90.0) result = statistics.error_ellipse(vcv) self.assertEqual(expected_result, result) self.assertEqual(type(expected_result), type(result))
def test_vcv_cart2local_and_vcv_local2cart2_1X3(self): lat = 0.0 lon = 0.0 v_cart = np.array([ [0.0], [0.0], [0.0], ]) expected_result = np.array([ [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], ]) result_cart2local = statistics.vcv_cart2local(v_cart, lat, lon) result_local2cart = statistics.vcv_local2cart(v_cart, lat, lon) np.testing.assert_array_equal(expected_result, result_cart2local) np.testing.assert_array_equal(expected_result, result_local2cart) self.assertEqual(type(expected_result), type(result_cart2local)) self.assertEqual(type(expected_result), type(result_local2cart))
def test_vcv_cart2local_and_vcv_local2cart2_2X3(self): lat = 0.0 lon = 0.0 v_cart = np.array([ [0.0, 0.0, 0.0], [0.0, 0.0, 0.0], ]) with self.assertRaises(SystemExit): statistics.vcv_cart2local(v_cart, lat, lon) with self.assertRaises(SystemExit): statistics.vcv_local2cart(v_cart, lat, lon)
def test_rotation_matrix(self): lat = 19.4792 lon = 70.6931 expected_result = np.array([ [-0.94376114, -0.11025276, 0.31170376], [0.33062805, -0.31471096, 0.88974272], [0.0, 0.94276261, 0.33346463], ]) result = statistics.rotation_matrix(lat, lon) np.array_equal(expected_result, result) self.assertEqual(type(expected_result), type(result))