Ë
    xìqjz  ã            	       óæ   — d Z ddlZddlmZ ddlmZmZ ddlmZ dedefd„Z	dedefd	„Z
 G d
„ dej                  «      Z G d„ de«      Zdedeeef   fd„Zddededeeef   fd„Zdededefd„Zy)z&
Utility functions used within pyproj
é    N)Úarray)ÚEnumÚauto)ÚAnyÚvalueÚreturnc                 ó   — | | k7  xs | du S )z'
    Check if value is NaN or None
    N© ©r   s    úH/var/www/html/truck-me/venv/lib/python3.12/site-packages/pyproj/utils.pyÚis_nullr      s   € ð
 �E‰>Ò*˜U d˜]Ð*ó    c                 óf   — t        | «      j                  «       } | dv ry| dv ryt        d| › d�«      ‚)z½
    https://docs.python.org/3.9/distutils/apiref.html#distutils.util.strtobool

    Here since distutils is deprecated.

    Convert a string representation of truth to True or False.
    )ÚyÚyesÚtÚtrueÚonÚ1T)ÚnÚnoÚfÚfalseÚoffÚ0Fzinvalid truth value: 'ú')ÚstrÚlowerÚ
ValueErrorr   s    r   Ú	strtoboolr       sC   € ô �‹J×ÑÓ€EØÐ4Ñ4ØØÐ5Ñ5ØÜ
Ð-¨e¨W°AÐ6Ó
7Ð7r   c                   ó   — e Zd ZdZd„ Zy)ÚNumpyEncoderz1
    Handle numpy types when dumping to JSON
    c                 ó4  — 	 |j                  «       S # t        $ r Y nw xY w	 |j                  j                  dk(  rt	        |«      S |j                  j                  dk(  rt        |«      S n# t        $ r Y nw xY wt        j                  j                  | |«      S )Nr   Úi)	ÚtolistÚAttributeErrorÚdtypeÚkindÚfloatÚintÚjsonÚJSONEncoderÚdefault)ÚselfÚobjs     r   r-   zNumpyEncoder.default(   s�   € ð	Ø—:‘:“<ÐøÜò 	Ùð	úð	à�y‰y�~‰~ Ò$Ü˜S“zÐ!Ø�y‰y�~‰~ Ò$Ü˜3“x�ð %øäò 	Ùð	úä×Ñ×'Ñ'¨¨cÓ2Ð2s#   ‚ ’	�¢#A+ Á#A+ Á+	A7Á6A7N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r-   r
   r   r   r"   r"   #   s   „ ñó3r   r"   c                   óH   — e Zd ZdZ e«       Z e«       Z e«       Z e«       Zy)ÚDataTypezA
    Data type for copy to buffer and convertback operations
    N)	r0   r1   r2   r3   r   ÚFLOATÚLISTÚTUPLEÚARRAYr
   r   r   r5   r5   8   s%   „ ññ ‹F€EÙ‹6€DÙ‹F€EÙ‹F�Er   r5   Úxxxc                 ó‚   — 	 t        dt        | «      f«      t        j                  fS # t        $ r t        d«      d‚w xY w)a’  
    Prepares scalar for PROJ C-API:
    - Makes a copy because PROJ modifies buffer in place
    - Make sure dtype is double as that is what PROJ expects
    - Makes sure object supports Python Buffer API

    Parameters
    -----------
    xxx: float or 0-d numpy array

    Returns
    -------
    tuple[Any, DataType]
        The copy of the data prepared for the PROJ API & Python Buffer API.
    Údzinput must be a scalarN)r   r)   r5   r6   Ú	ExceptionÚ	TypeError)r:   s    r   Ú_copytobuffer_return_scalarr?   C   s@   € ð <Ü�Sœ5 ›:˜-Ó(¬(¯.©.Ð8Ð8øÜò <ÜÐ0Ó1°tÐ;ð<ús   ‚%( ¨>Úinplacec                 ój  — t        | d«      s1t        | d«      r%t        | j                  «      r| j                  «       } t        | d«      r?| j                  dk(  rt	        | «      S | j                  dd| ¬«      t        j                  fS t        j                  }t        | t        «      r!|r| j                  dk7  rt        d| «      } | |fS t        | t        «      r t        d| «      } t        j                  }| |fS t        | t        «      r t        d| «      } t        j                  }| |fS t	        | «      S )aÌ  
    Prepares data for PROJ C-API:
    - Makes a copy because PROJ modifies buffer in place
    - Make sure dtype is double as that is what PROJ expects
    - Makes sure object supports Python Buffer API

    If the data is a numpy array, it ensures the data is in C order.

    Parameters
    ----------
    xxx: Any
        A scalar, list, tuple, numpy.array,
        pandas.Series, xaray.DataArray, or dask.array.Array.
    inplace: bool, default=False
        If True, will return the array without a copy if it
        meets the requirements of the Python Buffer API & PROJ C-API.

    Returns
    -------
    tuple[Any, DataType]
        The copy of the data prepared for the PROJ API & Python Buffer API.
    ÚhardmaskÚ	__array__Úshaper
   r<   ÚC)ÚorderÚcopy)ÚhasattrÚcallablerC   rD   r?   Úastyper5   r9   Ú
isinstancer   ÚtypecodeÚlistr7   Útupler8   )r:   r@   Ú	data_types      r   Ú_copytobufferrP   Y   s  € ô8 �C˜Ô$Ü�C˜Ô%Ü�S—]‘]Ô#à�m‰m‹oˆô ˆs�GÔØ�9‰9˜Š?ô /¨sÓ3Ð3à�z‰z˜# S°7¨{ˆzÓ;¼X¿^¹^ÐKÐKÜ—‘€IÜ�#”uÔÙ˜#Ÿ,™,¨#Ò-Ü˜˜S“/ˆCð �	ˆ>Ðô 
�CœÔ	Ü�C˜‹oˆÜ—M‘Mˆ	ð �	ˆ>Ðô 
�CœÔ	Ü�C˜‹oˆÜ—N‘Nˆ	ð �	ˆ>Ðô +¨3Ó/Ð/r   rO   Úinxc                 ó¸   — | t         j                  k(  r|d   S | t         j                  k(  r|j                  «       S | t         j                  k(  rt        |«      S |S )Nr   )r5   r6   r7   r%   r8   rN   )rO   rQ   s     r   Ú_convertbackrS   ’   sJ   € à”H—N‘NÒ"Ø�1‰vˆØ”H—M‘MÒ!Ø�z‰z‹|ÐØ”H—N‘NÒ"Ü�S‹zÐØ€Jr   )F)r3   r+   r   Úenumr   r   Útypingr   Úboolr   r    r,   r"   r5   rN   r?   rP   rS   r
   r   r   ú<module>rW      s¶   ðñó Ý ß Ý ð+�3ð +˜4ó +ð8�Sð 8˜Tó 8ô 3�4×#Ñ#ô 3ô*ˆtô ð< Sð <¨U°5¸(°?Ñ-Có <ñ,6�sð 6 Tð 6°e¸CÀ¸MÑ6Jó 6ðr˜Hð ¨3ð °3ô r   