Exemplo n.º 1
0
def print_low_accuracy():
    '''
    xyp -> latlon -> xyp: low accuracy
    '''
    from cs_ll import latlon2xyp, xyp2latlon
    from cart_ll import latlon2xyz, xyz2latlon
    from cart_cs import xyp2xyz, xyz2xyp


    #------------------------------------------------
    # at the panel border, low_accuracy
    #------------------------------------------------
    xyp1 = (-0.57735026918962606, -0.53747283769483301, 1)
    xyp2 = (-0.57735026918962495, -0.53747283769483301, 1)

    latlon1 = xyp2latlon(*xyp1)
    latlon2 = xyp2latlon(*xyp2)
    xyp1_dict = latlon2xyp( *xyp2latlon(*xyp1) )
    xyp2_dict = latlon2xyp( *xyp2latlon(*xyp2) )

    print('')
    print(repr(latlon1))
    print(repr(latlon2))
    print(repr(xyp1_dict[1]))
    print(repr(xyp2_dict[1]))

    #a_equal(xyp1_dict.keys(), [1,4])
    #a_equal(xyp2_dict.keys(), [1,4])


    xyz1 = xyp2xyz(*xyp1)
    xyz2 = xyp2xyz(*xyp2)
    xyp1_list = xyz2xyp(*xyz1)
    xyp2_list = xyz2xyp(*xyz2)
    print('')
    print(repr(xyz1))
    print(repr(xyz2))
    print(repr(xyp1_dict[1]), xyp1_dict.keys())
    print(repr(xyp2_dict[1]), xyp1_dict.keys())


    a = 1/np.sqrt(3)
    at1, at2 = a*np.tan(-np.pi/4), a*np.tan(np.pi/4) 
    print('')
    print(repr(at1), repr(at2))
Exemplo n.º 2
0
def test_latlon2xyp_xyp2latlon():
    '''
    latlon2xyp() -> xyp2latlon() : check consistency, repeat 1000 times
    '''
    from cs_ll import latlon2xyp, xyp2latlon


    N = 1000
    R = 1
    a = R/sqrt(3)

    for i in range(N):
        lat = pi*rand() - pi/2
        lon = 2*pi*rand()

        xyp_dict = latlon2xyp(lat, lon)

        for panel, (x,y) in xyp_dict.items():
            lat2, lon2 = xyp2latlon(x, y, panel)
            aa_equal((lat,lon), (lat2,lon2), 12)