def test_qd2apex_invalid_lat(): A = Apex(date=2000, refh=300) with pytest.raises(ValueError): A.qd2apex(91, 0, 0) with pytest.raises(ValueError): A.qd2apex(-91, 0, 0) A.qd2apex(90, 0, 0) A.qd2apex(-90, 0, 0) assert_allclose(A.qd2apex(90+1e-5, 0, 0), A.qd2apex(90, 0, 0), rtol=0, atol=1e-8)
def test_qd2apex_invalid_lat(): apex_out = Apex(date=2000, refh=300) with pytest.raises(ValueError): apex_out.qd2apex(91, 0, 0) with pytest.raises(ValueError): apex_out.qd2apex(-91, 0, 0) apex_out.qd2apex(90, 0, 0) apex_out.qd2apex(-90, 0, 0) assert_allclose(apex_out.qd2apex(90 + 1e-5, 0, 0), apex_out.qd2apex(90, 0, 0), rtol=0, atol=1e-8)
def test_qd2apex(): A = Apex(date=2000, refh=300) lat, lon = A.qd2apex(60, 15, 100) assert_allclose((lat, lon), [59.491381, 15]) assert type(lat) != np.ndarray assert type(lon) != np.ndarray
def test_qd2apex_apexheight_over(): A = Apex(date=2000, refh=300) with pytest.raises(ApexHeightError): A.qd2apex(0, 15, 299)
def test_qd2apex_apexheight_close(): A = Apex(date=2000, refh=300) assert_allclose(A.qd2apex(0, 15, 300-1e-5), A.qd2apex(0, 15, 300))
def test_qd2apex_vectorization(): A = Apex(date=2000, refh=300) assert A.qd2apex([60, 60], 15, 100)[0].shape == (2,) assert A.qd2apex(60, [15, 15], 100)[0].shape == (2,) assert A.qd2apex(60, 15, [100, 100])[0].shape == (2,)
def test_convert_qd2apex(): A = Apex(date=2000, refh=300) assert_allclose(A.convert(60, 15, 'qd', 'apex', height=100), A.qd2apex(60, 15, height=100))
def test_qd2apex_apexheight_over(): apex_out = Apex(date=2000, refh=300) with pytest.raises(ApexHeightError): apex_out.qd2apex(0, 15, 299)
def test_qd2apex_apexheight_close(): apex_out = Apex(date=2000, refh=300) assert_allclose(apex_out.qd2apex(0, 15, 300 - 1e-5), apex_out.qd2apex(0, 15, 300))
def test_qd2apex_vectorization(): apex_out = Apex(date=2000, refh=300) assert apex_out.qd2apex([60, 60], 15, 100)[0].shape == (2, ) assert apex_out.qd2apex(60, [15, 15], 100)[0].shape == (2, ) assert apex_out.qd2apex(60, 15, [100, 100])[0].shape == (2, )
def test_qd2apex(): apex_out = Apex(date=2000, refh=300) lat, lon = apex_out.qd2apex(60, 15, 100) assert_allclose((lat, lon), [59.491381, 15]) assert type(lat) != np.ndarray assert type(lon) != np.ndarray
def test_convert_qd2apex(): apex_out = Apex(date=2000, refh=300) assert_allclose(apex_out.convert(60, 15, 'qd', 'apex', height=100), apex_out.qd2apex(60, 15, height=100))
def test_qd2apex_apexheight_close(): A = Apex(date=2000, refh=300) assert_allclose(A.qd2apex(0, 15, 300 - 1e-5), A.qd2apex(0, 15, 300))
def test_convert_qd2apex(): A = Apex(date=2000, refh=300) assert_allclose(A.convert(60, 15, 'qd', 'apex', height=100), A.qd2apex(60, 15, height=100))