当前位置: 首页>>代码示例>>Python>>正文


Python Apex.basevectors_apex方法代码示例

本文整理汇总了Python中apexpy.Apex.basevectors_apex方法的典型用法代码示例。如果您正苦于以下问题:Python Apex.basevectors_apex方法的具体用法?Python Apex.basevectors_apex怎么用?Python Apex.basevectors_apex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apexpy.Apex的用法示例。


在下文中一共展示了Apex.basevectors_apex方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_basevectors_apex_scalar_shape

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_scalar_shape():
    A = Apex(date=2000, refh=300)
    ret = A.basevectors_apex(60, 15, 100, precision=1e-2)
    for r in ret[:2]:
        assert r.shape == (2,)
    for r in ret[2:]:
        assert r.shape == (3,)
开发者ID:cmeeren,项目名称:apexpy,代码行数:9,代码来源:test_Apex.py

示例2: test_basevectors_apex_array

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_array():
    A = Apex(date=2000, refh=300)
    f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, e3 = A.basevectors_apex([0, 30], 15, 100, coords='geo')
    _, _, _, _, f1_1, f2_1, _, d1_1, d2_1, d3_1, _, e1_1, e2_1, e3_1 = A._geo2apexall(0, 15, 100)
    _, _, _, _, f1_2, f2_2, _, d1_2, d2_2, d3_2, _, e1_2, e2_2, e3_2 = A._geo2apexall(30, 15, 100)

    assert_allclose(f1[:, 0], f1_1)
    assert_allclose(f2[:, 0], f2_1)
    assert_allclose(d1[:, 0], d1_1)
    assert_allclose(d2[:, 0], d2_1)
    assert_allclose(d3[:, 0], d3_1)
    assert_allclose(e1[:, 0], e1_1)
    assert_allclose(e2[:, 0], e2_1)
    assert_allclose(e3[:, 0], e3_1)

    assert_allclose(f3[:, 0], np.array([0.092637, -0.245951, 0.938848]), rtol=1e-4)
    assert_allclose(g1[:, 0], np.array([0.939012, 0.073416, -0.07342]), rtol=1e-4)
    assert_allclose(g2[:, 0], np.array([0.055389, 1.004155, 0.257594]), rtol=1e-4)
    assert_allclose(g3[:, 0], np.array([0, 0, 1.065135]), rtol=1e-4)

    assert_allclose(f1[:, 1], f1_2)
    assert_allclose(f2[:, 1], f2_2)
    assert_allclose(d1[:, 1], d1_2)
    assert_allclose(d2[:, 1], d2_2)
    assert_allclose(d3[:, 1], d3_2)
    assert_allclose(e1[:, 1], e1_2)
    assert_allclose(e2[:, 1], e2_2)
    assert_allclose(e3[:, 1], e3_2)

    assert_allclose(f3[:, 1], np.array([-0.036618, -0.071019, 0.861604]), rtol=1e-4)
    assert_allclose(g1[:, 1], np.array([0.844391, 0.015353, 0.037152]), rtol=1e-4)
    assert_allclose(g2[:, 1], np.array([0.050808, 1.02131, 0.086342]), rtol=1e-4)
    assert_allclose(g3[:, 1], np.array([0, 0, 1.160625]), rtol=1e-4)
开发者ID:cmeeren,项目名称:apexpy,代码行数:35,代码来源:test_Apex.py

示例3: test_basevectors_apex_vectorization_height

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_vectorization_height():
    A = Apex(date=2000, refh=0)
    f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, e3 = A.basevectors_apex(60, 15, [200, 400], coords='geo')
    _, _, _, _, f1_1, f2_1, _, d1_1, d2_1, d3_1, _, e1_1, e2_1, e3_1 = A._geo2apexall(60, 15, 200)
    _, _, _, _, f1_2, f2_2, _, d1_2, d2_2, d3_2, _, e1_2, e2_2, e3_2 = A._geo2apexall(60, 15, 400)

    assert_allclose(f1[:, 0], f1_1)
    assert_allclose(f2[:, 0], f2_1)
    assert_allclose(d1[:, 0], d1_1)
    assert_allclose(d2[:, 0], d2_1)
    assert_allclose(d3[:, 0], d3_1)
    assert_allclose(e1[:, 0], e1_1)
    assert_allclose(e2[:, 0], e2_1)
    assert_allclose(e3[:, 0], e3_1)

    assert_allclose(f3[:, 0], np.array([-0.088671, -0.018272, 0.993576]), rtol=1e-4)
    assert_allclose(g1[:, 0], np.array([0.903098, 0.245273, 0.085107]), rtol=1e-4)
    assert_allclose(g2[:, 0], np.array([-0.103495, 1.072078, 0.01048]), rtol=1e-4)
    assert_allclose(g3[:, 0], np.array([0, 0, 1.006465]), rtol=1e-4)

    assert_allclose(f1[:, 1], f1_2)
    assert_allclose(f2[:, 1], f2_2)
    assert_allclose(d1[:, 1], d1_2)
    assert_allclose(d2[:, 1], d2_2)
    assert_allclose(d3[:, 1], d3_2)
    assert_allclose(e1[:, 1], e1_2)
    assert_allclose(e2[:, 1], e2_2)
    assert_allclose(e3[:, 1], e3_2)

    assert_allclose(f3[:, 1], np.array([-0.085415, -0.021176, 0.989645]), rtol=1e-4)
    assert_allclose(g1[:, 1], np.array([0.902695, 0.246919, 0.083194]), rtol=1e-4)
    assert_allclose(g2[:, 1], np.array([-0.11051, 1.066094, 0.013274]), rtol=1e-4)
    assert_allclose(g3[:, 1], np.array([0, 0, 1.010463]), rtol=1e-4)
开发者ID:cmeeren,项目名称:apexpy,代码行数:35,代码来源:test_Apex.py

示例4: test_basevectors_apex_vectorization

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_vectorization():
    A = Apex(date=2000, refh=300)
    ret = A.basevectors_apex([60, 60, 60, 60], 15, 100)
    for r in ret[:2]:
        assert r.shape == (2, 4)
    for r in ret[2:]:
        assert r.shape == (3, 4)
    ret = A.basevectors_apex(60, [15, 15, 15, 15], 100)
    for r in ret[:2]:
        assert r.shape == (2, 4)
    for r in ret[2:]:
        assert r.shape == (3, 4)
    ret = A.basevectors_apex(60, 15, [100, 100, 100, 100])
    for r in ret[:2]:
        assert r.shape == (2, 4)
    for r in ret[2:]:
        assert r.shape == (3, 4)
开发者ID:cmeeren,项目名称:apexpy,代码行数:19,代码来源:test_Apex.py

示例5: test_basevectors_apex_invalid_scalar

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_invalid_scalar():
    A = Apex(date=2000, refh=10000)
    with warnings.catch_warnings(record=True) as w:
        f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, e3 = A.basevectors_apex(0, 0, 0)
        A.basevectors_apex(0, 0, 0)
        assert len(w) == 2
        assert issubclass(w[-1].category, UserWarning)
        assert 'set to -9999 where' in str(w[-1].message)

    invalid = [-9999, -9999, -9999]
    assert not np.allclose(f1, invalid[:2])
    assert not np.allclose(f2, invalid[:2])
    assert_allclose(f3, invalid)
    assert_allclose(g1, invalid)
    assert_allclose(g2, invalid)
    assert_allclose(g3, invalid)
    assert_allclose(d1, invalid)
    assert_allclose(d2, invalid)
    assert_allclose(d3, invalid)
    assert_allclose(e1, invalid)
    assert_allclose(e2, invalid)
    assert_allclose(e3, invalid)
开发者ID:cmeeren,项目名称:apexpy,代码行数:24,代码来源:test_Apex.py

示例6: test_basevectors_apex_delta

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_delta():
    A = Apex(date=2000, refh=300)
    for lat in range(0, 90, 10):
        for lon in range(0, 360, 15):
            f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, e3 = A.basevectors_apex(lat, lon, 500)
            f = [np.append(f1, 0), np.append(f2, 0), f3]
            g = [g1, g2, g3]
            d = [d1, d2, d3]
            e = [e1, e2, e3]
            for i, j in [(i, j) for i in range(3) for j in range(3)]:
                delta = 1 if i == j else 0
                assert_allclose(np.sum(f[i]*g[j]), delta, rtol=0, atol=1e-5)
                assert_allclose(np.sum(d[i]*e[j]), delta, rtol=0, atol=1e-5)
开发者ID:cmeeren,项目名称:apexpy,代码行数:15,代码来源:test_Apex.py

示例7: test_basevectors_apex_scalar_geo

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_scalar_geo():
    A = Apex(date=2000, refh=300)

    f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, e3 = A.basevectors_apex(60, 15, 100, coords='geo')

    _, _, _, _, f1_, f2_, _, d1_, d2_, d3_, _, e1_, e2_, e3_ = A._geo2apexall(60, 15, 100)

    assert_allclose(f1, f1_)
    assert_allclose(f2, f2_)
    assert_allclose(d1, d1_)
    assert_allclose(d2, d2_)
    assert_allclose(d3, d3_)
    assert_allclose(e1, e1_)
    assert_allclose(e2, e2_)
    assert_allclose(e3, e3_)
开发者ID:cmeeren,项目名称:apexpy,代码行数:17,代码来源:test_Apex.py

示例8: test_basevectors_apex_scalar_qd

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_scalar_qd():
    A = Apex(date=2000, refh=300)

    f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, e3 = A.basevectors_apex(60, 15, 100, coords='qd', precision=1e-2)

    glat, glon, _ = A.qd2geo(60, 15, 100, precision=1e-2)
    _, _, _, _, f1_, f2_, _, d1_, d2_, d3_, _, e1_, e2_, e3_ = A._geo2apexall(glat, glon, 100)

    assert_allclose(f1, f1_)
    assert_allclose(f2, f2_)
    assert_allclose(d1, d1_)
    assert_allclose(d2, d2_)
    assert_allclose(d3, d3_)
    assert_allclose(e1, e1_)
    assert_allclose(e2, e2_)
    assert_allclose(e3, e3_)
开发者ID:cmeeren,项目名称:apexpy,代码行数:18,代码来源:test_Apex.py

示例9: test_basevectors_apex_scalar

# 需要导入模块: from apexpy import Apex [as 别名]
# 或者: from apexpy.Apex import basevectors_apex [as 别名]
def test_basevectors_apex_scalar():
    A = Apex(date=2000, refh=300)

    f1, f2, f3, g1, g2, g3, d1, d2, d3, e1, e2, e3 = A.basevectors_apex(0, 15, 100, coords='geo')
    _, _, _, _, f1_1, f2_1, _, d1_1, d2_1, d3_1, _, e1_1, e2_1, e3_1 = A._geo2apexall(0, 15, 100)

    assert_allclose(f1, f1_1)
    assert_allclose(f2, f2_1)
    assert_allclose(d1, d1_1)
    assert_allclose(d2, d2_1)
    assert_allclose(d3, d3_1)
    assert_allclose(e1, e1_1)
    assert_allclose(e2, e2_1)
    assert_allclose(e3, e3_1)

    assert_allclose(f3, np.array([0.092637, -0.245951, 0.938848]), rtol=1e-4)
    assert_allclose(g1, np.array([0.939012, 0.073416, -0.07342]), rtol=1e-4)
    assert_allclose(g2, np.array([0.055389, 1.004155, 0.257594]), rtol=1e-4)
    assert_allclose(g3, np.array([0, 0, 1.065135]), rtol=1e-4)
开发者ID:cmeeren,项目名称:apexpy,代码行数:21,代码来源:test_Apex.py


注:本文中的apexpy.Apex.basevectors_apex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。