コード例 #1
0
def azibazi_numpy(a_lats, a_lons, b_lats, b_lons, implementation='c'):

    a_lats, a_lons, b_lats, b_lons = float_array_broadcast(
        a_lats, a_lons, b_lats, b_lons)

    assert implementation in ('c', 'python')
    if implementation == 'c':
        from pyrocko import orthodrome_ext
        return orthodrome_ext.azibazi_numpy(a_lats, a_lons, b_lats, b_lons)

    _cosdelta = cosdelta_numpy(a_lats, a_lons, b_lats, b_lons)
    azis = azimuth_numpy(a_lats, a_lons, b_lats, b_lons, _cosdelta)
    bazis = azimuth_numpy(b_lats, b_lons, a_lats, a_lons, _cosdelta)

    eq = num.logical_and(a_lats == b_lats, a_lons == b_lons)
    ii_eq = num.where(eq)[0]
    azis[ii_eq] = 0.0
    bazis[ii_eq] = 180.0
    return azis, bazis
コード例 #2
0
ファイル: orthodrome.py プロジェクト: hvasbath/pyrocko
def azibazi_numpy(a_lats, a_lons, b_lats, b_lons, implementation='c'):

    a_lats, a_lons, b_lats, b_lons = float_array_broadcast(
        a_lats, a_lons, b_lats, b_lons)

    assert implementation in ('c', 'python')
    if implementation == 'c':
        from pyrocko import orthodrome_ext
        return orthodrome_ext.azibazi_numpy(a_lats, a_lons, b_lats, b_lons)

    _cosdelta = cosdelta_numpy(a_lats, a_lons, b_lats, b_lons)
    azis = azimuth_numpy(a_lats, a_lons, b_lats, b_lons, _cosdelta)
    bazis = azimuth_numpy(b_lats, b_lons, a_lats, a_lons, _cosdelta)

    eq = num.logical_and(a_lats == b_lats, a_lons == b_lons)
    ii_eq = num.where(eq)[0]
    azis[ii_eq] = 0.0
    bazis[ii_eq] = 180.0
    return azis, bazis