o
    Dfc                     @   s  d Z ddlZddlZddlZddlZddlmZmZmZm	Z	 ddl
mZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZ ddlmZ ddl m!Z!m"Z"m#Z# ddl$m%Z%m&Z& dd	l'm(Z( dd
l)m*Z* e+dej,Z-G dd dej.Z/d3de0de1de2fddZ3de2de2fddZ4de2de2fddZ5de2de	e2e6f fddZ7de	e2e6f fddZ8dede1fdd Z9G d!d" d"Z:G d#d$ d$e:Z;G d%d& d&e;Z<G d'd( d(e;Z=G d)d* d*e;Z>G d+d, d,e;Z?G d-d. d.e;Z@G d/d0 d0e;ZAG d1d2 d2e;ZBdS )4zx
This module interfaces with PROJ to produce a pythonic interface
to the coordinate reference system (CRS) information.
    N)AnyCallableOptionalUnion)_CRS	AreaOfUseAuthorityMatchInfoAxisCoordinateOperationCoordinateSystemDatum	EllipsoidPrimeMeridian_load_proj_jsonis_projis_wkt)!_GEOGRAPHIC_GRID_MAPPING_NAME_MAP_GRID_MAPPING_NAME_MAP)_INVERSE_GEOGRAPHIC_GRID_MAPPING_NAME_MAP_INVERSE_GRID_MAPPING_NAME_MAP_horizontal_datum_from_params_try_list_if_string)ToWGS84Transformation)Cartesian2DCSEllipsoidal2DCS
VerticalCS)ProjVersion
WktVersion)CRSError)Geoda9  
    \+              # parameter starts with '+' character
    (?P<param>\w+)    # capture parameter name
    \=?             # match both key only and key-value parameters
    (?P<value>\S+)? # capture all characters up to next space (None if no value)
    \s*?            # consume remaining whitespace, if any
c                       s    e Zd ZdZ fddZ  ZS )CRSLocalz
    Threading local instance for cython CRS class.

    For more details, see:
    https://github.com/pyproj4/pyproj/issues/782
    c                    s   d | _ t   d S N)crssuper__init__self	__class__ G/home/ubuntu/webapp/venv/lib/python3.10/site-packages/pyproj/crs/crs.pyr$   <   s   zCRSLocal.__init__)__name__
__module____qualname____doc__r$   __classcell__r)   r)   r'   r*   r    4   s    r    T
projparams
allow_jsonreturnc                 C   s   t | ts	tdd| vrd| vr|rt| S g }|  D ]:\}}t |ttfr3ddd |D }|d u s=t	|dkrF|
d|  qt	|d	krMq|
d| d
|  qtd|S )NzCRS input is not a dictprojinit,c                 S      g | ]}t |qS r)   )str).0valr)   r)   r*   
<listcomp>L       z&_prepare_from_dict.<locals>.<listcomp>True+False= )
isinstancedictr   jsondumpsitemslisttuplejoinr7   append_prepare_from_string)r0   r1   pjargskeyvaluer)   r)   r*   _prepare_from_dictA   s   

rN   in_crs_stringc                 C   s   t dd|  } d}| |s5g }d}|  D ]}|s*||r*|d| d}q|| qd|} d| vrFd	| v rB| d
7 } n| d7 } | dd	 } | dr[t
jdtdd | S )Nz[\s+]?=[\s+]?r?   )+initz+projr4   r3   Fr   Tr@   ztype=crsr=   z
 +type=crsz	 type=crsz
+init=EPSGz
+init=epsg)rP   r4   z'+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6   )
stacklevel)resublstrip
startswithsplitinsertrI   rH   replacestripwarningswarnFutureWarning)rO   starting_paramskvpairsfirst_item_insertedkvpairr)   r)   r*   _prepare_from_proj_stringW   s.   



	rb   c              
   C   s   t | ts	td| std| d| v r=z	tj| dd}W n ty0 } ztd|d }~ww |s7tdt|} | S t| rEt| } | S )NzCRS input is not a stringz CRS string is empty or invalid: {F)strictz'CRS appears to be JSON but is not validzCRS is empty JSON)	rA   r7   r   rC   loads
ValueErrorrN   r   rb   )rO   crs_dicterrr)   r)   r*   rJ   }   s$   

rJ   	auth_name	auth_codec                 C   s   |  d| S )N:r)   )ri   rj   r)   r)   r*   _prepare_from_authority   s   rl   c                 C   s
   t d| S )NEPSG)rl   rj   r)   r)   r*   _prepare_from_epsg      
ro   c                 C   s@   t | trdS t | tr|  rdS t| dr| jdkrdS dS )NTshaper)   F)rA   intr7   	isnumerichasattrrq   rn   r)   r)   r*   _is_epsg_code   s   
ru   c                   @   s  e Zd ZdZddee ddfddZedd Ze	d	e
d
ee
ef dd fddZe	d
ee
ef dd fddZe	de
dd fddZe	de
dd fddZe	de
dd fddZde
fddZe	dedd fddZdee fddZe	dedd fd d!Ze	d"e
dd fd#d$Ze	d%edd fd&d'Zdefd(d)Zejd*fd+eee
f d,edefd-d.Ze			dd/ed0ee d1ee d2ee dd f
d3d4Z de!e fd5d6Z"d7edefd8d9Z#dd7ed:edefd;d<Z$eded  fd=d>Z%eded  fd?d@Z&eded  fdAdBZ'ede!d  fdCdDZ(edee
 fdEdFZ)ede
fdGdHZ*ede
fdIdJZ+ede!e, fdKdLZ-edee. fdMdNZ/edee0 fdOdPZ1edee2 fdQdRZ3edee4 fdSdTZ5edee6 fdUdVZ7edee8 fdWdXZ9ede
fdYdZZ:ede
fd[d\Z;ejd*dfd]eee
f d^ed_ee de
fd`daZ<dd^edcede
fdddeZ=defdfdgZ>e?j@fd]ee?ef de
fdhdiZAddkedee fdldmZBdd	ee
 dkefdndoZC	jdd	ee
 dkede!eD fdpdqZEddree
 dd fdsdtZFddree
 dd fdudvZGedefdwdxZHedefdydzZIedefd{d|ZJedefd}d~ZKedefddZLedefddZMedefddZNedd ZOd7edefddZPdee
e
f fddZQdee
ef fddZRdefddZSde
fddZTde
fddZUdS )CRSaK  
    A pythonic Coordinate Reference System manager.

    .. versionadded:: 2.0.0

    See: :c:func:`proj_create`

    The functionality is based on other fantastic projects:

    * `rasterio <https://github.com/mapbox/rasterio/blob/c13f0943b95c0eaa36ff3f620bd91107aa67b381/rasterio/_crs.pyx>`_  # noqa: E501
    * `opendatacube <https://github.com/opendatacube/datacube-core/blob/83bae20d2a2469a6417097168fd4ede37fd2abe5/datacube/utils/geometry/_base.py>`_  # noqa: E501

    Attributes
    ----------
    srs: str
        The string form of the user input used to create the CRS.

    Nr0   r2   c                 K   s   d}|rMt |tr|j}n@t|rt|}n7t |tr t|}n-t |tr*t|}n#t |t	t
fr<t|dkr<t| }nt|drF| }ntd||r^t|dd}td||f}|| _t | _t |trp|| j_dS t| j| j_dS )	u  
        Initialize a CRS class instance with:
          - PROJ string
          - Dictionary of PROJ parameters
          - PROJ keyword arguments for parameters
          - JSON string with PROJ parameters
          - CRS WKT string
          - An authority string [i.e. 'epsg:4326']
          - An EPSG integer code [i.e. 4326]
          - A tuple of ("auth_name": "auth_code") [i.e ('epsg', '4326')]
          - An object with a `to_wkt` method.
          - A :class:`pyproj.crs.CRS` class

        Example usage:

        >>> from pyproj import CRS
        >>> crs_utm = CRS.from_user_input(26915)
        >>> crs_utm
        <Projected CRS: EPSG:26915>
        Name: NAD83 / UTM zone 15N
        Axis Info [cartesian]:
        - E[east]: Easting (metre)
        - N[north]: Northing (metre)
        Area of Use:
        - name: North America - 96°W to 90°W and NAD83 by country
        - bounds: (-96.0, 25.61, -90.0, 84.0)
        Coordinate Operation:
        - name: UTM zone 15N
        - method: Transverse Mercator
        Datum: North American Datum 1983
        - Ellipsoid: GRS 1980
        - Prime Meridian: Greenwich
        <BLANKLINE>
        >>> crs_utm.area_of_use.bounds
        (-96.0, 25.61, -90.0, 84.0)
        >>> crs_utm.ellipsoid
        ELLIPSOID["GRS 1980",6378137,298.257222101,
            LENGTHUNIT["metre",1],
            ID["EPSG",7019]]
        >>> crs_utm.ellipsoid.inverse_flattening
        298.257222101
        >>> crs_utm.ellipsoid.semi_major_metre
        6378137.0
        >>> crs_utm.ellipsoid.semi_minor_metre
        6356752.314140356
        >>> crs_utm.prime_meridian
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8901]]
        >>> crs_utm.prime_meridian.unit_name
        'degree'
        >>> crs_utm.prime_meridian.unit_conversion_factor
        0.017453292519943295
        >>> crs_utm.prime_meridian.longitude
        0.0
        >>> crs_utm.datum
        DATUM["North American Datum 1983",
            ELLIPSOID["GRS 1980",6378137,298.257222101,
                LENGTHUNIT["metre",1]],
            ID["EPSG",6269]]
        >>> crs_utm.coordinate_system
        CS[Cartesian,2],
            AXIS["(E)",east,
                ORDER[1],
                LENGTHUNIT["metre",1,
                    ID["EPSG",9001]]],
            AXIS["(N)",north,
                ORDER[2],
                LENGTHUNIT["metre",1,
                    ID["EPSG",9001]]]
        >>> print(crs_utm.coordinate_operation.to_wkt(pretty=True))
        CONVERSION["UTM zone 15N",
            METHOD["Transverse Mercator",
                ID["EPSG",9807]],
            PARAMETER["Latitude of natural origin",0,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8801]],
            PARAMETER["Longitude of natural origin",-93,
                ANGLEUNIT["degree",0.0174532925199433],
                ID["EPSG",8802]],
            PARAMETER["Scale factor at natural origin",0.9996,
                SCALEUNIT["unity",1],
                ID["EPSG",8805]],
            PARAMETER["False easting",500000,
                LENGTHUNIT["metre",1],
                ID["EPSG",8806]],
            PARAMETER["False northing",0,
                LENGTHUNIT["metre",1],
                ID["EPSG",8807]],
            ID["EPSG",16015]]
        >>> crs = CRS(proj='utm', zone=10, ellps='WGS84')
        >>> print(crs.to_wkt(pretty=True))
        PROJCRS["unknown",
            BASEGEOGCRS["unknown",
                DATUM["Unknown based on WGS84 ellipsoid",
                    ELLIPSOID["WGS 84",6378137,298.257223563,
                        LENGTHUNIT["metre",1],
                        ID["EPSG",7030]]],
                PRIMEM["Greenwich",0,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8901]]],
            CONVERSION["UTM zone 10N",
                METHOD["Transverse Mercator",
                    ID["EPSG",9807]],
                PARAMETER["Latitude of natural origin",0,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8801]],
                PARAMETER["Longitude of natural origin",-123,
                    ANGLEUNIT["degree",0.0174532925199433],
                    ID["EPSG",8802]],
                PARAMETER["Scale factor at natural origin",0.9996,
                    SCALEUNIT["unity",1],
                    ID["EPSG",8805]],
                PARAMETER["False easting",500000,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8806]],
                PARAMETER["False northing",0,
                    LENGTHUNIT["metre",1],
                    ID["EPSG",8807]],
                ID["EPSG",16010]],
            CS[Cartesian,2],
                AXIS["(E)",east,
                    ORDER[1],
                    LENGTHUNIT["metre",1,
                        ID["EPSG",9001]]],
                AXIS["(N)",north,
                    ORDER[2],
                    LENGTHUNIT["metre",1,
                        ID["EPSG",9001]]]]
        >>> geod = crs.get_geod()
        >>> f"+a={geod.a:.0f} +f={geod.f:.8f}"
        '+a=6378137 +f=0.00335281'
        >>> crs.is_projected
        True
        >>> crs.is_geographic
        False
         rQ   to_wktzInvalid CRS input: F)r1   r@   N)rA   r   srsru   ro   r7   rJ   rB   rN   rF   rG   lenrl   rt   rx   r   rH   r    _localr"   )r&   r0   kwargs
projstring
projkwargsr)   r)   r*   r$      s0    









zCRS.__init__c                 C   s"   | j jdu rt| j| j _| j jS )zH
        Retrieve the Cython based _CRS object for this thread.
        N)r{   r"   r   ry   r%   r)   r)   r*   _crs^  s   zCRS._crsri   codec                 C   s   |  t||S )a?  
        .. versionadded:: 2.2.0

        Make a CRS from an authority name and authority code

        Parameters
        ----------
        auth_name: str
            The name of the authority.
        code : int or str
            The code used by the authority.

        Returns
        -------
        CRS
        )from_user_inputrl   )clsri   r   r)   r)   r*   from_authorityg  s   zCRS.from_authorityc                 C      |  t|S )zMake a CRS from an EPSG code

        Parameters
        ----------
        code : int or str
            An EPSG code.

        Returns
        -------
        CRS
        )r   ro   )r   r   r)   r)   r*   	from_epsg{  s   zCRS.from_epsgin_proj_stringc                 C   $   t |std| | t|S )z
        .. versionadded:: 2.2.0

        Make a CRS from a PROJ string

        Parameters
        ----------
        in_proj_string : str
            A PROJ string.

        Returns
        -------
        CRS
        zInvalid PROJ string: )r   r   r   rb   )r   r   r)   r)   r*   
from_proj4     zCRS.from_proj4in_wkt_stringc                 C   r   )z
        .. versionadded:: 2.2.0

        Make a CRS from a WKT string

        Parameters
        ----------
        in_wkt_string : str
            A WKT string.

        Returns
        -------
        CRS
        zInvalid WKT string: )r   r   r   rJ   )r   r   r)   r)   r*   from_wkt  r   zCRS.from_wktrO   c                 C   r   )az  
        Make a CRS from:

        Initialize a CRS class instance with:
         - PROJ string
         - JSON string with PROJ parameters
         - CRS WKT string
         - An authority string [i.e. 'epsg:4326']

        Parameters
        ----------
        in_crs_string : str
            An EPSG, PROJ, or WKT string.

        Returns
        -------
        CRS
        )r   rJ   )r   rO   r)   r)   r*   from_string  s   zCRS.from_stringc                 C   s    | j dd}|rd|S | jS )a  
        .. versionadded:: 2.2.0

        Convert the CRS to a string.

        It attempts to convert it to the authority string.
        Otherwise, it uses the string format of the user
        input to create the CRS.

        Returns
        -------
        str
        d   min_confidencerk   )to_authorityrH   ry   )r&   	auth_infor)   r)   r*   	to_string  s   
zCRS.to_stringrM   c                 K   s   t || r|S | |fi |S a  
        Initialize a CRS class instance with:
          - PROJ string
          - Dictionary of PROJ parameters
          - PROJ keyword arguments for parameters
          - JSON string with PROJ parameters
          - CRS WKT string
          - An authority string [i.e. 'epsg:4326']
          - An EPSG integer code [i.e. 4326]
          - A tuple of ("auth_name": "auth_code") [i.e ('epsg', '4326')]
          - An object with a `to_wkt` method.
          - A :class:`pyproj.crs.CRS` class

        Parameters
        ----------
        value : obj
            A Python int, dict, or str.

        Returns
        -------
        CRS
        )rA   )r   rM   r|   r)   r)   r*   r     s   
zCRS.from_user_inputc                 C   s(   | j du rdS t| j j| j j| j jdS )zs
        Returns
        -------
        pyproj.geod.Geod:
            Geod object based on the ellipsoid.
        N)arfb)	ellipsoidr   semi_major_metreinverse_flatteningsemi_minor_metrer%   r)   r)   r*   get_geod  s   
zCRS.get_geod	proj_dictc                 C   r   )z
        .. versionadded:: 2.2.0

        Make a CRS from a dictionary of PROJ parameters.

        Parameters
        ----------
        proj_dict : str
            PROJ params in dict format.

        Returns
        -------
        CRS
        )r   rN   )r   r   r)   r)   r*   	from_dict     zCRS.from_dictcrs_jsonc                 C   r   )z
        .. versionadded:: 2.4.0

        Create CRS from a CRS JSON string.

        Parameters
        ----------
        crs_json: str
            CRS JSON string.

        Returns
        -------
        CRS
        )r   r   )r   r   r)   r)   r*   	from_json  r   zCRS.from_jsonrg   c                 C   s   |  t|S )z
        .. versionadded:: 2.4.0

        Create CRS from a JSON dictionary.

        Parameters
        ----------
        crs_dict: dict
            CRS dictionary.

        Returns
        -------
        CRS
        )r   rC   rD   )r   rg   r)   r)   r*   from_json_dict*  s   zCRS.from_json_dictc                 C   s`   |   }|du r
i S dd }i }t|D ]}| \}}|dur%||}|dur-|||< q|S )a  
        .. versionadded:: 2.2.0

        Converts the CRS to dictionary of PROJ parameters.

        .. warning:: You will likely lose important projection
          information when converting to a PROJ string from
          another format. See: https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems  # noqa: E501

        Returns
        -------
        dict:
            PROJ params in dict format.

        Nc                 S   sb   |   dkrdS |   dkrdS zt| W S  ty   Y nw zt| W S  ty0   Y t| S w )NtrueTfalseF)lowerrr   rf   floatr   )r9   r)   r)   r*   _parseQ  s   

zCRS.to_dict.<locals>._parseF)to_proj4_RE_PROJ_PARAMfinditergroups)r&   proj_stringr   r   paramrL   rM   r)   r)   r*   to_dict<  s   zCRS.to_dictFwkt_versionerrcheckc           	      C   s@  d|  |i}| jr.| jr.| jjr.| jr.| jj||d}|d || | jj|d< |S | jrJ| j	D ]}|j||d}|d || q4|S | j
rh|  }d|v r]|d d |d< | jrf| jj|d< |S | jr|j| jj| jj| jjd | jj|d	< | jr| jj|d
< | jj|d< | jr| jj|d< | jjr| jjj|d< | jr| jr| jj tvr|rtd| jj  d|d iS |t| jj  | j |S d|d< |S d}| js| jr| j}| j|d< |sdn|j dd}|tvr|r|r
td|j  ntd d|d iS |t| | |S )aS  
        .. versionadded:: 2.2.0

        This converts a :obj:`pyproj.crs.CRS` object
        to a Climate and Forecast (CF) Grid Mapping Version 1.8 dict.

        :ref:`build_crs_cf`

        Parameters
        ----------
        wkt_version: str or pyproj.enums.WktVersion
            Version of WKT supported by CRS.to_wkt.
            Default is :attr:`pyproj.enums.WktVersion.WKT2_2019`.
        errcheck: bool, default=False
            If True, will warn when parameters are ignored.

        Returns
        -------
        dict:
            CF-1.8 version of the projection.

        crs_wkt)r   r   towgs84geoid_modelname
geoid_namegeopotential_datum_name)semi_major_axissemi_minor_axisr   reference_ellipsoid_namelongitude_of_prime_meridianprime_meridian_namegeographic_crs_namehorizontal_datum_namez"Unsupported coordinate operation: latitude_longitudegrid_mapping_nameNprojected_crs_namer@   _zCoordinate operation not found.)rx   is_boundcoordinate_operationr   
source_crsto_cfpopupdateis_compoundsub_crs_listis_verticalto_json_dictdatumr   r   r   r   r   prime_meridian	longitudegeodetic_crsis_geographicmethod_namer   r   r[   r\   is_projectedrY   r   )	r&   r   r   cf_dictsub_cfsub_crs	vert_jsonr   coordinate_operation_namer)   r)   r*   r   j  s   








z	CRS.to_cfin_cfellipsoidal_cscartesian_csvertical_csc                 C   s  d}d| v rt | d S d| v rt | d S | d}|du r#tdt| }zt| }W n ty8   d}Y nw | d}|rJt|pDd||d	}	n%|rj||vrjt |}	|duri|	 }
t	| |
d
< t |
}	nt|d}	|dkru|	S |durt
|	|| |dS zt| }W n ty   td| dw t| dd|| |	|d}d}d| v rt|dt|jgt| d R  d}d| vr|p|S td| d | d|d}td|p||gdS )a  
        .. versionadded:: 2.2.0

        .. versionadded:: 3.0.0 ellipsoidal_cs, cartesian_cs, vertical_cs

        This converts a Climate and Forecast (CF) Grid Mapping Version 1.8
        dict to a :obj:`pyproj.crs.CRS` object.

        :ref:`build_crs_cf`

        Parameters
        ----------
        in_cf: dict
            CF version of the projection.
        ellipsoidal_cs: Any, optional
            Input to create an Ellipsoidal Coordinate System.
            Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or an Ellipsoidal Coordinate System created from :ref:`coordinate_system`.
        cartesian_cs: Any, optional
            Input to create a Cartesian Coordinate System.
            Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or :class:`pyproj.crs.coordinate_system.Cartesian2DCS`.
        vertical_cs: Any, optional
            Input to create a Vertical Coordinate System accepted by
            :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or :class:`pyproj.crs.coordinate_system.VerticalCS`

        Returns
        -------
        CRS
        )unknown	undefinedr   spatial_refr   Nz4CF projection parameters missing 'grid_mapping_name'r   r   )r   r   r   coordinate_system)r   r   )base_crs
conversionr   zUnsupported grid mapping name: r   )r   r   r   r   r   zWGS 84)r   
target_crstransformationr   r   )r   r   r   r   )r   
components)rv   getr   r   r   KeyErrorGeographicCRSr   r   r   DerivedGeographicCRSr   ProjectedCRSBoundCRSr   r   r   VerticalCRSCompoundCRS)r   r   r   r   unknown_namesr   r   geographic_conversion_methodr   geographic_crsgeographic_crs_jsonconversion_methodprojected_crs	bound_crsvertical_crsr)   r)   r*   from_cf  s   (




zCRS.from_cfc           	      C   s(  g }dd }| j dkrZ| jrZ| j }|dd d}t|dkr)| d}| jd	 }d
d
|dd 	dddd}|j
 	dd }|rU| d| |d< || | jrk|| jj|| d |S | jr| jr| jjr|| jjj|| jd |S | jD ]	}||  q|S )a1  
        .. versionadded:: 3.0.0

        This converts all coordinate systems (cs) in the CRS
        to a list of Climate and Forecast (CF) Version 1.8 dicts.

        :ref:`build_crs_cf`

        Returns
        -------
        list[dict]:
            CF-1.8 version of the coordinate systems.
        c                 S   s.   z| j o| j j tv W S  ty   Y dS w )NF)r   r   r   r   r   )r"   r)   r)   r*   rotated_pole|  s   
z"CRS.cs_to_cf.<locals>.rotated_polezTemporal CRStime_originz
1875-05-20zZ   z-01-01r   timecalendarproleptic_gregorianr@   r   T)standard_name	long_namer   axisrw   z since units)r   )	type_namer   r   r   rZ   rstriprz   	axis_infor   rY   	unit_namerI   r   extendr   r   r   r   cs_to_cf)	r&   cf_axis_listr   
datum_jsonoriginr   cf_temporal_axisr  r   r)   r)   r*   r  l  sD   







zCRS.cs_to_cfotherc                 C   s2   zt |}W n
 ty   Y dS w | j|jS )ab  
        Check if the CRS objects are the exact same.

        Parameters
        ----------
        other: Any
            Check if the other CRS is the exact same to this object.
            If the other object is not a CRS, it will try to create one.
            On Failure, it will return False.

        Returns
        -------
        bool
        F)rv   r   r   r   is_exact_samer&   r  r)   r)   r*   r    s   zCRS.is_exact_sameignore_axis_orderc                 C   s6   zt |}W n
 ty   Y dS w | jj|j|dS )a  

        .. versionadded:: 2.5.0

        Check if the CRS objects are equivalent.

        Parameters
        ----------
        other: Any
            Check if the other object is equivalent to this object.
            If the other object is not a CRS, it will try to create one.
            On Failure, it will return False.
        ignore_axis_order: bool, default=False
            If True, it will compare the CRS class and ignore the axis order.

        Returns
        -------
        bool
        F)r  )rv   r   r   r   equals)r&   r  r  r)   r)   r*   r    s   z
CRS.equalsc                 C      | j jdu rdS | | j jS z
        .. versionadded:: 2.2.0

        Returns
        -------
        CRS:
            The geodeticCRS / geographicCRS from the CRS.

        N)r   r   r(   r%   r)   r)   r*   r     
   zCRS.geodetic_crsc                 C   r  z
        The base CRS of a BoundCRS or a DerivedCRS/ProjectedCRS,
        or the source CRS of a CoordinateOperation.

        Returns
        -------
        CRS
        N)r   r   r(   r%   r)   r)   r*   r     s
   zCRS.source_crsc                 C   r  z
        .. versionadded:: 2.2.0

        Returns
        -------
        CRS:
            The hub CRS of a BoundCRS or the target CRS of a CoordinateOperation.

        N)r   r   r(   r%   r)   r)   r*   r     r  zCRS.target_crsc                    s    fdd j jD S )
        If the CRS is a compound CRS, it will return a list of sub CRS objects.

        Returns
        -------
        list[CRS]
        c                    s   g | ]}  |qS r)   r'   r8   r   r%   r)   r*   r:     s    z$CRS.sub_crs_list.<locals>.<listcomp>r   r   r%   r)   r%   r*   r     s   	zCRS.sub_crs_listc                 C   sj   | j r
| jr
| jjS | jr| jD ]
}|jr|j  S qdS | jr3d| jj v r3| jj dd S dS )z
        .. versionadded:: 2.6.0

        Finds the UTM zone in a Projected CRS, Bound CRS, or Compound CRS

        Returns
        -------
        Optional[str]:
            The UTM zone number and letter if applicable.
        zUTM ZONEz	UTM ZONE N)r   r   utm_zoner   r   r   upperrW   )r&   r   r)   r)   r*   r    s   

zCRS.utm_zonec                 C      | j jS )zx
        Returns
        -------
        str:
            The name of the CRS (from :cpp:func:`proj_get_name`).
        )r   r   r%   r)   r)   r*   r   /     zCRS.namec                 C   r  )zj
        Returns
        -------
        str:
            The name of the type of the CRS object.
        )r   r  r%   r)   r)   r*   r  9  r  zCRS.type_namec                 C   r  )a;  
        Retrieves all relevant axis information in the CRS.
        If it is a Bound CRS, it gets the axis list from the Source CRS.
        If it is a Compound CRS, it gets the axis list from the Sub CRS list.

        Returns
        -------
        list[Axis]:
            The list of axis information.
        )r   r  r%   r)   r)   r*   r  C  s   zCRS.axis_infoc                 C   r  )z{
        Returns
        -------
        AreaOfUse:
            The area of use object with associated attributes.
        )r   area_of_user%   r)   r)   r*   r  Q  r  zCRS.area_of_usec                 C   r  )z
        .. versionadded:: 2.2.0

        Returns
        -------
        Ellipsoid:
            The ellipsoid object with associated attributes.
        )r   r   r%   r)   r)   r*   r   [     
zCRS.ellipsoidc                 C   r  )z
        .. versionadded:: 2.2.0

        Returns
        -------
        PrimeMeridian:
            The prime meridian object with associated attributes.
        )r   r   r%   r)   r)   r*   r   g  r  zCRS.prime_meridianc                 C   r  )zX
        .. versionadded:: 2.2.0

        Returns
        -------
        Datum
        )r   r   r%   r)   r)   r*   r   s     	z	CRS.datumc                 C   r  )zc
        .. versionadded:: 2.2.0

        Returns
        -------
        CoordinateSystem
        )r   r   r%   r)   r)   r*   r   ~  r  zCRS.coordinate_systemc                 C   r  )zf
        .. versionadded:: 2.2.0

        Returns
        -------
        CoordinateOperation
        )r   r   r%   r)   r)   r*   r     r  zCRS.coordinate_operationc                 C   r  )zy
        .. versionadded:: 2.4.0

        Returns
        -------
        str:
            Remarks about object.
        )r   remarksr%   r)   r)   r*   r     r  zCRS.remarksc                 C   r  )zt
        .. versionadded:: 2.4.0

        Returns
        -------
        str:
            Scope of object.
        )r   scoper%   r)   r)   r*   r!    r  z	CRS.scopeversionprettyoutput_axis_rulec                 C   s.   | j j|||d}|du rtd| d|S )aA  
        Convert the projection to a WKT string.

        Version options:
          - WKT2_2015
          - WKT2_2015_SIMPLIFIED
          - WKT2_2019
          - WKT2_2019_SIMPLIFIED
          - WKT1_GDAL
          - WKT1_ESRI

        .. versionadded:: 3.6.0 output_axis_rule

        Parameters
        ----------
        version: pyproj.enums.WktVersion, optional
            The version of the WKT output.
            Default is :attr:`pyproj.enums.WktVersion.WKT2_2019`.
        pretty: bool, default=False
            If True, it will set the output to be a multiline string.
        output_axis_rule: bool, optional, default=None
            If True, it will set the axis rule on any case. If false, never.
            None for AUTO, that depends on the CRS and version.

        Returns
        -------
        str
        )r"  r#  r$  Nz.CRS cannot be converted to a WKT string of a 'zG' version. Select a different version of a WKT string or edit your CRS.)r   rx   r   )r&   r"  r#  r$  wktr)   r)   r*   rx     s   "
z
CRS.to_wktrQ   indentationc                 C   s$   | j j||d}|du rtd|S )a  
        .. versionadded:: 2.4.0

        Convert the object to a JSON string.

        Parameters
        ----------
        pretty: bool, default=False
            If True, it will set the output to be a multiline string.
        indentation: int, default=2
            If pretty is True, it will set the width of the indentation.

        Returns
        -------
        str
        )r#  r&  Nz.CRS cannot be converted to a PROJ JSON string.)r   to_jsonr   )r&   r#  r&  	proj_jsonr)   r)   r*   r'    s   zCRS.to_jsonc                 C   s
   | j  S )z
        .. versionadded:: 2.4.0

        Convert the object to a JSON dictionary.

        Returns
        -------
        dict
        )r   r   r%   r)   r)   r*   r     s   

zCRS.to_json_dictc                 C   s"   | j j|d}|du rtd|S )a<  
        Convert the projection to a PROJ string.

        .. warning:: You will likely lose important projection
          information when converting to a PROJ string from
          another format. See:
          https://proj.org/faq.html#what-is-the-best-format-for-describing-coordinate-reference-systems  # noqa: E501

        Parameters
        ----------
        version: pyproj.enums.ProjVersion
            The version of the PROJ string output.
            Default is :attr:`pyproj.enums.ProjVersion.PROJ_4`.

        Returns
        -------
        str
        )r"  Nz)CRS cannot be converted to a PROJ string.)r   r   r   )r&   r"  r3   r)   r)   r*   r     s   zCRS.to_proj4F   r   c                 C   s   | j j|dS )ac  
        Return the EPSG code best matching the CRS
        or None if it a match is not found.

        Example:

        >>> from pyproj import CRS
        >>> ccs = CRS("EPSG:4328")
        >>> ccs.to_epsg()
        4328

        If the CRS is bound, you can attempt to get an epsg code from
        the source CRS:

        >>> from pyproj import CRS
        >>> ccs = CRS("+proj=geocent +datum=WGS84 +towgs84=0,0,0")
        >>> ccs.to_epsg()
        >>> ccs.source_crs.to_epsg()
        4978
        >>> ccs == CRS.from_epsg(4978)
        False

        Parameters
        ----------
        min_confidence: int, default=70
            A value between 0-100 where 100 is the most confident.
            :ref:`min_confidence`


        Returns
        -------
        Optional[int]:
            The best matching EPSG code matching the confidence level.
        r   )r   to_epsg)r&   r   r)   r)   r*   r*    s   #zCRS.to_epsgc                 C      | j j||dS )a!  
        .. versionadded:: 2.2.0

        Return the authority name and code best matching the CRS
        or None if it a match is not found.

        Example:

        >>> from pyproj import CRS
        >>> ccs = CRS("EPSG:4328")
        >>> ccs.to_authority()
        ('EPSG', '4328')

        If the CRS is bound, you can get an authority from
        the source CRS:

        >>> from pyproj import CRS
        >>> ccs = CRS("+proj=geocent +datum=WGS84 +towgs84=0,0,0")
        >>> ccs.to_authority()
        >>> ccs.source_crs.to_authority()
        ('EPSG', '4978')
        >>> ccs == CRS.from_authorty('EPSG', '4978')
        False

        Parameters
        ----------
        auth_name: str, optional
            The name of the authority to filter by.
        min_confidence: int, default=70
            A value between 0-100 where 100 is the most confident.
            :ref:`min_confidence`

        Returns
        -------
        tuple(str, str) or None:
            The best matching (<auth_name>, <code>) for the confidence level.
        ri   r   )r   r   r&   ri   r   r)   r)   r*   r   7  s   &zCRS.to_authorityc                 C   r+  )aT  
        .. versionadded:: 3.2.0

        Return the authority names and codes best matching the CRS.

        Example:

        >>> from pyproj import CRS
        >>> ccs = CRS("EPSG:4328")
        >>> ccs.list_authority()
        [AuthorityMatchInfo(auth_name='EPSG', code='4326', confidence=100)]

        If the CRS is bound, you can get an authority from
        the source CRS:

        >>> from pyproj import CRS
        >>> ccs = CRS("+proj=geocent +datum=WGS84 +towgs84=0,0,0")
        >>> ccs.list_authority()
        []
        >>> ccs.source_crs.list_authority()
        [AuthorityMatchInfo(auth_name='EPSG', code='4978', confidence=70)]
        >>> ccs == CRS.from_authorty('EPSG', '4978')
        False

        Parameters
        ----------
        auth_name: str, optional
            The name of the authority to filter by.
        min_confidence: int, default=70
            A value between 0-100 where 100 is the most confident.
            :ref:`min_confidence`

        Returns
        -------
        list[AuthorityMatchInfo]:
            List of authority matches for the CRS.
        r,  )r   list_authorityr-  r)   r)   r*   r.  a  s   (zCRS.list_authorityr   c                 C      |  | jj|dS a  
        .. versionadded:: 3.1.0

        Convert the current CRS to the 3D version if it makes sense.

        New vertical axis attributes:
          - ellipsoidal height
          - oriented upwards
          - metre units

        Parameters
        ----------
        name: str, optional
            CRS name. Defaults to use the name of the original CRS.

        Returns
        -------
        CRS
        r   )r(   r   to_3dr&   r   r)   r)   r*   r2    s   z	CRS.to_3dc                 C   r/  )a#  
        .. versionadded:: 3.6.0

        Convert the current CRS to the 2D version if it makes sense.

        Parameters
        ----------
        name: str, optional
            CRS name. Defaults to use the name of the original CRS.

        Returns
        -------
        CRS
        r1  )r(   r   to_2dr3  r)   r)   r*   r4    s   z	CRS.to_2dc                 C   r  )aW  
        This checks if the CRS is geographic.
        It will check if it has a geographic CRS
        in the sub CRS if it is a compound CRS and will check if
        the source CRS is geographic if it is a bound CRS.

        Returns
        -------
        bool:
            True if the CRS is in geographic (lon/lat) coordinates.
        )r   r   r%   r)   r)   r*   r        zCRS.is_geographicc                 C   r  )a6  
        This checks if the CRS is projected.
        It will check if it has a projected CRS
        in the sub CRS if it is a compound CRS and will check if
        the source CRS is projected if it is a bound CRS.

        Returns
        -------
        bool:
            True if CRS is projected.
        )r   r   r%   r)   r)   r*   r     r5  zCRS.is_projectedc                 C   r  )aS  
        .. versionadded:: 2.2.0

        This checks if the CRS is vertical.
        It will check if it has a vertical CRS
        in the sub CRS if it is a compound CRS and will check if
        the source CRS is vertical if it is a bound CRS.

        Returns
        -------
        bool:
            True if CRS is vertical.
        )r   r   r%   r)   r)   r*   r     s   zCRS.is_verticalc                 C   r  )zY
        Returns
        -------
        bool:
            True if CRS is bound.
        )r   r   r%   r)   r)   r*   r     r  zCRS.is_boundc                 C   r  )z}
        .. versionadded:: 3.1.0

        Returns
        -------
        bool:
            True if CRS is compound.
        )r   r   r%   r)   r)   r*   r     r  zCRS.is_compoundc                 C   r  )z
        .. versionadded:: 2.2.0

        Returns
        -------
        bool:
            True if CRS is local/engineering.
        )r   is_engineeringr%   r)   r)   r*   r6    r  zCRS.is_engineeringc                 C   r  )z
        This checks if the CRS is geocentric and
        takes into account if the CRS is bound.

        Returns
        -------
        bool:
            True if CRS is in geocentric (x/y) coordinates.
        )r   is_geocentricr%   r)   r)   r*   r7    s   zCRS.is_geocentricc                 C   r  )z
        .. versionadded:: 3.2.0

        Returns
        -------
        bool:
            True if CRS is a Derived CRS.
        )r   
is_derivedr%   r)   r)   r*   r8    r  zCRS.is_derivedc                 C   s
   |  |S r!   )r  r  r)   r)   r*   __eq__  rp   z
CRS.__eq__c                 C   s
   d| j iS )Nry   ry   r%   r)   r)   r*   __getstate__!  rp   zCRS.__getstate__statec                 C   s   | j | t | _d S r!   )__dict__r   r    r{   )r&   r<  r)   r)   r*   __setstate__$  s   zCRS.__setstate__c                 C   s   t |  S r!   )hashrx   r%   r)   r)   r*   __hash__(  s   zCRS.__hash__c                 C   s   | j S r!   r:  r%   r)   r)   r*   __str__+  s   zCRS.__str__c                 C   s  g }| j D ]}|dt|dg qd|}d}d}| jr(| jjr(t| j}n;| jr=| jr=t| jj}d| jj d}n&g }dg}| j	D ]}	|
t|	j |d|	jdg qEd|}d|}d}
| jrxdddt| jd	| jjdg}
|  }t|d
kr|n
d|d d
 dg}|pd}d| j d| d| j d|pd d| d| jpd d|
 d| j d| jpd d| jpd d| | S )Nz- 
rw   zSource CRS: z	Sub CRS:
|zCoordinate Operation:
z- name: z
- method: 2   r@   z...z- undefined
<z: z>
Name: z
Axis Info [r   z]:
zArea of Use:
z- undefinedzDatum: z
- Ellipsoid: z
- Prime Meridian: )r  r  r7   rH   r   	axis_listr   r   r   r   rI   r   r   r   rz   r  r  r   r   r   )r&   axis_info_listr   axis_info_strsource_crs_reprsub_crs_reprcoordinate_system_namecoordinate_system_namessub_crs_repr_listr   r   srs_reprr)   r)   r*   __repr__.  sl   




&	
zCRS.__repr__r!   )NNN)F)FrQ   )r)  )Nr)  )Vr+   r,   r-   r.   r   r   r$   propertyr   classmethodr7   r   rr   r   r   r   r   r   r   r   r   r   rB   r   r   r   r   r   	WKT2_2019boolr   staticmethodr   rF   r  r  r  r   r   r   r   r  r   r  r	   r  r   r  r   r   r   r   r   r   r   r   r
   r   r   r!  rx   r'  r   r   PROJ_5r   r*  r   r   r.  r2  r4  r   r   r   r   r   r6  r7  r8  r9  r;  r>  r@  rA  rO  r)   r)   r)   r*   rv      s    (
 0

 ~>
			




, %+
,	
rv   c                       s   e Zd ZdZedeedf fddZdd Ze	de
dd	f fd
dZeded	 fddZeded	 fddZeded	 fddZeded	 fddZddee dd	fddZ  ZS )CustomConstructorCRSz
    This class is a base class for CRS classes
    that use a different constructor than the main CRS class.

    .. versionadded:: 3.2.0

    See: https://github.com/pyproj4/pyproj/issues/847
    r2   .c                 C   s   t )zt
        These are the type names of the CRS class
        that are expected when using the from_* methods.
        )NotImplementedErrorr%   r)   r)   r*   _expected_typesr  s   z$CustomConstructorCRS._expected_typesc                 C   s*   | j | jvrtd| j  d| j ddS )zl
        This validates that the type of the CRS is expected
        when using the from_* methods.
        zInvalid type z. Expected .N)r  rX  r   r%   r)   r)   r*   _check_typez  s
   z CustomConstructorCRS._check_typerM   rv   c                    s<   t || r|S | | }tt|j|fi | |  |S r   )rA   __new__r#   rV  r$   rZ  )r   rM   r|   r"   r'   r)   r*   r     s   

z$CustomConstructorCRS.from_user_inputc                 C      | j jdu rdS t| j jS r  )r   r   rv   r%   r)   r)   r*   r        z!CustomConstructorCRS.geodetic_crsc                 C   r\  r  )r   r   rv   r%   r)   r)   r*   r     s   
zCustomConstructorCRS.source_crsc                 C   r\  r  )r   r   rv   r%   r)   r)   r*   r     r]  zCustomConstructorCRS.target_crsc                 C   s   dd | j jD S )r  c                 S   r6   r)   )rv   r  r)   r)   r*   r:     r;   z5CustomConstructorCRS.sub_crs_list.<locals>.<listcomp>r  r%   r)   r)   r*   r     s   	z!CustomConstructorCRS.sub_crs_listNr   c                 C   s   t | jj|dS r0  )rv   r   r2  r3  r)   r)   r*   r2    s   zCustomConstructorCRS.to_3dr!   )r+   r,   r-   r.   rP  rG   r7   rX  rZ  rQ  r   r   r   r   r   r   rF   r   r2  r/   r)   r)   r'   r*   rV  h  s     	
 
rV  c                	       sB   e Zd ZdZdZ			ddededee d	df fd
dZ  Z	S )r   zR
    .. versionadded:: 2.5.0

    This class is for building a Geographic CRS
    )zGeographic CRSzGeographic 2D CRSzGeographic 3D CRSr   urn:ogc:def:ensemble:EPSG::6326Nr   r   r   r2   c                    sZ   t | }dd|t|pt  d}|d dkr!||d< n||d< t | dS )	aC  
        Parameters
        ----------
        name: str, default="undefined"
            Name of the CRS.
        datum: Any, default="urn:ogc:def:ensemble:EPSG::6326"
            Anything accepted by :meth:`pyproj.crs.Datum.from_user_input` or
            a :class:`pyproj.crs.datum.CustomDatum`.
        ellipsoidal_cs: Any, optional
            Input to create an Ellipsoidal Coordinate System.
            Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or an Ellipsoidal Coordinate System created from :ref:`coordinate_system`.
        2https://proj.org/schemas/v0.2/projjson.schema.jsonr   )$schematyper   r   ra  DatumEnsembledatum_ensembler   N)r   r   r   r   r   r#   r$   )r&   r   r   r   r   r'   r)   r*   r$     s   
zGeographicCRS.__init__)r   r^  N
r+   r,   r-   r.   rX  r7   r   r   r$   r/   r)   r)   r'   r*   r     s    r   c                       sD   e Zd ZdZdZ		ddededee ded	df
 fd
dZ  Z	S )r   zZ
    .. versionadded:: 2.5.0

    This class is for building a Derived Geographic CRS
    )zDerived Geographic CRSzDerived Geographic 2D CRSzDerived Geographic 3D CRSNr   r   r   r   r   r2   c                    sF   dd|t | t| t|pt  d}t | dS )a  
        Parameters
        ----------
        base_crs: Any
            Input to create the Geodetic CRS, a :class:`GeographicCRS` or
            anything accepted by :meth:`pyproj.crs.CRS.from_user_input`.
        conversion: Any
            Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or a conversion from :ref:`coordinate_operation`.
        ellipsoidal_cs: Any, optional
            Input to create an Ellipsoidal Coordinate System.
            Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or an Ellipsoidal Coordinate System created from :ref:`coordinate_system`.
        name: str, default="undefined"
            Name of the CRS.
        r_  r   r`  ra  r   r   r   r   N)rv   r   r   r
   r   r   r#   r$   )r&   r   r   r   r   derived_geographic_crs_jsonr'   r)   r*   r$   $  s   zDerivedGeographicCRS.__init__)Nr   )
r+   r,   r-   r.   rX  r   r   r7   r$   r/   r)   r)   r'   r*   r     s     
r   c                       s8   e Zd ZdZdZ		ddededdf fd	d
Z  ZS )GeocentricCRSzR
    .. versionadded:: 3.2.0

    This class is for building a Geocentric CRS
    )zGeocentric CRSr   urn:ogc:def:datum:EPSG::6326r   r   r2   Nc                    sT   dd|t | ddddddd	d
ddddddddgdd}t | dS )a0  
        Parameters
        ----------
        name: str, default="undefined"
            Name of the CRS.
        datum: Any, default="urn:ogc:def:datum:EPSG::6326"
            Anything accepted by :meth:`pyproj.crs.Datum.from_user_input` or
            a :class:`pyproj.crs.datum.CustomDatum`.
        r_  GeodeticCRS	CartesianzGeocentric XXgeocentricXmetre)r   abbreviation	directionunitzGeocentric YYgeocentricYzGeocentric ZZgeocentricZ)subtyper   r`  ra  r   r   r   N)r   r   r   r#   r$   )r&   r   r   geocentric_crs_jsonr'   r)   r*   r$   S  s0   zGeocentricCRS.__init__)r   rh  )	r+   r,   r-   r.   rX  r7   r   r$   r/   r)   r)   r'   r*   rg  J  s    rg  c                       sJ   e Zd ZdZdZ			ddededee dee d	df
 fd
dZ  Z	S )r   zR
    .. versionadded:: 2.5.0

    This class is for building a Projected CRS.
    )zProjected CRSzDerived Projected CRSr   Nr   r   r   r   r2   c                    sL   dd|t |p	t  t| t|pt  d}t | dS )a  
        Parameters
        ----------
        conversion: Any
            Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or a conversion from :ref:`coordinate_operation`.
        name: str, optional
            The name of the Projected CRS. Default is undefined.
        cartesian_cs: Any, optional
            Input to create a Cartesian Coordinate System.
            Anything accepted by :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or :class:`pyproj.crs.coordinate_system.Cartesian2DCS`.
        geodetic_crs: Any, optional
            Input to create the Geodetic CRS, a :class:`GeographicCRS` or
            anything accepted by :meth:`pyproj.crs.CRS.from_user_input`.
        r_  r   re  N)	rv   r   r   r   r
   r   r   r#   r$   )r&   r   r   r   r   proj_crs_jsonr'   r)   r*   r$     s"   zProjectedCRS.__init__)r   NN)
r+   r,   r-   r.   rX  r   r7   r   r$   r/   r)   r)   r'   r*   r     s"    r   c                       sH   e Zd ZdZdZ		ddededee dee ddf
 fd	d
Z  Z	S )r   z
    .. versionadded:: 2.5.0

    This class is for building a Vetical CRS.

    .. warning:: geoid_model support only exists in PROJ >= 6.3.0

    )zVertical CRSNr   r   r   r   r2   c                    sN   dd|t | t|pt  d}|durd|i|d< t | dS )a!  
        Parameters
        ----------
        name: str
            The name of the Vertical CRS (e.g. NAVD88 height).
        datum: Any
            Anything accepted by :meth:`pyproj.crs.Datum.from_user_input`
        vertical_cs: Any, optional
            Input to create a Vertical Coordinate System accepted by
            :meth:`pyproj.crs.CoordinateSystem.from_user_input`
            or :class:`pyproj.crs.coordinate_system.VerticalCS`
        geoid_model: str, optional
            The name of the GEOID Model (e.g. GEOID12B).
        r_  r   rv  Nr   r   )r   r   r   r   r   r#   r$   )r&   r   r   r   r   vert_crs_jsonr'   r)   r*   r$     s   	zVerticalCRS.__init__)NNrd  r)   r)   r'   r*   r     s     	r   c                       s6   e Zd ZdZdZdedee ddf fddZ  Z	S )	r   zQ
    .. versionadded:: 2.5.0

    This class is for building a Compound CRS.
    )zCompound CRSr   r   r2   Nc                    s(   dd|dd |D d}t  | dS )a#  
        Parameters
        ----------
        name: str
            The name of the Compound CRS.
        components: list[Any], optional
            List of CRS to create a Compound Coordinate System.
            List of anything accepted by :meth:`pyproj.crs.CRS.from_user_input`
        r_  r   c                 S   s   g | ]	}t | qS r)   )rv   r   r   )r8   	componentr)   r)   r*   r:     s    z(CompoundCRS.__init__.<locals>.<listcomp>)r`  ra  r   r   N)r#   r$   )r&   r   r   compound_crs_jsonr'   r)   r*   r$     s   
zCompoundCRS.__init__)
r+   r,   r-   r.   rX  r7   rF   r   r$   r/   r)   r)   r'   r*   r         &r   c                       s6   e Zd ZdZdZdedededdf fdd	Z  ZS )
r   zN
    .. versionadded:: 2.5.0

    This class is for building a Bound CRS.
    )z	Bound CRSr   r   r   r2   Nc                    s>   ddt | t | t| d}t | dS )a  
        Parameters
        ----------
        source_crs: Any
            Input to create a source CRS.
        target_crs: Any
            Input to create the target CRS.
        transformation: Any
            Input to create the transformation.
        r_  r   )r`  ra  r   r   r   N)rv   r   r   r
   r#   r$   )r&   r   r   r   bound_crs_jsonr'   r)   r*   r$     s   
zBoundCRS.__init__)r+   r,   r-   r.   rX  r   r$   r/   r)   r)   r'   r*   r     r|  r   )T)Cr.   rC   rS   	threadingr[   typingr   r   r   r   pyproj._crsr   r   r   r	   r
   r   r   r   r   r   r   r   pyproj.crs._cf1x8r   r   r   r   r   r   pyproj.crs.coordinate_operationr   pyproj.crs.coordinate_systemr   r   r   pyproj.enumsr   r   pyproj.exceptionsr   pyproj.geodr   compilerk  r   localr    rB   rS  r7   rN   rb   rJ   rr   rl   ro   ru   rv   rV  r   r   rg  r   r   r   r   r)   r)   r)   r*   <module>   sZ    8 &
           P ,3710 