예제 #1
0
    def drawgreatcircle(self,ax,lon1,lat1,lon2,lat2,dtheta=0.02,color='k', \
                       linewidth=1.,linestyle='-',dashes=[None,None]):
        """
 draw a great circle on the map.

 ax - current axis instance.
 lon1,lat1 - longitude,latitude of one endpoint of the great circle.
 lon2,lat2 - longitude,latitude of the other endpoint of the great circle.
 dtheta - interval between points on arc in radians (default=0.02).
 color - color to draw great circle (default black).
 linewidth - line width for great circle (default 1.)
 linestyle - line style for great circle (default '-', i.e. solid).
 dashes - dash pattern for great circle (default [None,None], i.e. solid).

 Note:  cannot handle situations in which the great circle intersects
 the edge of the map projection domain, and then re-enters the domain.
        """
        gc = GreatCircle(lon1,lat1,lon2,lat2)
        if gc.antipodal:
            raise ValueError,'cannot draw great circle whose endpoints are antipodal'
        # points have spacing of dtheta radians.
        npoints = int(gc.distance/dtheta)+1
        lons, lats = gc.points(npoints)
        x, y = self(lons, lats)
        l = Line2D(x,y,linewidth=linewidth,linestyle=linestyle)
        l.set_color(color)
        if dashes[0] is not None:
            l.set_dashes(dashes)
        ax.add_line(l)
예제 #2
0
    def drawgreatcircle(self,ax,lon1,lat1,lon2,lat2,dtheta=0.02,color='k', \
                       linewidth=1.,linestyle='-',dashes=[None,None]):
        """
 draw a great circle on the map.

 ax - current axis instance.
 lon1,lat1 - longitude,latitude of one endpoint of the great circle.
 lon2,lat2 - longitude,latitude of the other endpoint of the great circle.
 dtheta - interval between points on arc in radians (default=0.02).
 color - color to draw great circle (default black).
 linewidth - line width for great circle (default 1.)
 linestyle - line style for great circle (default '-', i.e. solid).
 dashes - dash pattern for great circle (default [None,None], i.e. solid).

 Note:  cannot handle situations in which the great circle intersects
 the edge of the map projection domain, and then re-enters the domain.
        """
        gc = GreatCircle(lon1, lat1, lon2, lat2)
        if gc.antipodal:
            raise ValueError, 'cannot draw great circle whose endpoints are antipodal'
        # points have spacing of dtheta radians.
        npoints = int(gc.distance / dtheta) + 1
        lons, lats = gc.points(npoints)
        x, y = self(lons, lats)
        l = Line2D(x, y, linewidth=linewidth, linestyle=linestyle)
        l.set_color(color)
        if dashes[0] is not None:
            l.set_dashes(dashes)
        ax.add_line(l)
예제 #3
0
    def gcpoints(self,lon1,lat1,lon2,lat2,npoints):
        """
 compute npoints points along a great circle with endpoints
 (lon1,lat1) and (lon2,lat2).  Returns numarrays x,y
 with map projection coordinates.
        """
        gc = GreatCircle(lon1,lat1,lon2,lat2)
        lons, lats = gc.points(npoints)
        x, y = self(lons, lats)
        return x,y
예제 #4
0
    def gcpoints(self, lon1, lat1, lon2, lat2, npoints):
        """
 compute npoints points along a great circle with endpoints
 (lon1,lat1) and (lon2,lat2).  Returns numarrays x,y
 with map projection coordinates.
        """
        gc = GreatCircle(lon1, lat1, lon2, lat2)
        lons, lats = gc.points(npoints)
        x, y = self(lons, lats)
        return x, y
예제 #5
0
    def drawgreatcircle(self,lon1,lat1,lon2,lat2,dtheta=0.02,**kwargs):
        """
 draw a great circle on the map.

 lon1,lat1 - longitude,latitude of one endpoint of the great circle.
 lon2,lat2 - longitude,latitude of the other endpoint of the great circle.
 dtheta - points on great circle computed every dtheta radians (default 0.02).

 Other keyword arguments (**kwargs) control plotting of great circle line,
 see pylab plot documentation for details.

 Note:  cannot handle situations in which the great circle intersects
 the edge of the map projection domain, and then re-enters the domain.
        """
        # get current axes instance.
        ax = pylab.gca()
        gc = GreatCircle(lon1,lat1,lon2,lat2)
        if gc.antipodal:
            raise ValueError,'cannot draw great circle whose endpoints are antipodal'
        # points have spacing of dtheta radians.
        npoints = int(gc.distance/dtheta)+1
        lons, lats = gc.points(npoints)
        x, y = self(lons, lats)
        self.plot(x,y,**kwargs)
예제 #6
0
    def drawgreatcircle(self,lon1,lat1,lon2,lat2,dtheta=0.02,**kwargs):
        """
 draw a great circle on the map.

 lon1,lat1 - longitude,latitude of one endpoint of the great circle.
 lon2,lat2 - longitude,latitude of the other endpoint of the great circle.
 dtheta - increment in radians to compute points for drawing great circle
  (default 0.02).
 Other keyword arguments control plotting of great circle line - see
 pylab plot documentation.

 Note:  cannot handle situations in which the great circle intersects
 the edge of the map projection domain, and then re-enters the domain.
        """
        # get current axes instance.
        ax = pylab.gca()
        gc = GreatCircle(lon1,lat1,lon2,lat2)
        if gc.antipodal:
            raise ValueError,'cannot draw great circle whose endpoints are antipodal'
        # points have spacing of dtheta radians.
        npoints = int(gc.distance/dtheta)+1
        lons, lats = gc.points(npoints)
        x, y = self(lons, lats)
        self.plot(x,y,**kwargs)