
 m[c           @` sj  d  d l  m Z m Z m Z m Z d  d l Z d  d l Z d  d l Z d  d l m	 Z	 d  d l
 m Z d  d l j Z d  d l m Z d  d l m Z d  d l j Z d  d l m Z m Z m Z m Z d  d l m Z m Z m Z d	 e f d
     YZ d e f d     YZ  d e f d     YZ! d e f d     YZ" d e f d     YZ# d e f d     YZ$ d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   rcParams(   t   Axes(   t   Circle(   t   Path(   t	   Formattert   NullLocatort   FixedLocatort   NullFormatter(   t   Affine2Dt   BboxTransformTot	   Transformt   GeoAxesc           B` s  e  Z d  Z d e f d     YZ d Z d   Z d   Z d   Z d   Z	 d d	  Z
 d
   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z e Z d   Z e Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   u2   An abstract base class for geographic projections.t   ThetaFormatterc           B` s&   e  Z d  Z d d  Z d d  Z RS(   u   
        Used to format the theta tick labels.  Converts the native
        unit of radians into degrees and adds a degree symbol.
        g      ?c         C` s   | |  _  d  S(   N(   t	   _round_to(   t   selft   round_to(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   __init__   s    c         C` sW   | t  j d } t  j | |  j  |  j } t d rK t d rK d | Sd | Sd  S(   Ng     f@u   text.usetexu   text.latex.unicodeu   $%0.0f^\circ$u   %0.0f°(   t   npt   pit   roundR   R   (   R   t   xt   post   degrees(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   __call__   s
    N(   t   __name__t
   __module__t   __doc__R   t   NoneR   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR      s   iK   c         C` s2   t  j |   |  _ t  j |   |  _ |  j   d  S(   N(   t   maxist   XAxist   xaxist   YAxist   yaxist   _update_transScale(   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt
   _init_axis(   s    c         C` s   t  j |   |  j d  |  j d  |  j d  |  j j t    |  j j t    |  j j	 d  |  j j	 d  |  j j
 d t  |  j t d  t  j |  t j t j  t  j |  t j d t j d  d  S(   Ni   i   iK   u   nonet   label1Onu	   axes.gridg       @(   R   t   clat   set_longitude_gridt   set_latitude_gridt   set_longitude_grid_endsR"   t   set_minor_locatorR	   R$   t   set_ticks_positiont   set_tick_paramst   Truet   gridR   t   set_xlimR   R   t   set_ylim(   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR(   0   s    c         C` s  |  j  |  j  |  _ |  j   |  _ t |  j  |  _ |  j |  j |  j |  _ t	   j
 d |  j d  j d |  j  |  _ |  j |  j |  _ t	   j
 d d  |  j t	   j d d  |  _ t	   j
 d d  |  j t	   j d d  |  _ t	   j
 t j d d  j t j d  } t	   j
 d d  } | |  j |  _ | |  j | |  j |  j } | t	   j d d  |  _ | t	   j d d  |  _ d  S(	   Ni   i   i    i   ig?ii   (   t   _get_core_transformt
   RESOLUTIONt   transProjectiont   _get_affine_transformt   transAffineR   t   bboxt	   transAxest	   transDataR   t   scalet   _longitude_capt	   translatet   _xaxis_pretransformt   _xaxis_transformt   _xaxis_text1_transformt   _xaxis_text2_transformR   R   t   _yaxis_transformt   _yaxis_text1_transformt   _yaxis_text2_transform(   R   t   yaxis_stretcht   yaxis_spacet   yaxis_text_base(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   _set_lim_and_transformsC   s2    	,

c         C` sv   |  j  d  } | j t j d f  \ } } | j d t j d f  \ } } t   j d | d |  j d d  S(   Ni   i    i   g      ?(   R3   t   transform_pointR   R   R   R;   R=   (   R   t	   transformt   xscalet   _t   yscale(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR6   v   s    "	u   gridc         C` s"   | d k r t  d   n  |  j S(   Nu   tick1u   tick2u   gridu2   'which' must be one of 'tick1', 'tick2', or 'grid'(   u   tick1u   tick2u   grid(   t
   ValueErrorR?   (   R   t   which(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   get_xaxis_transform~   s    c         C` s   |  j  d d f S(   Nu   bottomu   center(   R@   (   R   t   pad(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   get_xaxis_text1_transform   s    c         C` s   |  j  d d f S(   Nu   topu   center(   RA   (   R   RQ   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   get_xaxis_text2_transform   s    c         C` s"   | d k r t  d   n  |  j S(   Nu   tick1u   tick2u   gridu2   'which' must be one of 'tick1', 'tick2', or 'grid'(   u   tick1u   tick2u   grid(   RN   RB   (   R   RO   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   get_yaxis_transform   s    c         C` s   |  j  d d f S(   Nu   centeru   right(   RC   (   R   RQ   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   get_yaxis_text1_transform   s    c         C` s   |  j  d d f S(   Nu   centeru   left(   RD   (   R   RQ   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   get_yaxis_text2_transform   s    c         C` s   t  d d  S(   Ng      ?(   g      ?g      ?(   R   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   _gen_axes_patch   s    c         C` s   i t  j j |  d d  d 6S(   Ng      ?u   geo(   g      ?g      ?(   t   mspinest   Spinet   circular_spine(   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   _gen_axes_spines   s    c         O` s   | d d k r t   n  d  S(   Ni    u   linear(   t   NotImplementedError(   R   t   argst   kwargs(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt
   set_yscale   s    c         O` s   t  d   d  S(   Nun   It is not possible to change axes limits for geographic projections. Please consider using Basemap or Cartopy.(   t	   TypeError(   R   R]   R^   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR1      s    c         C` sq   t  j | | g  \ } } | d k r0 d } n d } | d k rK d } n d } d t |  | t |  | f S(   u0   return a format string formatting the coordinateg        u   Nu   Su   Eu   Wu   %f°%s, %f°%s(   R   t   rad2degt   abs(   R   t   lont   latt   nst   ew(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   format_coord   s    		c         C` sU   t  j d | d |  } |  j j t t  j |    |  j j |  j |   d S(   uH   
        Set the number of degrees between each longitude grid.
        iLi   N(   R   t   arangeR"   t   set_major_locatorR
   t   deg2radt   set_major_formatterR   (   R   R   R0   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR)      s    c         C` sU   t  j d | d |  } |  j j t t  j |    |  j j |  j |   d S(   uG   
        Set the number of degrees between each latitude grid.
        iiZ   N(   R   Rh   R$   Ri   R
   Rj   Rk   R   (   R   R   R0   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR*      s    c         C` sF   t  j |  |  _ |  j j   j d |  j d  j d |  j  d S(   uS   
        Set the latitude(s) at which to stop drawing the longitude grids.
        g      ?g       @g        N(   R   Rj   R<   R>   t   clearR;   R=   (   R   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR+      s    c         C` s   d S(   u=   
        Return the aspect ratio of the data itself.
        g      ?(    (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   get_data_ratio   s    c         C` s   t  S(   u   
        Return *True* if this axes supports the zoom box button functionality.

        This axes object does not support interactive zoom box.
        (   t   False(   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   can_zoom   s    c         C` s   t  S(   u   
        Return *True* if this axes supports the pan/zoom button functionality.

        This axes object does not support interactive pan/zoom.
        (   Rn   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   can_pan   s    c         C` s   d  S(   N(    (   R   R   t   yt   button(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt	   start_pan   s    c         C` s   d  S(   N(    (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   end_pan   s    c         C` s   d  S(   N(    (   R   Rr   t   keyR   Rq   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   drag_pan   s    (    R   R   R   R   R   R4   R&   R(   RH   R6   RP   RR   RS   RT   RU   RV   RW   R[   R_   t
   set_xscaleR1   R2   Rg   R)   R*   R+   Rm   Ro   Rp   Rs   Rt   Rv   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR      s:   			3															
					t   _GeoTransformc           B` sD   e  Z d  Z d  Z e Z d   Z d   Z d   Z e	 j j
 e _
 RS(   i   c         C` s   t  j |   | |  _ d S(   u   
        Create a new geographical transform.

        Resolution is the number of steps to interpolate between each input
        line segment to approximate its path in curved space.
        N(   R   R   t   _resolution(   R   t
   resolution(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR      s    c         C` s   d j  t |   j |  j  S(   Nu   {}({})(   t   formatt   typeR   Ry   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   __str__  s    c         C` s7   | j  } | j |  j  } t |  j | j   | j  S(   N(   t   verticest   interpolatedRy   R   RJ   t   codes(   R   t   pathR~   t   ipath(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   transform_path_non_affine	  s    	(   R   R   t
   input_dimst   output_dimsRn   t   is_separableR   R}   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyRx      s   	
		t
   AitoffAxesc           B` sL   e  Z d  Z d e f d     YZ d e f d     YZ d   Z d   Z RS(   u   aitofft   AitoffTransformc           B` s>   e  Z d  Z d   Z e j j e _ d   Z e j j e _ RS(   u   The base Aitoff transform.c   	      C` s   | d  d   d f } | d  d   d f } | d } t  j |  } t  j | t  j |   } d | | d k <t  j |  | } t  j | t  } | t  j |  | | d  d   d f <t  j |  | | d  d   d f <| S(   Ni    i   g       @g#B;g        (   R   t   cost   arccost   sint
   empty_liket   float(	   R   t   llt	   longitudet   latitudet	   half_longt   cos_latitudet   alphat
   sinc_alphat   xy(    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   transform_non_affine  s    
'#c         C` s   t  j |  j  S(   N(   R   t   InvertedAitoffTransformRy   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   inverted+  s    (   R   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s
   		R   c           B` s8   e  Z d    Z e j j e _ d   Z e j j e _ RS(   c         C` s   | S(   N(    (   R   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   1  s    c         C` s   t  j |  j  S(   N(   R   R   Ry   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   6  s    (   R   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   /  s   		c         O` sJ   t  j d |  _ t j |  | |  |  j d d d d d |  j   d  S(   Ng       @g      ?t
   adjustableu   boxt   anchoru   C(   R   R   R<   R   R   t
   set_aspectR(   (   R   R]   R^   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   :  s    c         C` s   |  j  |  S(   N(   R   (   R   Rz   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR3   @  s    (   R   R   t   nameRx   R   R   R   R3   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s
   	t
   HammerAxesc           B` sL   e  Z d  Z d e f d     YZ d e f d     YZ d   Z d   Z RS(   u   hammert   HammerTransformc           B` s>   e  Z d  Z d   Z e j j e _ d   Z e j j e _ RS(   u   The base Hammer transform.c   
      C` s   | d  d   d d  f } | d  d   d d  f } | d } t  j |  } t  j d  } t  j d | t  j |   } d | | t  j |  | } | t  j |  | }	 t  j | |	 f d  S(   Ni    i   i   g       @g      ?(   R   R   t   sqrtR   t   concatenate(
   R   R   R   R   R   R   t   sqrt2R   R   Rq   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   J  s    
 c         C` s   t  j |  j  S(   N(   R   t   InvertedHammerTransformRy   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   Y  s    (   R   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   G  s
   		R   c           B` s8   e  Z d    Z e j j e _ d   Z e j j e _ RS(   c         C` s   | j  \ } } t j d | d d | d d  } d t j | | d d | d d  } t j | |  } t j | | g  S(   Ni   i   i   (   t   TR   R   t   arctant   arcsint   column_stack(   R   R   R   Rq   t   zR   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   _  s
    '+c         C` s   t  j |  j  S(   N(   R   R   Ry   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   g  s    (   R   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   ]  s   		c         O` sJ   t  j d |  _ t j |  | |  |  j d d d d d |  j   d  S(   Ng       @g      ?R   u   boxR   u   C(   R   R   R<   R   R   R   R(   (   R   R]   R^   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   k  s    c         C` s   |  j  |  S(   N(   R   (   R   Rz   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR3   q  s    (   R   R   R   Rx   R   R   R   R3   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   D  s
   	t   MollweideAxesc           B` sL   e  Z d  Z d e f d     YZ d e f d     YZ d   Z d   Z RS(   u	   mollweidet   MollweideTransformc           B` s>   e  Z d  Z d   Z e j j e _ d   Z e j j e _ RS(   u   The base Mollweide transform.c         ` s    f d   } | d  d   d f } | d  d   d f } t  j d t  j |  } | d k  } | } t  j | j d t } | j   rt  j t  j | |    d | | }	 | |	  \ }
 } x9 t  j |  r|	 | c |
 | 7<| |	  \ }
 } q W|	 d | | <n  | j   ro| | } d d	 t  j | d d } t  j d | t  j | |  | | <n  t  j | j d t } d t  j	 d  t  j | t  j
 |  | d  d   d f <t  j	 d  t  j |  | d  d   d f <| S(   Nc         ` sB   |  t  j |     d t  j |   } | t  j |  d k f S(   Ni   gMbP?(   R   R   R   Rb   (   t   thetat   delta(   t   pi_sin_l(    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   d|  s    i    i   i   gʡE?t   dtypeg       @g      ?i   g      ?gUUUUUU?(   R   R   Rb   t   emptyt   shapeR   t   anyR   t   signR   R   (   R   R   R   R   R   t   clatt   ihight   ilowt   auxR   R   t   large_deltat   eR   (    (   R   s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   {  s.    
);,c         C` s   t  j |  j  S(   N(   R   t   InvertedMollweideTransformRy   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    (   R   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   x  s
   	!	R   c           B` s8   e  Z d    Z e j j e _ d   Z e j j e _ RS(   c         C` s   | d  d   d d  f } | d  d   d d  f } t  j | t  j d   } t  j d t  j d  | t  j |  } t  j d | t  j d |  t  j  } t  j | | f d  S(   Ni    i   i   (   R   R   R   R   R   R   R   (   R   R   R   Rq   R   Rc   Rd   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    ++c         C` s   t  j |  j  S(   N(   R   R   Ry   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    (   R   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s   		c         O` sJ   t  j d |  _ t j |  | |  |  j d d d d d |  j   d  S(   Ng       @g      ?R   u   boxR   u   C(   R   R   R<   R   R   R   R(   (   R   R]   R^   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    c         C` s   |  j  |  S(   N(   R   (   R   Rz   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR3     s    (   R   R   R   Rx   R   R   R   R3   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR   u  s
   *	t   LambertAxesc           B` s^   e  Z d  Z d e f d     YZ d e f d     YZ d   Z d   Z d   Z d   Z	 RS(	   u   lambertt   LambertTransformc           B` sG   e  Z d  Z d   Z d   Z e j j e _ d   Z e j j e _ RS(   u   The base Lambert transform.c         C` s&   t  j |  |  | |  _ | |  _ d S(   u   
            Create a new Lambert transform.  Resolution is the number of steps
            to interpolate between each input line segment to approximate its
            path in curved Lambert space.
            N(   Rx   R   t   _center_longitudet   _center_latitude(   R   t   center_longitudet   center_latitudeRz   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    	c         C` s4  | d  d   d d  f } | d  d   d d  f } |  j  } |  j } t j |  } t j |  } | | } t j |  }	 d t j |  | t j |  | |	 }
 t j |
 d k d |
  }
 t j d |
  } | | t j |  } | t j |  | t j |  | |	 } t j | | f d  S(   Ni    i   i   g      ?g        gV瞯<g       @(   R   R   R   R   R   t   whereR   R   (   R   R   R   R   t   clongR   t   cos_latt   sin_latt	   diff_longt   cos_diff_longt   inner_kt   kR   Rq   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s     		
c         C` s   t  j |  j |  j |  j  S(   N(   R   t   InvertedLambertTransformR   R   Ry   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    (   R   R   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s   	
		R   c           B` sA   e  Z d    Z d   Z e j j e _ d   Z e j j e _ RS(   c         C` s&   t  j |  |  | |  _ | |  _ d  S(   N(   Rx   R   R   R   (   R   R   R   Rz   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    	c         C` sA  | d  d   d d  f } | d  d   d d  f } |  j  } |  j } t j | | | |  } t j | d k d |  } d t j d |  } t j |  } t j |  }	 t j |	 t j |  | | t j |  |  }
 | t j | | | t j |  |	 | t j |  |  } t j	 | |
 f d  S(   Ni    i   i   g        g&.>g       @g      ?(
   R   R   R   R   R   R   R   R   R   R   (   R   R   R   Rq   R   R   t   pt   ct   sin_ct   cos_cRd   Rc   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    			8c         C` s   t  j |  j |  j |  j  S(   N(   R   R   R   R   Ry   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    (   R   R   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s
   			c         O` st   t  j d |  _ | j d d  |  _ | j d d  |  _ t j |  | |  |  j d d d d d	 |  j	   d  S(
   Ng       @u   center_longitudeg        u   center_latitudeu   equalR   u   boxR   u   C(
   R   R   R<   t   popR   R   R   R   R   R(   (   R   R]   R^   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s    c         C` s$   t  j |   |  j j t    d  S(   N(   R   R(   R$   Rk   R   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR(     s    c         C` s   |  j  |  j |  j |  S(   N(   R   R   R   (   R   Rz   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR3     s    c         C` s   t    j d  j d d  S(   Ng      ?g      ?(   R   R;   R=   (   R   (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR6      s    		(
   R   R   R   Rx   R   R   R   R(   R3   R6   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyR     s   +!			(%   t
   __future__R    R   R   R   t   sixt   numpyR   t
   matplotlibR   t   matplotlib.axesR   t   matplotlib.axist   axisR    t   matplotlib.patchesR   t   matplotlib.pathR   t   matplotlib.spinest   spinesRX   t   matplotlib.tickerR   R	   R
   R   t   matplotlib.transformsR   R   R   R   Rx   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/matplotlib/projections/geo.pyt   <module>   s"   ""31J