def test_GreatCircle(): ''' GreatCircle: max_angle, pt3 ''' from numpy import deg2rad from greatcircle import GreatCircle from convert_coord.cart_ll import xyz2latlon #---------------------------------------------- pt1 = (deg2rad(0),deg2rad(0)) pt2 = (deg2rad(30),deg2rad(0)) gc = GreatCircle(pt1, pt2) aa_equal(gc.max_angle, np.pi/6, 15) aa_equal(gc.latlon3, (np.pi/2,0), 15) #---------------------------------------------- a = 1/np.sqrt(2) pt1 = xyz2latlon(1,0,0) pt2 = xyz2latlon(a,0.5,0.5) gc = GreatCircle(pt1, pt2) aa_equal(gc.max_angle, np.pi/4, 15) aa_equal(gc.xyz3, (0,a,a), 15)
def __init__(self, latlon1, latlon2): self.latlon1 = latlon1 self.latlon2 = latlon2 self.xyz1 = latlon2xyz(*latlon1) self.xyz2 = latlon2xyz(*latlon2) self.max_angle = angle(self.xyz1, self.xyz2) # pt3 which is perpendicular with pt1 on the great circle pt1_pt2 self.xyz3 = self.get_xyz3() self.latlon3 = xyz2latlon(*self.xyz3)
def phi2latlon(self, phi): return xyz2latlon( *self.phi2xyz(phi) )
def phi2latlon(self, phi): r, pc, nv1, nv2 = self.r, self.pc, self.nv1, self.nv2 xyz = pc + r*cos(phi)*nv1 + r*sin(phi)*nv2 return xyz2latlon(*xyz)