|
@@ 680-712 (lines=33) @@
|
| 677 |
|
assert str(verr).find(estr) >= 0 |
| 678 |
|
return |
| 679 |
|
|
| 680 |
|
@pytest.mark.parametrize("method_name, out_comp", |
| 681 |
|
[("geo2apex", |
| 682 |
|
(55.94841766357422, 94.10684204101562)), |
| 683 |
|
("apex2geo", |
| 684 |
|
(51.476322174072266, -66.22817993164062, |
| 685 |
|
5.727287771151168e-06)), |
| 686 |
|
("geo2qd", |
| 687 |
|
(56.531288146972656, 94.10684204101562)), |
| 688 |
|
("apex2qd", (60.498401178276744, 15.0)), |
| 689 |
|
("qd2apex", (59.49138097045895, 15.0))]) |
| 690 |
|
def test_method_scalar_input(self, method_name, out_comp): |
| 691 |
|
"""Test the user method against set values with scalars. |
| 692 |
|
|
| 693 |
|
Parameters |
| 694 |
|
---------- |
| 695 |
|
method_name : str |
| 696 |
|
Apex class method to be tested |
| 697 |
|
out_comp : tuple of floats |
| 698 |
|
Expected output values |
| 699 |
|
|
| 700 |
|
""" |
| 701 |
|
# Get the desired methods |
| 702 |
|
user_method = getattr(self.apex_out, method_name) |
| 703 |
|
|
| 704 |
|
# Get the user output |
| 705 |
|
user_out = user_method(self.in_lat, self.in_lon, self.in_alt) |
| 706 |
|
|
| 707 |
|
# Evaluate the user output |
| 708 |
|
np.testing.assert_allclose(user_out, out_comp, rtol=1e-5, atol=1e-5) |
| 709 |
|
|
| 710 |
|
for out_val in user_out: |
| 711 |
|
assert np.asarray(out_val).shape == (), "output is not a scalar" |
| 712 |
|
return |
| 713 |
|
|
| 714 |
|
@pytest.mark.parametrize("in_coord", ["geo", "apex", "qd"]) |
| 715 |
|
@pytest.mark.parametrize("out_coord", ["geo", "apex", "qd"]) |
|
@@ 1794-1826 (lines=33) @@
|
| 1791 |
|
del self.apex_out, self.in_lat, self.in_lon, self.in_alt |
| 1792 |
|
return |
| 1793 |
|
|
| 1794 |
|
@pytest.mark.parametrize("method_name, out_comp", |
| 1795 |
|
[("geo2apex", |
| 1796 |
|
(56.25343704223633, 92.04932403564453)), |
| 1797 |
|
("apex2geo", |
| 1798 |
|
(53.84184265136719, -66.93045806884766, |
| 1799 |
|
3.6222547805664362e-06)), |
| 1800 |
|
("geo2qd", |
| 1801 |
|
(56.82968521118164, 92.04932403564453)), |
| 1802 |
|
("apex2qd", (60.498401178276744, 15.0)), |
| 1803 |
|
("qd2apex", (59.49138097045895, 15.0))]) |
| 1804 |
|
def test_method_scalar_input(self, method_name, out_comp): |
| 1805 |
|
"""Test the user method against set values with scalars. |
| 1806 |
|
|
| 1807 |
|
Parameters |
| 1808 |
|
---------- |
| 1809 |
|
method_name : str |
| 1810 |
|
Apex class method to be tested |
| 1811 |
|
out_comp : tuple of floats |
| 1812 |
|
Expected output values |
| 1813 |
|
|
| 1814 |
|
""" |
| 1815 |
|
# Get the desired methods |
| 1816 |
|
user_method = getattr(self.apex_out, method_name) |
| 1817 |
|
|
| 1818 |
|
# Get the user output |
| 1819 |
|
user_out = user_method(self.in_lat, self.in_lon, self.in_alt) |
| 1820 |
|
|
| 1821 |
|
# Evaluate the user output |
| 1822 |
|
np.testing.assert_allclose(user_out, out_comp, rtol=1e-5, atol=1e-5) |
| 1823 |
|
|
| 1824 |
|
for out_val in user_out: |
| 1825 |
|
assert np.asarray(out_val).shape == (), "output is not a scalar" |
| 1826 |
|
return |
| 1827 |
|
|
| 1828 |
|
def test_convert_to_mlt(self): |
| 1829 |
|
"""Test conversion from mlon to mlt with scalars.""" |