
     h                     z   d Z ddlZddlZddlZddlZddlmZ ddl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jV                  dejX                        Z- G d dej\                        Z/d-de0de1de2fdZ3de2de2fdZ4de2de2fdZ5de2de2e6z  fdZ7de2e6z  fdZ8dede1fdZ9 G d d      Z: G d de:      Z; G d d e;      Z< G d! d"e;      Z= G d# d$e;      Z> G d% d&e;      Z? G d' d(e;      Z@ G d) d*e;      ZA G d+ d,e;      ZBy).zx
This module interfaces with PROJ to produce a pythonic interface
to the coordinate reference system (CRS) information.
    N)Callable)AnyOptional)_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                   "     e Zd ZdZ fdZ xZS )CRSLocalz
    Threading local instance for cython CRS class.

    For more details, see:
    https://github.com/pyproj4/pyproj/issues/782
    c                 0    d | _         t        | 	          y N)crssuper__init__)self	__class__s    j/home/developers/rajanand/mypropertyqr-fmb-refixing-v2/venv/lib/python3.12/site-packages/pyproj/crs/crs.pyr&   zCRSLocal.__init__>   s        )__name__
__module____qualname____doc__r&   __classcell__r(   s   @r)   r!   r!   6   s     r*   r!   
projparams
allow_jsonreturnc           	         t        | t              st        d      d| vrd| vr|rt        j                  |       S g }| j                         D ]  \  }}t        |t        t        f      r(dj                  |D cg c]  }t        |       c}      }|t        |      dk(  r|j                  d|        it        |      dk(  rx|j                  d| d|         t        d	j                  |            S c c}w )
NzCRS input is not a dictprojinit,True+False= )
isinstancedictr   jsondumpsitemslisttuplejoinstrappend_prepare_from_string)r1   r2   pjargskeyvaluevals         r)   _prepare_from_dictrL   C   s    j$'011ZF*$<zz*%%F &&( 
-
UedE]+HH%83c#h89E=CJ&0MMAcU)$Z7"MMAcU!E7+,
-   011 9s   8C8
in_crs_stringc                    t        j                  dd| j                               } d}| j                  |      scg }d}| j	                         D ];  }|s&|j                  |      r|j                  d|       d}+|j                  |       = dj                  |      } d| vrd	| v r| d
z  } n| dz  } | j                  dd      j                         } | j                  d      rt        j                  dt        d       | S )Nz[\s+]?=[\s+]?r;   )+initz+projr6   r5   Fr   Tr<   ztype=crsr9   z
 +type=crsz	 type=crsz
+init=EPSGz
+init=epsg)rO   r6   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insertrF   rD   replacestripwarningswarnFutureWarning)rM   starting_paramskvpairsfirst_item_insertedkvpairs        r)   _prepare_from_proj_stringra   Y   s   FF+S-2F2F2HIM8O##O4##))+ 	'F&F,=,=o,Nq&)&*#v&	' ) &-\)M[(M ")),EKKMM 12,
 	
 r*   c                 .   t        | t              st        d      | st        d|       d| v r2	 t        j                  | d      }|st        d      t        |      } | S t        |       rt        |       } | S # t
        $ r}t        d      |d }~ww xY w)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)	r=   rE   r   r?   loads
ValueErrorrL   r   ra   )rM   crs_dicterrs      r)   rG   rG      s    mS)2339-9JKLL
m	Ozz->H .//*84  
	1-@  	ODE3N	Os   A: :	BBB	auth_name	auth_codec                     |  d| S )N: )ri   rj   s     r)   _prepare_from_authorityrn      s    [)%%r*   c                     t        d|       S )NEPSG)rn   rj   s    r)   _prepare_from_epsgrr      s    "6955r*   c                     t        | t              ryt        | t              r| j                         ryt	        | d      r| j
                  dk(  ryy)NTshaperm   F)r=   intrE   	isnumerichasattrrt   rq   s    r)   _is_epsg_coderx      sB    )S!)S!i&9&9&;y'"y"'<r*   c                      e Zd ZdZdZdedz  ddfdZed        Zede	de	e
z  dd fd	       Zede	e
z  dd fd
       Zede	dd fd       Zede	dd fd       Zede	dd fd       Zde	fdZededd fd       Zdedz  fdZededd fd       Zede	dd fd       Zededd fd       ZdefdZej4                  dfdee	z  dedefdZe	 	 	 d[d ed!edz  d"edz  d#edz  dd f
d$       Zdee   fd%Z d&edefd'Z!d\d&ed(edefd)Z"ede#d    fd*       Z$ede#d    fd+       Z%ede#d    fd,       Z&eded    fd-       Z'ede	dz  fd.       Z(ede	fd/       Z)ede	fd0       Z*edee+   fd1       Z,ede-dz  fd2       Z.ede/dz  fd3       Z0ede1dz  fd4       Z2ede3dz  fd5       Z4ede5dz  fd6       Z6ede7dz  fd7       Z8ede	fd8       Z9ede	fd9       Z:ej4                  ddfd:ee	z  d;ed<edz  de	fd=Z;d]d;ed>e
de	fd?Z<defd@Z=e>j~                  fd:e>e
z  de	fdAZ@d^dBe
de
dz  fdCZAd_de	dz  dBe
fdDZB	 d_de	dz  dBe
deeC   fdEZDdZdFe	dz  dd fdGZEdZdFe	dz  dd fdHZFedefdI       ZGedefdJ       ZHedefdK       ZIedefdL       ZJedefdM       ZKedefdN       ZLedefdO       ZMedP        ZNedefdQ       ZOded    fdRZPd&eQdefdSZRdee	e	f   fdTZSdUee	ef   fdVZTde
fdWZUde	fdXZVde	fdYZWy)`CRSa/  
    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>`_
    * `opendatacube <https://github.com/opendatacube/datacube-core/blob/83bae20d2a2469a6417097168fd4ede37fd2abe5/datacube/utils/geometry/_base.py>`_

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

    Nr1   r3   c                    d}|rt        |t              r|j                  }nt        |      rt	        |      }nt        |t
              rt        |      }ntt        |t              rt        |      }nXt        |t        t        f      rt        |      dk(  r	t        | }n+t        |d      r|j                         }nt        d|      |r)t        |d      }t        dj!                  ||f            }|| _        t#               | _        t        |t              r|| j$                  _        yt        | j                        | j$                  _        y)	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
         rP   to_wktzInvalid CRS input: F)r2   r<   N)r=   r   srsrx   rr   rE   rG   r>   rL   rB   rC   lenrn   rw   r}   r   rD   r!   _localr$   )r'   r1   kwargs
projstring
projkwargss        r)   r&   zCRS.__init__   s   T 
*d+'^^
z*/
;
J,1*=
J-/
;
Ju63z?a;O4jA
X.'..0
!4ZNCDD+FuEJ-chh
J7O.PQJjj$'(DKKO"488nDKKOr*   c                     | j                   j                  $t        | j                        | j                   _        | j                   j                  S )zH
        Retrieve the Cython based _CRS object for this thread.
        )r   r$   r   r~   r'   s    r)   _crszCRS._crs`  s3    
 ;;??""488nDKKO{{r*   ri   codec                 8    | j                  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_inputrn   )clsri   r   s      r)   from_authorityzCRS.from_authorityi  s    $ ""#:9d#KLLr*   c                 6    | j                  t        |            S )zMake a CRS from an EPSG code

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

        Returns
        -------
        CRS
        )r   rr   )r   r   s     r)   	from_epsgzCRS.from_epsg}  s     ""#5d#;<<r*   in_proj_stringc                 h    t        |      st        d|       | j                  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   ra   )r   r   s     r)   
from_proj4zCRS.from_proj4  s7      ~&2>2BCDD""#<^#LMMr*   in_wkt_stringc                 h    t        |      st        d|       | j                  t        |            S )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   rG   )r   r   s     r)   from_wktzCRS.from_wkt  s6      m$1-ABB""#7#FGGr*   rM   c                 6    | j                  t        |            S )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   rG   )r   rM   s     r)   from_stringzCRS.from_string  s    ( ""#7#FGGr*   c                 d    | j                  d      }|rdj                  |      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_confidencerl   )to_authorityrD   r~   )r'   	auth_infos     r)   	to_stringzCRS.to_string  s2     %%S%9	88I&&xxr*   rJ   c                 0    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
        )r=   )r   rJ   r   s      r)   r   zCRS.from_user_input  s#    0 eS!L5#F##r*   c                     | j                   yt        | j                   j                  | j                   j                  | j                   j                        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   s    r)   get_geodzCRS.get_geod  sE     >>!nn--~~00nn--
 	
r*   	proj_dictc                 6    | j                  t        |            S )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   rL   )r   r   s     r)   	from_dictzCRS.from_dict  s      ""#5i#@AAr*   crs_jsonc                 6    | j                  t        |            S )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   s     r)   	from_jsonzCRS.from_json  s      ""?8#<==r*   rg   c                 J    | j                  t        j                  |            S )z
        .. versionadded:: 2.4.0

        Create CRS from a JSON dictionary.

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

        Returns
        -------
        CRS
        )r   r?   r@   )r   rg   s     r)   from_json_dictzCRS.from_json_dict,  s      ""4::h#788r*   c                     | j                         }|i S d }i }t        j                  |      D ])  }|j                         \  }}| ||      }|dus%|||<   + |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

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

        c                     | j                         dk(  ry| j                         dk(  ry	 t        |       S # t        $ r Y nw xY w	 t        |       S # t        $ r Y t	        |       S w xY w)NtrueTfalseF)lowerru   rf   floatr   )rK   s    r)   _parsezCRS.to_dict.<locals>._parseS  sp    yy{f$yy{g%3x Sz! &s++s!   
5 	A A
A 	A&%A&F)to_proj4_RE_PROJ_PARAMfinditergroups)r'   proj_stringr   r   paramrI   rJ   s          r)   to_dictzCRS.to_dict>  sw    " mmoI	, 	#,,[9 	'EJC uE!!&	#	' r*   Fwkt_versionerrcheckc                    d| j                  |      i}| j                  r| j                  r|| j                  j                  rf| j                  rZ| j                  j                  ||      }|j                  d       |j                  |       | j                  j                  |d<   |S | j                  rH| j                  D ]7  }|j                  ||      }|j                  d       |j                  |       9 |S | j                  rF| j                         }d|v r|d   d   |d<   | j                  r| j                  j                  |d<   |S | j                  ri|j                  | j                  j                  | j                  j                   | j                  j"                         | j                  j                  |d	<   | j$                  r2| j$                  j&                  |d
<   | j$                  j                  |d<   | j(                  rR| j(                  j                  |d<   | j(                  j                  r#| j(                  j                  j                  |d<   | j*                  r| j                  r| j                  j,                  j/                         t0        vr5|r,t3        j4                  d| j                  j,                          d|d   iS |j                  t1        | j                  j,                  j/                            | j                               |S d|d<   |S d}| j                  s'| j6                  r| j                  }| j                  |d<   |sdn)|j,                  j/                         j9                  dd      }|t:        vrC|r:|r#t3        j4                  d|j,                          nt3        j4                  d       d|d   iS |j                  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.)r}   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   rZ   r[   is_projectedrX   r   )	r'   r   r   cf_dictsub_cfsub_crs	vert_jsonr   coordinate_operation_names	            r)   r   z	CRS.to_cfl  s   8 $-dkk+.F"G MM))))11%)__%:%:'! &; &F JJy!NN6"!%!:!:!B!BGIN ,, ' ;R

9%v&' N ))+I	)(1-(@(H%zz59ZZ__12N >>NN $ ? ? $ ? ?#'>>#D#D  
 37..2E2EG./595H5H5R5RG12-1-@-@-E-EG)* -1->->-C-CG)*  &&373D3D3J3J3O3O/0((--99??ADE   @#88DDEG &wy'9::=11==CCE//1 N 0D+,N  $}}!2!2#'#<#< ,0IIG() ( %11779AA#sK 	"
 %,JJ'MM</;;<>
 MM"CDwy122*+DE$	

 r*   in_cfellipsoidal_cscartesian_csvertical_csc                    d}d| v rt        | d         S d| v rt        | d         S | j                  d      }|t        d      t        |       }	 t        |   }| j                  d      }|rt        |xs d||	      }	na|rS||vrOt        |      }	|N|	j                         }
t        j                  |      j                         |
d
<   t        |
      }	nt        |      }	|dk(  r|	S |t        |	 ||       |      S 	 t        |   }t        | j                  dd       ||       |	|      }d}d| v r.t        |dt        |j                  gt!        | d                }d| vr|xs |S t#        d| d   | j                  d      |      }t%        d|xs ||g      S # t
        $ r d}Y Sw xY w# t
        $ r t        d|       dw xY w)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)rz   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_crss                  r)   from_cfzCRS.from_cf  sY   P 1uY'((E!u]+,,!II&9:$QRR .e4	012CD ) $ii(=>"/(7K-#N
 !%8%M !45N)&4&A&A&C#$44^DQQS $$78 "%%8!9*.IN 44!!'3''7>- 	 67H I
 %/=(/'%	
 	 (#4!.. 1DU9EU1V I %E1-- #12		,/#	
 )*D}l)S
 	
C  	0+/(	0@  	12C1DE	s   	F ?	F1 F.-F.1G
c                    g }d }| j                   dk(  r| j                  r| j                  j                         }|j                  dd      j	                         j                  d      }t        |      dk(  r| d}| j                  d   }d	d	|j                  d
d      j                         j                  dd      dd}|j                  j                         j                  d
d      j	                         }|r
| d| |d<   |j                  |       | j                  r3|j                  | j                  j                   ||                    |S | j                  ri| j                   r]| j                   j                  rG|j                  | j                   j                  j                   || j                                      |S | j"                  D ]!  }|j                  |j%                                # |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                     	 | j                   xr* | j                   j                  j                         t        v S # t        $ r Y yw xY w)NF)r   r   r   r   r   )r$   s    r)   rotated_polez"CRS.cs_to_cf.<locals>.rotated_pole~  sP    ,, A00<<BBD@A
  s   7: 	AAzTemporal CRStime_originz
1875-05-20zZ   z-01-01r   timecalendarproleptic_gregorianr<   r   T)standard_name	long_namer  axisr|   z since units)r	  )	type_namer   r   r   rY   rstripr   	axis_infor   rX   	unit_namerF   r   extendr   r   r   r   cs_to_cf)	r'   cf_axis_listr	  
datum_jsonoriginr  cf_temporal_axisr  r   s	            r)   r  zCRS.cs_to_cfn  s    	 >>^+

002J^^M<@FFHOOPTUF6{a"86*>>!$D!'#NN:/DEUWWS#&	  ,,.66z2FLLNI/8k,I ) 01!!&&,,,t:L,M  ]]t4??3T3T1177!-doo!> 8    ,, 8##G$4$4$678r*   otherc                     	 t         j                  |      }| j                  j	                  |j                        S # t        $ r Y yw xY w)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)rz   r   r   r   is_exact_samer'   r  s     r)   r!  zCRS.is_exact_same  sF    	''.E yy&&uzz22  		s   < 	AAignore_axis_orderc                     	 t         j                  |      }| j                  j	                  |j                  |      S # t        $ r Y yw xY w)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#  )rz   r   r   r   equals)r'   r  r#  s      r)   r%  z
CRS.equals  sL    (	''.E yy

>OPP  		s   > 	A
	A
c                 |    | j                   j                  dS | j                  | j                   j                        S z
        .. versionadded:: 2.2.0

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

        N)r   r   r(   r   s    r)   r   zCRS.geodetic_crs  s;     yy%%- 	
 		 6 67	
r*   c                 |    | j                   j                  dS | j                  | j                   j                        S 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   s    r)   r   zCRS.source_crs  s;     yy##+ 	
 		 4 45	
r*   c                 |    | j                   j                  dS | j                  | j                   j                        S 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   s    r)   r   zCRS.target_crs  s;     yy##+ 	
 		 4 45	
r*   c                 r    | j                   j                  D cg c]  }| j                  |       c}S c c}w z
        If the CRS is a compound CRS, it will return a list of sub CRS objects.

        Returns
        -------
        list[CRS]
        )r   r   r(   r'   r   s     r)   r   zCRS.sub_crs_list  s+     8<yy7M7MNGw'NNNs   4c                    | j                   r"| j                  r| j                  j                  S | j                  r,| j                  D ]  }|j                  s|j                  c S  y| j                  r\d| j                  j
                  j                         v r6| j                  j
                  j                         j                  d      d   S y)z
        .. versionadded:: 2.6.0

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

        Returns
        -------
        str | None:
            The UTM zone number and letter if applicable.
        zUTM ZONEz	UTM ZONE N)r   r   utm_zoner   r   r   upperrV   r.  s     r)   r1  zCRS.utm_zone  s     ==T__??+++,, ,##"+++, 	 %%d77<<BBDD,,11779??LRPPr*   c                 .    | j                   j                  S )zx
        Returns
        -------
        str:
            The name of the CRS (from :cpp:func:`proj_get_name`).
        )r   r   r   s    r)   r   zCRS.name1  s     yy~~r*   c                 .    | j                   j                  S )zj
        Returns
        -------
        str:
            The name of the type of the CRS object.
        )r   r  r   s    r)   r  zCRS.type_name;  s     yy"""r*   c                 .    | j                   j                  S )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   s    r)   r  zCRS.axis_infoE  s     yy"""r*   c                 .    | j                   j                  S )z{
        Returns
        -------
        AreaOfUse:
            The area of use object with associated attributes.
        )r   area_of_user   s    r)   r7  zCRS.area_of_useS  s     yy$$$r*   c                 .    | j                   j                  S )z
        .. versionadded:: 2.2.0

        Returns
        -------
        Ellipsoid:
            The ellipsoid object with associated attributes.
        )r   r   r   s    r)   r   zCRS.ellipsoid]  s     yy"""r*   c                 .    | j                   j                  S )z
        .. versionadded:: 2.2.0

        Returns
        -------
        PrimeMeridian:
            The prime meridian object with associated attributes.
        )r   r   r   s    r)   r   zCRS.prime_meridiani       yy'''r*   c                 .    | j                   j                  S )zX
        .. versionadded:: 2.2.0

        Returns
        -------
        Datum
        )r   r   r   s    r)   r   z	CRS.datumu  s     yyr*   c                 .    | j                   j                  S )zc
        .. versionadded:: 2.2.0

        Returns
        -------
        CoordinateSystem
        )r   r   r   s    r)   r   zCRS.coordinate_system  s     yy***r*   c                 .    | j                   j                  S )zf
        .. versionadded:: 2.2.0

        Returns
        -------
        CoordinateOperation
        )r   r   r   s    r)   r   zCRS.coordinate_operation  s     yy---r*   c                 .    | j                   j                  S )zy
        .. versionadded:: 2.4.0

        Returns
        -------
        str:
            Remarks about object.
        )r   remarksr   s    r)   r?  zCRS.remarks  s     yy   r*   c                 .    | j                   j                  S )zt
        .. versionadded:: 2.4.0

        Returns
        -------
        str:
            Scope of object.
        )r   scoper   s    r)   rA  z	CRS.scope  s     yyr*   versionprettyoutput_axis_rulec                 d    | j                   j                  |||      }|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
        )rB  rC  rD  z.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   r}   r   )r'   rB  rC  rD  wkts        r)   r}   z
CRS.to_wkt  sU    D iiF=M  
 ;@	 JO O  
r*   indentationc                 Z    | j                   j                  ||      }|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
        )rC  rG  z.CRS cannot be converted to a PROJ JSON string.)r   to_jsonr   )r'   rC  rG  	proj_jsons       r)   rI  zCRS.to_json  s5    " II%%V%M	KLLr*   c                 6    | j                   j                         S )z
        .. versionadded:: 2.4.0

        Convert the object to a JSON dictionary.

        Returns
        -------
        dict
        )r   r   r   s    r)   r   zCRS.to_json_dict  s     yy%%''r*   c                 X    | j                   j                  |      }|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

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

        Returns
        -------
        str
        )rB  z)CRS cannot be converted to a PROJ string.)r   r   r   )r'   rB  r5   s      r)   r   zCRS.to_proj4  s1    & yy!!'!2<FGGr*   r   c                 :    | j                   j                  |      S )a`  
        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
        -------
        int | None:
            The best matching EPSG code matching the confidence level.
        r   )r   to_epsg)r'   r   s     r)   rN  zCRS.to_epsg  s    F yy   ??r*   c                 <    | j                   j                  ||      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   s      r)   r   zCRS.to_authority9  s&    L yy%% & 
 	
r*   c                 <    | j                   j                  ||      S )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.
        rP  )r   list_authorityrQ  s      r)   rS  zCRS.list_authorityc  s&    P yy'' ( 
 	
r*   r   c                 X    | j                  | j                  j                  |            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   s     r)   rW  z	CRS.to_3d  s"    ( ~~diioo4o899r*   c                 X    | j                  | j                  j                  |            S )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
        rV  )r(   r   to_2drX  s     r)   rZ  z	CRS.to_2d  s"     ~~diioo4o899r*   c                 .    | j                   j                  S )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   s    r)   r   zCRS.is_geographic  s     yy&&&r*   c                 .    | j                   j                  S )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   s    r)   r   zCRS.is_projected  s     yy%%%r*   c                 .    | j                   j                  S )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   s    r)   r   zCRS.is_vertical  s     yy$$$r*   c                 .    | j                   j                  S )zY
        Returns
        -------
        bool:
            True if CRS is bound.
        )r   r   r   s    r)   r   zCRS.is_bound  s     yy!!!r*   c                 .    | j                   j                  S )z}
        .. versionadded:: 3.1.0

        Returns
        -------
        bool:
            True if CRS is compound.
        )r   r   r   s    r)   r   zCRS.is_compound  s     yy$$$r*   c                 .    | j                   j                  S )z
        .. versionadded:: 2.2.0

        Returns
        -------
        bool:
            True if CRS is local/engineering.
        )r   is_engineeringr   s    r)   ra  zCRS.is_engineering  r:  r*   c                 .    | j                   j                  S )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   s    r)   rc  zCRS.is_geocentric       yy&&&r*   c                 .    | j                   j                  S )z
        .. versionadded:: 3.2.0

        Returns
        -------
        bool:
            True if CRS is a Derived CRS.
        )r   
is_derivedr   s    r)   rf  zCRS.is_derived  s     yy###r*   c                 .    | j                   j                  S )z
        .. versionadded:: 3.7.0

        Check if the CRS is deprecated

        Returns
        -------
        bool
        )r   is_deprecatedr   s    r)   rh  zCRS.is_deprecated   rd  r*   c                 6    | j                   j                         S )z
        .. versionadded:: 3.7.0

        Return a list of non-deprecated objects related to this.

        Returns
        -------
        list[CRS]
        )r   get_non_deprecatedr   s    r)   rj  zCRS.get_non_deprecated-  s     yy++--r*   c                 $    | j                  |      S r#   )r%  r"  s     r)   __eq__z
CRS.__eq__9  s    {{5!!r*   c                     d| j                   iS )Nr~   r~   r   s    r)   __getstate__zCRS.__getstate__<  s    txx  r*   statec                 X    | j                   j                  |       t               | _        y r#   )__dict__r   r!   r   )r'   rp  s     r)   __setstate__zCRS.__setstate__?  s    U#jr*   c                 4    t        | j                               S r#   )hashr}   r   s    r)   __hash__zCRS.__hash__C  s    DKKM""r*   c                     | j                   S r#   rn  r   s    r)   __str__zCRS.__str__F  s    xxr*   c                    g }| j                   D ]  }|j                  dt        |      dg       ! dj                  |      }d}d}| j                  r,| j                  j
                  rt        | j                        }n| j                  rF| j                  r:t        | j                  j                        }d| j                  j                   d}nzg }dg}| j                  D ]D  }	|j                  t        |	j                               |j                  d|	j                  dg       F dj                  |      }dj                  |      }d}
| j                  r>dj                  ddt        | j                        d	| j                  j                  dg      }
| j                         }t        |      d
k  r|ndj                  |d d
 dg      }|xs d}d| j                   d| d| j                   d|xs d d| d| j                   xs d d|
 d| j"                   d| j$                  xs d d| j&                  xs d d| | S )Nz- 
r|   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  rE   rD   r   	axis_listr   r   r   r   rF   r   r   r   r   r  r7  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_reprs               r)   __repr__zCRS.__repr__I  sT   $&NN 	;D!!4TD"9:	;/ !!d&<&<&F&F%()?)?%@"]]t%()J)J%K" ,T__-A-A,B"EO&(#!-,, E'..s73L3L/MN!(($d)CDE &)XX.E%F"77#45L  "$$#%77-112"--99	$  >>#"8}28(3B-QVAW8X%8r( ,YYK  0?K@o0=1#$djj\ " NN9k: ;!!%!4!4!C DBn	
r*   r#   )NNN)F)FrP   )F   )Nr  )Xr+   r,   r-   r.   r   r&   propertyr   classmethodrE   ru   r   r   r   r   r   r   r   r   r   r>   r   r   r   r   r   	WKT2_2019boolr   staticmethodr  rB   r  r!  r%  r   r   r   r   r   r1  r   r  r	   r  r   r7  r   r   r   r   r   r   r   r   r
   r   r?  rA  r}   rI  r   r   PROJ_5r   rN  r   r   rS  rW  rZ  r   r   r   r   r   ra  rc  rf  rh  rj  objectrl  ro  rs  rv  rx  r  rm   r*   r)   rz   rz      s   &e-3: e-4 e-N   Ms M#) M M M& =S3Y =5 = = N N N N& HS HU H H& H H H H*3 & $C $e $ $6
$+ 
 B$ B5 B B" > > > >" 9d 9u 9 9", ,` )3(<(<A#%A A 
	AF  &*#'"&	|
|
d
|
 Dj|
 4Z	|

 
|
 |
|<$t* <|33 34 3*QC QD QT Q4 
huo 
 
  
HUO 
 
 
HUO 
 
  Od5k O O #*  0 c   #3 # # #4: # # %Y- % % 	#9t+ 	# 	# 	( 4 	( 	( ut|   +#3d#: + + .&9D&@ . . 	! 	! 	! 	s 	 	 %/$8$8(,	*c!* * +	*
 
*Xd  S ,
(d 
( 5@4F4F c 1 3 0#@c #@3: #@J(
cDj (
 (
V CE*
t*
<?*
	 	!*
X:#* : :,:#* : :" 't ' ' &d & & %T % %  "$ " " 	%T 	% 	% 	( 	( 	( 
't 
' 
' 	$ 	$ 
't 
' 
'
.DK 
."F "t "!d38n !!$sCx. !## # 7
# 7
r*   rz   c                        e Zd ZdZedeedf   fd       Zd Ze	de
ddf fd       Zeded   fd	       Zeded   fd
       Zeded   fd       Zeded   fd       Zddedz  ddfdZ x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
    r3   .c                     t         )zt
        These are the type names of the CRS class
        that are expected when using the from_* methods.
        )NotImplementedErrorr   s    r)   _expected_typesz$CustomConstructorCRS._expected_types  s
     "!r*   c                     | j                   | j                  vr&t        d| j                    d| j                   d      y)zl
        This validates that the type of the CRS is expected
        when using the from_* methods.
        zInvalid type z. Expected .N)r  r  r   r   s    r)   _check_typez CustomConstructorCRS._check_type  sG    
 >>!5!55/{4;O;O:PPQR  6r*   rJ   rz   c                     t        ||       r|S | j                  |       }t        t        |  |fi | |j                          |S r   )r=   __new__r%   r  r&   r  )r   rJ   r   r$   r(   s       r)   r   z$CustomConstructorCRS.from_user_input  sF    0 eS!Lkk#"C1%B6B
r*   c                 p    | j                   j                  dS t        | j                   j                        S r'  )r   r   rz   r   s    r)   r   z!CustomConstructorCRS.geodetic_crs  s-     yy--5tV3tyy?U?U;VVr*   c                 p    | j                   j                  dS t        | j                   j                        S r)  )r   r   rz   r   s    r)   r   zCustomConstructorCRS.source_crs  s-     yy++3tRTYY=Q=Q9RRr*   c                 p    | j                   j                  dS t        | j                   j                        S r+  )r   r   rz   r   s    r)   r   zCustomConstructorCRS.target_crs  s-     yy++3tRTYY=Q=Q9RRr*   c                 f    | j                   j                  D cg c]  }t        |       c}S c c}w r-  )r   r   rz   r.  s     r)   r   z!CustomConstructorCRS.sub_crs_list  s&     -1II,B,BCGCCCs   .Nr   c                 L    t        | j                  j                  |            S rU  )rz   r   rW  rX  s     r)   rW  zCustomConstructorCRS.to_3d  s    ( 499???-..r*   r#   )r+   r,   r-   r.   r  rC   rE   r  r  r  r   r   r   r   r   r   rB   r   rW  r/   r0   s   @r)   r  r    s     "sCx " " C e  < 
Whuo 
W 
W 	SHUO 	S 	S 
SHUO 
S 
S Dd5k D D/#* / /r*   r  c            	       F     e Zd ZdZdZ	 	 	 d	dedededz  ddf fdZ xZS )
r   zR
    .. versionadded:: 2.5.0

    This class is for building a Geographic CRS
    )zGeographic CRSzGeographic 2D CRSzGeographic 3D CRSNr   r   r   r3   c                     t        j                  |      j                         }dd|t        j                  |xs
 t	                     j                         d}|d   dk(  r||d<   n||d<   t
        |   |       y)	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   r  DatumEnsembledatum_ensembler   N)r   r   r   r   r   r%   r&   )r'   r   r   r   r  r(   s        r)   r&   zGeographicCRS.__init__  s    & %%e,99;K#!1!A!A3/"3"ln
 =O+49 01+0(,-r*   )r   zurn:ogc:def:ensemble:EPSG::6326N	r+   r,   r-   r.   r  rE   r   r&   r/   r0   s   @r)   r   r     sO     SO  6%)	 . .  . d
	 .
 
 .  .r*   r   c                   H     e Zd ZdZdZ	 	 d
dedededz  deddf
 fd	Z x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   r3   c           	         dd|t         j                  |      j                         t        j                  |      j                         t	        j                  |xs
 t                     j                         d}t        |   |       y)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  r  r   r   r   r   N)rz   r   r   r
   r   r   r%   r&   )r'   r   r   r   r   derived_geographic_crs_jsonr(   s         r)   r&   zDerivedGeographicCRS.__init__?  sv    0 L*++H5BBD-==ln!1!A!A3/"3"ln'
# 	45r*   )Nr   	r+   r,   r-   r.   r  r   rE   r&   r/   r0   s   @r)   r   r   2  sU    O &*#6#6 #6 d
	#6
 #6 
#6 #6r*   r   c                   :     e Zd ZdZdZ	 	 ddededdf fdZ xZS )	GeocentricCRSzR
    .. versionadded:: 3.2.0

    This class is for building a Geocentric CRS
    )zGeocentric CRSr   r   r3   Nc                     dd|t        j                  |      j                         ddddddd	d
ddddddddgdd}t        |   |       y)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  r  r   r   r   N)r   r   r   r%   r&   )r'   r   r   geocentric_crs_jsonr(   s       r)   r&   zGeocentricCRS.__init__n  s     M!**51>>@& !/(+%2 '	 !/(+%2 '	 !/(+%2 '	"
: 	,-r*   )r   zurn:ogc:def:datum:EPSG::6326r  r0   s   @r)   r  r  e  s=     *O  3+.+. +. 
	+. +.r*   r  c                   P     e Zd ZdZdZ	 	 	 d
dedededz  dedz  ddf
 fd	Z xZS )r   zR
    .. versionadded:: 2.5.0

    This class is for building a Projected CRS.
    )zProjected CRSzDerived Projected CRSNr   r   r   r   r3   c           	      ,   dd|t         j                  |xs
 t                     j                         t	        j                  |      j                         t        j                  |xs
 t                     j                         d}t        | !  |       y)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   r  N)	rz   r   r   r   r
   r   r   r%   r&   )r'   r   r   r   r   proj_crs_jsonr(   s         r)   r&   zProjectedCRS.__init__  s{    0 L"++/ln-==ln!1!A!A/"ln
 	'r*   )r   NNr  r0   s   @r)   r   r     s]     AO
  #'#'%(%( %( Dj	%(
 Dj%( 
%( %(r*   r   c                   N     e Zd ZdZdZ	 	 d
dedededz  dedz  ddf
 fd	Z xZS )r   z
    .. versionadded:: 2.5.0

    This class is for building a Vertical CRS.

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

    )zVertical CRSNr   r   r   r   r3   c                     dd|t        j                  |      j                         t        j                  |xs
 t	                     j                         d}|d|i|d<   t
        |   |       y)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   r  Nr   r   )r   r   r   r   r   r%   r&   )r'   r   r   r   r   vert_crs_jsonr(   s         r)   r&   zVerticalCRS.__init__  sp    , L!**51>>@!1!A!A+z|"ln
 ",2K+@M-('r*   )NNr  r0   s   @r)   r   r     sY     (O #'"&!(!( !( 4Z	!(
 4Z!( 
!( !(r*   r   c                   :     e Zd ZdZdZdedee   ddf fdZ xZ	S )r   zQ
    .. versionadded:: 2.5.0

    This class is for building a Compound CRS.
    )zCompound CRSr   r   r3   Nc           	          dd||D cg c]%  }t         j                  |      j                         ' c}d}t        |   |       yc c}w )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   )r  r  r   r   N)rz   r   r   r%   r&   )r'   r   r   	componentcompound_crs_jsonr(   s        r)   r&   zCompoundCRS.__init__  sX     L! ", ##I.;;=	
 	*+s   *A
)
r+   r,   r-   r.   r  rE   rB   r   r&   r/   r0   s   @r)   r   r     s2     (O,S ,d3i ,D , ,r*   r   c                   8     e Zd ZdZdZdedededdf fdZ xZS )	r   zN
    .. versionadded:: 2.5.0

    This class is for building a Bound CRS.
    )z	Bound CRSr   r   r   r3   Nc                     ddt         j                  |      j                         t         j                  |      j                         t        j                  |      j                         d}t        |   |       y)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  r  r   r   r   N)rz   r   r   r
   r%   r&   )r'   r   r   r   bound_crs_jsonr(   s        r)   r&   zBoundCRS.__init__&  sh     L--j9FFH--j9FFH1AAln
 	(r*   )r+   r,   r-   r.   r  r   r&   r/   r0   s   @r)   r   r     s6     %O)3 )C ) )QU ) )r*   r   )T)Cr.   r?   rR   	threadingrZ   collections.abcr   typingr   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   compiler  r   localr!   r>   r  rE   rL   ra   rG   ru   rn   rr   rx   rz   r  r   r   r  r   r   r   r   rm   r*   r)   <module>r     sw    	   $       B S S 0 &  DD	
y 
24 2T 2S 2,#S #S #L  (&s &sSy &6#) 6S T [
 [
|.@/3 @/F).( ).X06/ 06f4.( 4.n.(' .(b-(& -(`,& ,@)# )r*   