|
@@ 1867-1899 (lines=33) @@
|
| 1864 |
|
del self.apex_out, self.in_lat, self.in_lon, self.in_alt |
| 1865 |
|
return |
| 1866 |
|
|
| 1867 |
|
@pytest.mark.parametrize("method_name, out_comp", |
| 1868 |
|
[("geo2apex", |
| 1869 |
|
(56.25343704223633, 92.04932403564453)), |
| 1870 |
|
("apex2geo", |
| 1871 |
|
(53.84184265136719, -66.93045806884766, |
| 1872 |
|
3.6222547805664362e-06)), |
| 1873 |
|
("geo2qd", |
| 1874 |
|
(56.82968521118164, 92.04932403564453)), |
| 1875 |
|
("apex2qd", (60.498401178276744, 15.0)), |
| 1876 |
|
("qd2apex", (59.49138097045895, 15.0))]) |
| 1877 |
|
def test_method_scalar_input(self, method_name, out_comp): |
| 1878 |
|
"""Test the user method against set values with scalars. |
| 1879 |
|
|
| 1880 |
|
Parameters |
| 1881 |
|
---------- |
| 1882 |
|
method_name : str |
| 1883 |
|
Apex class method to be tested |
| 1884 |
|
out_comp : tuple of floats |
| 1885 |
|
Expected output values |
| 1886 |
|
|
| 1887 |
|
""" |
| 1888 |
|
# Get the desired methods |
| 1889 |
|
user_method = getattr(self.apex_out, method_name) |
| 1890 |
|
|
| 1891 |
|
# Get the user output |
| 1892 |
|
user_out = user_method(self.in_lat, self.in_lon, self.in_alt) |
| 1893 |
|
|
| 1894 |
|
# Evaluate the user output |
| 1895 |
|
np.testing.assert_allclose(user_out, out_comp, rtol=1e-5, atol=1e-5) |
| 1896 |
|
|
| 1897 |
|
for out_val in user_out: |
| 1898 |
|
assert np.asarray(out_val).shape == (), "output is not a scalar" |
| 1899 |
|
return |
| 1900 |
|
|
| 1901 |
|
def test_convert_to_mlt(self): |
| 1902 |
|
"""Test conversion from mlon to mlt with scalars.""" |
|
@@ 753-785 (lines=33) @@
|
| 750 |
|
assert str(verr).find(estr) >= 0 |
| 751 |
|
return |
| 752 |
|
|
| 753 |
|
@pytest.mark.parametrize("method_name, out_comp", |
| 754 |
|
[("geo2apex", |
| 755 |
|
(55.94841766357422, 94.10684204101562)), |
| 756 |
|
("apex2geo", |
| 757 |
|
(51.476322174072266, -66.22817993164062, |
| 758 |
|
5.727287771151168e-06)), |
| 759 |
|
("geo2qd", |
| 760 |
|
(56.531288146972656, 94.10684204101562)), |
| 761 |
|
("apex2qd", (60.498401178276744, 15.0)), |
| 762 |
|
("qd2apex", (59.49138097045895, 15.0))]) |
| 763 |
|
def test_method_scalar_input(self, method_name, out_comp): |
| 764 |
|
"""Test the user method against set values with scalars. |
| 765 |
|
|
| 766 |
|
Parameters |
| 767 |
|
---------- |
| 768 |
|
method_name : str |
| 769 |
|
Apex class method to be tested |
| 770 |
|
out_comp : tuple of floats |
| 771 |
|
Expected output values |
| 772 |
|
|
| 773 |
|
""" |
| 774 |
|
# Get the desired methods |
| 775 |
|
user_method = getattr(self.apex_out, method_name) |
| 776 |
|
|
| 777 |
|
# Get the user output |
| 778 |
|
user_out = user_method(self.in_lat, self.in_lon, self.in_alt) |
| 779 |
|
|
| 780 |
|
# Evaluate the user output |
| 781 |
|
np.testing.assert_allclose(user_out, out_comp, rtol=1e-5, atol=1e-5) |
| 782 |
|
|
| 783 |
|
for out_val in user_out: |
| 784 |
|
assert np.asarray(out_val).shape == (), "output is not a scalar" |
| 785 |
|
return |
| 786 |
|
|
| 787 |
|
@pytest.mark.parametrize("in_coord", ["geo", "apex", "qd"]) |
| 788 |
|
@pytest.mark.parametrize("out_coord", ["geo", "apex", "qd"]) |