ó
ª¬?\c           @   s%   d  d l  Z  d  d l Z d „  Z d S(   iÿÿÿÿNc         C   s¾   t  j |  d d d d ƒ t  j |  d d d d ƒ t  j |  d d d d ƒ d } d } t  j |  d | d	 | ƒ d
 } d } t  j |  d | d	 | ƒ d } d } t  j |  d | d	 | ƒ d  S(   Nt	   rd_aspectt   FLOATi   i   t	   rd_st_lent	   rd_efflens!   GetGeographicalDegrees( !SHAPE! )sV  def GetGeographicalDegrees(shape):				
                      radian = math.atan2(shape.firstpoint.x - shape.lastpoint.x ,
                                          shape.firstpoint.y - shape.lastpoint.y)
		      rad2deg= 180.0 / math.pi
                      degrees = round((radian * rad2deg + 360)%360)
                      return degrees s
   PYTHON_9.3s   CalcStLen( !SHAPE!)sß   def CalcStLen(shape):
                      len = math.sqrt(math.pow(shape.lastpoint.y - shape.firstpoint.y,2)+
                          math.pow(shape.lastpoint.x - shape.firstpoint.x,2))
                      return len s1   CalcEffectLen( !SHAPE!,!rd_st_len! ,!rd_aspect! )sÁ   def CalcEffectLen(shape,len,rd_aspect):
                      eff_len = math.fabs( len * math.sin(rd_aspect* math.pi /180 )) #convert from degree to radius
                      return eff_len (   t   arcpyt   AddField_managementt   CalculateField_management(   t   outcovert   expression1t
   codeblock1t   expression2t
   codeblock2t   expression3t
   codeblock3(    (    sL   C:\Users\jwon\Desktop\kitsap_clean\CreateStreamNetwork_PythonV\roadaspect.pyt   roadaspectfun   s    (   R   t   mathR   (    (    (    sL   C:\Users\jwon\Desktop\kitsap_clean\CreateStreamNetwork_PythonV\roadaspect.pyt   <module>   s   