コード例 #1
0
def test_convert_array_np_input():
    time = datetime(year=2012, month=6, day=15, hour=22, minute=2)
    input_lat = np.array([north_pole.lat, north_pole.lat])
    input_lon = np.array([north_pole.lon, north_pole.lon])
    res = convert.arr_mag_to_geo(input_lat, input_lon, time)
    expected = np.array([[NP_GLAT, NP_GLAT], [NP_GLON, NP_GLON]])
    np.testing.assert_array_equal(res, expected)
コード例 #2
0
def test_convert_array_np_input_shape():
    time = datetime(year=2012, month=6, day=15, hour=22, minute=2)
    input_lat = np.array([[north_pole.lat], [north_pole.lat]])
    input_lon = np.array([[north_pole.lon], [north_pole.lon]])
    with pytest.raises(ValueError):
        convert.arr_mag_to_geo(input_lat, input_lon, time)
コード例 #3
0
def test_convert_array_uneven():
    time = datetime(year=2012, month=6, day=15, hour=22, minute=2)
    with pytest.raises(ValueError):
        convert.arr_mag_to_geo([north_pole.lat, north_pole.lat],
                               [north_pole.lon], time)
コード例 #4
0
def test_convert_array_single_input():
    time = datetime(year=2012, month=6, day=15, hour=22, minute=2)
    with pytest.raises(TypeError):
        convert.arr_mag_to_geo(north_pole.lat, north_pole.lon, time)
コード例 #5
0
def test_convert_array():
    time = datetime(year=2012, month=6, day=15, hour=22, minute=2)
    res = convert.arr_mag_to_geo([north_pole.lat], [north_pole.lon], time)
    np.testing.assert_array_equal(res, np.array([[NP_GLAT], [NP_GLON]]))