Example #1
0
def xyp2latlon(x, y, panel, rotate_lat=RLAT, rotate_lon=RLON, R=1):
    xyz = xyp2xyz(x, y, panel)
    xr, yr, zr = xyz_rotate_reverse(xyz, rotate_lat, rotate_lon)
    lat, lon = xyz2latlon(xr, yr, zr, R)

    """
    print 'x=%.18f, y=%.18f'%(x,y)
    print 'x=%.18f, y=%.18f, z=%.18f'%xyz
    print 'xr=%.18f, yr=%.18f, zr=%.18f'%(xr,yr,zr)
    print 'lat=%.18f, lon=%.18f'%(lat,lon)
    """

    return (lat, lon)
Example #2
0
def test_xyp_rotate_reverse():
    '''
    xyp_rotate() -> xyz_reverse_rotate() : check consistency, repeat 1000 times
    '''
    from cart_rotate import xyz_rotate, xyz_rotate_reverse
    from cart_ll import latlon2xyz


    N = 1000

    for i in xrange(N):
        lat = pi*rand() - pi/2
        lon = 2*pi*rand()
        x, y, z = latlon2xyz(lat, lon)

        rlat = pi*rand() - pi/2
        rlon = 2*pi*rand()
        xr, yr, zr = xyz_rotate((x, y, z), rlat, rlon)
        x2, y2, z2 = xyz_rotate_reverse((xr, yr, zr), rlat, rlon)

        aa_equal((x,y,z), (x2,y2,z2), 15)