@@ 1825-1857 (lines=33) @@ | ||
1822 | del self.apex_out, self.in_lat, self.in_lon, self.in_alt |
|
1823 | return |
|
1824 | ||
1825 | @pytest.mark.parametrize("method_name, out_comp", |
|
1826 | [("geo2apex", |
|
1827 | (56.30344009399414, 91.99834442138672)), |
|
1828 | ("apex2geo", |
|
1829 | (54.22148513793945, -67.09271240234375, |
|
1830 | 4.268868451617891e-06)), |
|
1831 | ("geo2qd", |
|
1832 | (56.87860870361328, 91.99834442138672)), |
|
1833 | ("apex2qd", (60.498401178276744, 15.0)), |
|
1834 | ("qd2apex", (59.49138097045895, 15.0))]) |
|
1835 | def test_method_scalar_input(self, method_name, out_comp): |
|
1836 | """Test the user method against set values with scalars. |
|
1837 | ||
1838 | Parameters |
|
1839 | ---------- |
|
1840 | method_name : str |
|
1841 | Apex class method to be tested |
|
1842 | out_comp : tuple of floats |
|
1843 | Expected output values |
|
1844 | ||
1845 | """ |
|
1846 | # Get the desired methods |
|
1847 | user_method = getattr(self.apex_out, method_name) |
|
1848 | ||
1849 | # Get the user output |
|
1850 | user_out = user_method(self.in_lat, self.in_lon, self.in_alt) |
|
1851 | ||
1852 | # Evaluate the user output |
|
1853 | np.testing.assert_allclose(user_out, out_comp, rtol=1e-5, atol=1e-5) |
|
1854 | ||
1855 | for out_val in user_out: |
|
1856 | assert np.asarray(out_val).shape == (), "output is not a scalar" |
|
1857 | return |
|
1858 | ||
1859 | def test_convert_to_mlt(self): |
|
1860 | """Test conversion from mlon to mlt with scalars.""" |
|
@@ 711-743 (lines=33) @@ | ||
708 | assert str(verr).find(estr) >= 0 |
|
709 | return |
|
710 | ||
711 | @pytest.mark.parametrize("method_name, out_comp", |
|
712 | [("geo2apex", |
|
713 | (55.94841766357422, 94.10684204101562)), |
|
714 | ("apex2geo", |
|
715 | (51.476322174072266, -66.22817993164062, |
|
716 | 5.727287771151168e-06)), |
|
717 | ("geo2qd", |
|
718 | (56.531288146972656, 94.10684204101562)), |
|
719 | ("apex2qd", (60.498401178276744, 15.0)), |
|
720 | ("qd2apex", (59.49138097045895, 15.0))]) |
|
721 | def test_method_scalar_input(self, method_name, out_comp): |
|
722 | """Test the user method against set values with scalars. |
|
723 | ||
724 | Parameters |
|
725 | ---------- |
|
726 | method_name : str |
|
727 | Apex class method to be tested |
|
728 | out_comp : tuple of floats |
|
729 | Expected output values |
|
730 | ||
731 | """ |
|
732 | # Get the desired methods |
|
733 | user_method = getattr(self.apex_out, method_name) |
|
734 | ||
735 | # Get the user output |
|
736 | user_out = user_method(self.in_lat, self.in_lon, self.in_alt) |
|
737 | ||
738 | # Evaluate the user output |
|
739 | np.testing.assert_allclose(user_out, out_comp, rtol=1e-5, atol=1e-5) |
|
740 | ||
741 | for out_val in user_out: |
|
742 | assert np.asarray(out_val).shape == (), "output is not a scalar" |
|
743 | return |
|
744 | ||
745 | @pytest.mark.parametrize("in_coord", ["geo", "apex", "qd"]) |
|
746 | @pytest.mark.parametrize("out_coord", ["geo", "apex", "qd"]) |