Ejemplo n.º 1
0
def test_apex2qd_invalid_lat():
    A = Apex(date=2000, refh=300)
    with pytest.raises(ValueError):
        A.apex2qd(91, 0, 0)
    with pytest.raises(ValueError):
        A.apex2qd(-91, 0, 0)
    A.apex2qd(90, 0, 0)
    A.apex2qd(-90, 0, 0)

    assert_allclose(A.apex2qd(90+1e-5, 0, 0), A.apex2qd(90, 0, 0), rtol=0, atol=1e-8)
Ejemplo n.º 2
0
def test_apex2qd_invalid_lat():
    apex_out = Apex(date=2000, refh=300)
    with pytest.raises(ValueError):
        apex_out.apex2qd(91, 0, 0)
    with pytest.raises(ValueError):
        apex_out.apex2qd(-91, 0, 0)
    apex_out.apex2qd(90, 0, 0)
    apex_out.apex2qd(-90, 0, 0)

    assert_allclose(apex_out.apex2qd(90 + 1e-5, 0, 0),
                    apex_out.apex2qd(90, 0, 0),
                    rtol=0,
                    atol=1e-8)
Ejemplo n.º 3
0
def test_apex2qd():
    A = Apex(date=2000, refh=300)
    lat, lon = A.apex2qd(60, 15, 100)
    assert_allclose((lat, lon),
                    [60.498401, 15])
    assert type(lat) != np.ndarray
    assert type(lon) != np.ndarray
Ejemplo n.º 4
0
def test_apex2geo():
    A = Apex(date=2000, refh=300)
    lat, lon, error = A.apex2geo(60, 15, 100, precision=1e-2)
    assert_allclose((lat, lon, error),
                    A.qd2geo(*A.apex2qd(60, 15, 100), height=100, precision=1e-2))
    assert type(lat) != np.ndarray
    assert type(lon) != np.ndarray
    assert type(error) != np.ndarray
Ejemplo n.º 5
0
def test_apex2geo():
    apex_out = Apex(date=2000, refh=300)
    lat, lon, error = apex_out.apex2geo(60, 15, 100, precision=1e-2)
    assert_allclose((lat, lon, error),
                    apex_out.qd2geo(*apex_out.apex2qd(60, 15, 100),
                                    height=100,
                                    precision=1e-2))
    assert type(lat) != np.ndarray
    assert type(lon) != np.ndarray
    assert type(error) != np.ndarray
Ejemplo n.º 6
0
def test_convert_mlt2qd():
    datetime = dt.datetime(2000, 3, 9, 14, 25, 58)
    A = Apex(date=2000, refh=300)
    assert_allclose(
        A.convert(60,
                  15,
                  'mlt',
                  'qd',
                  height=100,
                  datetime=datetime,
                  ssheight=2e5),
        A.apex2qd(60, A.mlt2mlon(15, datetime, ssheight=2e5), height=100))
Ejemplo n.º 7
0
def test_apex2qd_vectorization():
    A = Apex(date=2000, refh=300)
    assert A.apex2qd([60, 60], 15, 100)[0].shape == (2,)
    assert A.apex2qd(60, [15, 15], 100)[0].shape == (2,)
    assert A.apex2qd(60, 15, [100, 100])[0].shape == (2,)
Ejemplo n.º 8
0
def test_convert_mlt2qd():
    datetime = dt.datetime(2000, 3, 9, 14, 25, 58)
    A = Apex(date=2000, refh=300)
    assert_allclose(A.convert(60, 15, 'mlt', 'qd', height=100, datetime=datetime, ssheight=2e5), A.apex2qd(60, A.mlt2mlon(15, datetime, ssheight=2e5), height=100))
Ejemplo n.º 9
0
def test_convert_apex2qd():
    A = Apex(date=2000, refh=300)
    assert_allclose(A.convert(60, 15, 'apex', 'qd', height=100), A.apex2qd(60, 15, height=100))
Ejemplo n.º 10
0
def test_apex2qd_apexheight_close():
    apex_out = Apex(date=2000, refh=300)
    apex_out.apex2qd(0, 15, 300 + 1e-6)
Ejemplo n.º 11
0
def test_apex2qd_vectorization():
    apex_out = Apex(date=2000, refh=300)
    assert apex_out.apex2qd([60, 60], 15, 100)[0].shape == (2, )
    assert apex_out.apex2qd(60, [15, 15], 100)[0].shape == (2, )
    assert apex_out.apex2qd(60, 15, [100, 100])[0].shape == (2, )
Ejemplo n.º 12
0
def test_apex2qd():
    apex_out = Apex(date=2000, refh=300)
    lat, lon = apex_out.apex2qd(60, 15, 100)
    assert_allclose((lat, lon), [60.498401, 15])
    assert type(lat) != np.ndarray
    assert type(lon) != np.ndarray
Ejemplo n.º 13
0
def test_convert_apex2qd():
    apex_out = Apex(date=2000, refh=300)
    assert_allclose(apex_out.convert(60, 15, 'apex', 'qd', height=100),
                    apex_out.apex2qd(60, 15, height=100))
Ejemplo n.º 14
0
def test_apex2qd_apexheight_close():
    A = Apex(date=2000, refh=300)
    A.apex2qd(0, 15, 300 + 1e-6)
Ejemplo n.º 15
0
def test_apex2qd_apexheight_close():
    A = Apex(date=2000, refh=300)
    A.apex2qd(0, 15, 300+1e-6)
Ejemplo n.º 16
0
def test_apex2qd_apexheight_over():
    apex_out = Apex(date=2000, refh=300)
    with pytest.raises(ApexHeightError):
        apex_out.apex2qd(0, 15, 301)
Ejemplo n.º 17
0
def test_apex2qd_apexheight_over():
    A = Apex(date=2000, refh=300)
    with pytest.raises(ApexHeightError):
        A.apex2qd(0, 15, 301)
Ejemplo n.º 18
0
def test_convert_apex2qd():
    A = Apex(date=2000, refh=300)
    assert_allclose(A.convert(60, 15, 'apex', 'qd', height=100),
                    A.apex2qd(60, 15, height=100))