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