
    /i                     "    S r SSKrSSKJr  S rg)zCRS helpers.    N)CRSc                    U R                   c  [        S5      eU R                   R                  5       S:w  a  U R                  SS9OU nUR                  u  p#pEX$-   S-  nX5-   S-  n[        [        R                  " US-   S-  5      S-   5      n[        S[        US5      5      nUS	:  n	U	(       a  S
U-   OSU-   n
[        R                  " U
5      $ )a
  
Determine an appropriate WGS84 UTM CRS for the given geometry.

Uses the centroid of the geometry's bounding box in EPSG:4326 to choose
a UTM zone, returning the corresponding CRS (EPSG:326xx for the northern
hemisphere and EPSG:327xx for the southern hemisphere).
z.Geometry lacks CRS; cannot determine UTM zone.i  )epsgg       @         <   r   iX  i  )crs
ValueErrorto_epsgto_crstotal_boundsintmathfloormaxminr   	from_epsg)geometrywgs84minxminymaxxmaxy
center_lon
center_latzonenorth	epsg_codes              #/data2/heatmap/scripts/crs_utils.pydetermine_utm_crsr!   	   s     ||IJJ*2,,*>*>*@D*HHOOO&hE"//D+$J+$Jtzz:+q01A56Dq#dB- D!OE %54<I==##    )__doc__r   pyprojr   r!    r"   r    <module>r&      s      $r"   