
    rbi                        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j+        dej,                  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;          ZBdS )/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                 V    d | _         t                                                       d S N)crssuper__init__)self	__class__s    ^/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/pyproj/crs/crs.pyr&   zCRSLocal.__init__>   s&        )__name__
__module____qualname____doc__r&   __classcell__r(   s   @r)   r!   r!   6   sB                 r*   r!   T
projparams
allow_jsonreturnc                 2   t          | t                    st          d          d| vrd| vr|rt          j        |           S g }|                                 D ]\  }}t          |t          t          f          rd                    d |D                       }|t          |          dk    r|
                    d|            nt          |          dk    r|
                    d| d	|            t          d
                    |                    S )NzCRS input is not a dictprojinit,c                 ,    g | ]}t          |          S  )str).0vals     r)   
<listcomp>z&_prepare_from_dict.<locals>.<listcomp>N   s    8883c#hh888r*   True+False= )
isinstancedictr   jsondumpsitemslisttuplejoinr:   append_prepare_from_string)r1   r2   pjargskeyvalues        r)   _prepare_from_dictrP   C   s+   j$'' 20111ZF*$<$<$<z*%%%F &&(( 
- 
-
UedE]++ 	:HH88%88899E=CJJ&00MM)c))$$$$ZZ7""MM+c++E++,,,, 0 0111r*   in_crs_stringc                 F   t          j        dd|                                           } d}|                     |          sug }d}|                                 D ]G}|s.|                    |          r|                    d|           d}2|                    |           Hd                    |          } d| vrd	| v r| d
z  } n| dz  } |                     dd          	                                } |                     d          rt          j        dt          d           | S )Nz[\s+]?=[\s+]?rA   )+initz+projr6   r5   Fr   TrB   ztype=crsr?   z
 +type=crsz	 type=crsz
+init=EPSGz
+init=epsg)rS   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insertrK   rJ   replacestripwarningswarnFutureWarning)rQ   starting_paramskvpairsfirst_item_insertedkvpairs        r)   _prepare_from_proj_stringre   Y   sY   F+S-2F2F2H2HIIM8O##O44 	*##))++ 	' 	'F& 'F,=,=o,N,N 'q&)))&*##v&&&&)) &&-\)MM[(M ")),EEKKMMM 122 	
,
 	
 	
 	
 	
 r*   c                 p   t          | t                    st          d          | st          d|           d| v r[	 t          j        | d          }n"# t
          $ r}t          d          |d }~ww xY w|st          d          t          |          } nt          |           rt          |           } | 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)	rC   r:   r   rE   loads
ValueErrorrP   r   re   )rQ   crs_dicterrs      r)   rL   rL      s    mS)) 42333 MK-KKLLL
m	Oz->>>HH 	O 	O 	ODEE3N	O  	0.///*844			 A1-@@s   A 
A4A//A4	auth_name	auth_codec                     |  d| S )N:r9   )rm   rn   s     r)   _prepare_from_authorityrq      s    %%)%%%r*   c                 "    t          d|           S )NEPSG)rq   rn   s    r)   _prepare_from_epsgru      s    "69555r*   c                     t          | t                    rdS t          | t                    r|                                 rdS t	          | d          r| j        dk    rdS dS )NTshaper9   F)rC   intr:   	isnumerichasattrrw   rt   s    r)   _is_epsg_coder{      sk    )S!! t)S!! i&9&9&;&; ty'"" y"'<'<t5r*   c                      e Zd ZdZd\d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j        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j        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dAZ=e>j?        fd:e>e
z  de	fdBZ@d`dDe
de
dz  fdEZAdade	dz  dDe
fdFZB	 dade	dz  dDe
deeC         fdGZDd\dHe	dz  dd fdIZEd\dHe	dz  dd fdJZFedefdK            ZGedefdL            ZHedefdM            ZIedefdN            ZJedefdO            ZKedefdP            ZLedefdQ            ZMedR             ZNedefdS            ZOded          fdTZPd&eQdefdUZRdee	e	f         fdVZSdWee	ef         fdXZTde
fdYZUde	fdZZVde	fd[ZWdS )b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          |          }nt          |t                    rt          |          }npt          |t          t          f          rt          |          dk    r
t          | }n7t          |d          r|                                }nt          d|          |r5t          |d          }t          d                    ||f                    }|| _        t#                      | _        t          |t                    r|| 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
         rT   to_wktzInvalid CRS input: F)r2   rB   N)rC   r   srsr{   ru   r:   rL   rD   rP   rH   rI   lenrq   rz   r   r   rJ   r!   _localr$   )r'   r1   kwargs
projstring
projkwargss        r)   r&   zCRS.__init__   s   T 
 	E*d++ E'^

z** E/
;;

J,, 	E1*==

J-- E/
;;

Ju66 E3z??a;O;O4jA

X.. E'..00

CZCCDDD 	R+FuEEEJ-chh
J7O.P.PQQJjjj$'' 	-(DKOOO"48nnDKOOOr*   c                 n    | 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`  s)    
 ;?""48nnDKO{r*   rm   codec                 H    |                      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_inputrq   )clsrm   r   s      r)   from_authorityzCRS.from_authorityi  s#    $ ""#:9d#K#KLLLr*   c                 F    |                      t          |                    S )zMake a CRS from an EPSG code

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

        Returns
        -------
        CRS
        )r   ru   )r   r   s     r)   	from_epsgzCRS.from_epsg}  s!     ""#5d#;#;<<<r*   in_proj_stringc                     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   re   )r   r   s     r)   
from_proj4zCRS.from_proj4  sI      ~&& 	EC>CCDDD""#<^#L#LMMMr*   in_wkt_stringc                     t          |          st          d|           |                     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   rL   )r   r   s     r)   from_wktzCRS.from_wkt  sI      m$$ 	CA-AABBB""#7#F#FGGGr*   rQ   c                 F    |                      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   rL   )r   rQ   s     r)   from_stringzCRS.from_string  s!    ( ""#7#F#FGGGr*   c                 j    |                      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_confidencerp   )to_authorityrJ   r   )r'   	auth_infos     r)   	to_stringzCRS.to_string  s;     %%S%99	 	'88I&&&xr*   rO   c                 8    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
        )rC   )r   rO   r   s      r)   r   zCRS.from_user_input  s3    0 eS!! 	Ls5##F###r*   c                 t    | j         dS 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  s@     >!4n-~0n-
 
 
 	
r*   	proj_dictc                 F    |                      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   rP   )r   r   s     r)   	from_dictzCRS.from_dict  s!      ""#5i#@#@AAAr*   crs_jsonc                 F    |                      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*   rk   c                 P    |                      t          j        |                    S )z
        .. versionadded:: 2.4.0

        Create CRS from a JSON dictionary.

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

        Returns
        -------
        CRS
        )r   rE   rF   )r   rk   s     r)   from_json_dictzCRS.from_json_dict,  s"      ""4:h#7#7888r*   c                     |                                  }|i S d }i }t                              |          D ]/}|                                \  }}| ||          }|dur|||<   0|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.

        Nc                    |                                  dk    rdS |                                  dk    rdS 	 t          |           S # t          $ r Y nw xY w	 t          |           S # t          $ r Y nw xY wt	          |           S )NtrueTfalseF)lowerrx   rj   floatr   )r<   s    r)   _parsezCRS.to_dict.<locals>._parseS  s    yy{{f$$tyy{{g%%u3xx   Szz!   &s+++s#   A 
AAA% %
A21A2F)to_proj4_RE_PROJ_PARAMfinditergroups)r'   proj_stringr   r   paramrN   rO   s          r)   to_dictzCRS.to_dict>  s    " mmooI	, 	, 	, 	#,,[99 	' 	'EJC uE!!!&	#r*   Fwkt_versionerrcheckc                    d|                      |          i}| j        rq| j        rj| j        j        r^| j        rW| j                            ||          }|                    d           |                    |           | j        j        |d<   |S | j        rM| j	        D ]C}|                    ||          }|                    d           |                    |           D|S | j
        rA|                                 }d|v r|d         d         |d<   | j        r| j        j        |d<   |S | j        rE|                    | j        j        | j        j        | j        j                   | 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                                        t0          vr-|r!t3          j        d| j        j                    d|d         iS |                    t1          | j        j                                                 | j                             nd|d<   |S d}| j        s| j        r| j        }| j        |d<   |sdn,|j                                                            dd          }|t:          vr?|r3|rt3          j        d|j                    nt3          j        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_namerB   _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   r^   r_   is_projectedr\   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.F"G M	)	 )1	 		 &*_%:%:'! &; & &F JJy!!!NN6"""!%!:!BGIN  	, ' ' ;RR

9%%%v&&&&N  	))++I	))(1-(@(H%z E59Z_12N > 	FNN $ ? $ ?#'>#D    
 37.2EG./ 	F595H5RG12-1-@-EG)*  	P-1->-CG)* & P373D3J3O/0 	( D-9??AADE E    G#8DG G   &wy'9::=1=CCEE/1 1    0D+,N  $} 	6!2 	6#'#< ,0IG() (LDD%17799AA#sKK 	"
 %,JJJ E' EM>/;> >   
 M"CDDDwy122*+DE$ 	
 	
 	

 r*   in_cfellipsoidal_cscartesian_csvertical_csc                 h   d}d| v rt          | d                   S d| v rt          | d                   S |                     d          }|t          d          t          |           }	 t          |         }n# t
          $ r d}Y nw xY w|                     d          }|rt          |pd||	          }	nt|rb||vr^t          |          }	|L|	                                }
t          j	        |                                          |
d
<   t          |
          }	nt          |          }	|dk    r|	S |t          |	 ||           |          S 	 t          |         }n!# t
          $ r t          d|           dw xY wt          |                     dd           ||           |	|          }d}d| v r5t          |dt          |j        gt!          | d                   R            }d| vr|p|S t#          d| d         |                     d          |          }t%          d|p||g          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)r}   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  s   P 1uY'(((E!!u]+,,,!II&9::$QRRR .e44	012CD )(  	0 	0 	0+/(((	0 $ii(=>> 	J"/(7K-# # #NN
 ! 		J%8%M%M !455N)&4&A&A&C&C#$4^DDQQSS $$78 "%%8!9!9*.IIIN 444!!'3''77>>-   	 67H I 	 	 	E2CEE 	 %/==((//'%	
 
 
 	 (#4!. 1DU9EU1V1V       I %E11-- #12		,//#	
 
 
 )*D}l)S
 
 
 	
s   +A9 9BBE E=c                    g }d }| j         dk    r"| j        r| j                                        }|                    dd                                                              d          }t          |          dk    r| d}| j        d         }d	d	|                    d
d                                          	                    dd          dd}|j
                                        	                    d
d                                          }|r
| d| |d<   |                    |           | j        r8|                    | j                             ||                                n| j        rU| j        rN| j        j        rB|                    | j        j                             || j                                       n1| j        D ])}|                    |                                           *|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         o$| j         j                                        t          v S # t          $ r Y dS w xY w)NF)r   r   r   r   r   )r$   s    r)   rotated_polez"CRS.cs_to_cf.<locals>.rotated_pole~  sZ    , A0<BBDD@A
    uus   +. 
<<zTemporal CRStime_originz
1875-05-20zZ   z-01-01r   timecalendarproleptic_gregorianrB   r   T)standard_name	long_namer  axisr   z since units)r  )	type_namer   r   r   r]   rstripr   	axis_infor   r\   	unit_namerK   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  s2    	 	 	 >^++
+0022J^^M<@@FFHHOOPTUUF6{{a"***>!$D!'#NN:/DEEUWWWS#&&	  	  ,,..66z2FFLLNNI J/8,I,I,I,I ) 0111! 	8&,,,,t:L:L,MM    ] 	8t 	84?3T 	8177!-do!>!> 8       , 8 8##G$4$4$6$67777r*   otherc                     	 t                               |          }n# t          $ r Y dS w xY 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)r}   r   r   r   is_exact_samer'   r"  s     r)   r$  zCRS.is_exact_same  sV    	''..EE 	 	 	55	y&&uz222    
++ignore_axis_orderc                     	 t                               |          }n# t          $ r Y dS w xY w| j                            |j        |          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'  )r}   r   r   r   equals)r'   r"  r'  s      r)   r)  z
CRS.equals  s\    (	''..EE 	 	 	55	y
>OPPPr&  c                 \    | j         j        dn|                     | 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/     y%- D	 677	
r*   c                 \    | j         j        dn|                     | 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/     y#+ D	 455	
r*   c                 \    | j         j        dn|                     | 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/     y#+ D	 455	
r*   c                 4      f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                 :    g | ]}                     |          S r9   r0   )r;   r   r'   s     r)   r=   z$CRS.sub_crs_list.<locals>.<listcomp>  s%    NNNGw''NNNr*   r   r   r   s   `r)   r   zCRS.sub_crs_list  s%     ONNNty7MNNNNr*   c                 :   | j         r| j        r| j        j        S | j        r| j        D ]}|j        r	|j        c S n^| j        rWd| j        j                                        v r7| 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
        -------
        str | None:
            The UTM zone number and letter if applicable.
        zUTM ZONEz	UTM ZONE N)r   r   utm_zoner   r   r   upperrZ   )r'   r   s     r)   r6  zCRS.utm_zone  s     = 	,T_ 	,?++ 	Q, , ,# ,"++++,, %	Qd7<BBDDDD,17799??LLRPPtr*   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     y~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     y""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     y""r*   c                     | j         j        S )z{
        Returns
        -------
        AreaOfUse:
            The area of use object with associated attributes.
        )r   area_of_user   s    r)   r<  zCRS.area_of_useS  s     y$$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     y""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       y''r*   c                     | j         j        S )zX
        .. versionadded:: 2.2.0

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

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

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

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

        Returns
        -------
        str:
            Scope of object.
        )r   scoper   s    r)   rF  z	CRS.scope  s     yr*   versionprettyoutput_axis_rulec                 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
        )rG  rH  rI  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   r   r   )r'   rG  rH  rI  wkts        r)   r   z
CRS.to_wkt  sc    D iF=M  
 
 ;O O O O   
r*   rT   indentationc                 `    | 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
        )rH  rL  Nz.CRS cannot be converted to a PROJ JSON string.)r   to_jsonr   )r'   rH  rL  	proj_jsons       r)   rN  zCRS.to_json  s9    " I%%V%MM	KLLLr*   c                 4    | 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     y%%'''r*   c                 ^    | 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
        )rG  Nz)CRS cannot be converted to a PROJ string.)r   r   r   )r'   rG  r5   s      r)   r   zCRS.to_proj4  s5    & y!!'!22<FGGGr*   F   r   c                 8    | 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)   rT  zCRS.to_epsg  s    F y   ???r*   c                 :    | 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.
        rm   r   )r   r   r'   rm   r   s      r)   r   zCRS.to_authority9  s)    L y%% & 
 
 	
r*   c                 :    | 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.
        rV  )r   list_authorityrW  s      r)   rY  zCRS.list_authorityc  s)    P y'' ( 
 
 	
r*   r   c                 ^    |                      | 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)   r]  z	CRS.to_3d  s&    ( ~~dioo4o88999r*   c                 ^    |                      | 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
        r\  )r(   r   to_2dr^  s     r)   r`  z	CRS.to_2d  s&     ~~dioo4o889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     y&&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     y%%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     y$$r*   c                     | j         j        S )zY
        Returns
        -------
        bool:
            True if CRS is bound.
        )r   r   r   s    r)   r   zCRS.is_bound  s     y!!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     y$$r*   c                     | j         j        S )z
        .. versionadded:: 2.2.0

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

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

        Check if the CRS is deprecated

        Returns
        -------
        bool
        )r   is_deprecatedr   s    r)   rn  zCRS.is_deprecated   rj  r*   c                 4    | 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)   rp  zCRS.get_non_deprecated-  s     y++---r*   c                 ,    |                      |          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    tx  r*   statec                 `    | j                             |           t                      | _        d S r#   )__dict__r   r!   r   )r'   rv  s     r)   __setstate__zCRS.__setstate__?  s'    U###jjr*   c                 D    t          |                                           S r#   )hashr   r   s    r)   __hash__zCRS.__hash__C  s    DKKMM"""r*   c                     | j         S r#   rt  r   s    r)   __str__zCRS.__str__F  s	    xr*   c                    g }| j         D ]'}|                    dt          |          dg           (d                    |          }d}d}| j        r!| j        j        rt          | j                  }n| j        r1| j        r*t          | j        j                  }d| j        j         d}n}g }dg}| j	        D ]F}	|
                    t          |	j                             |                    d|	j        dg           Gd                    |          }d                    |          }d}
| j        r7d                    ddt          | j                  d	| j        j        dg          }
|                                 }t          |          d
k    r|nd                    |d d
         dg          }|pd}d| j         d| d| j         d|pd d| d| j        pd d|
 d| j         d| j        pd d| j        pd d| | S )Nz- 
r   zSource CRS: z	Sub CRS:
|zCoordinate Operation:
z- name: z
- method: 2   rB   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  r:   rJ   r   	axis_listr   r   r   r   rK   r   r   r   r   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_reprs               r)   __repr__zCRS.__repr__I  s   $&N 	; 	;D!!4TD"9::::// ! 	6d&<&F 	6%()?%@%@""] 
	6t 
	6%()J%K%K"ET_-AEEEOO&(#!-, E E'..s73L/M/MNNN!(($d)CDDDD%(XX.E%F%F"77#455L  "$ 
	#%77-122"-9	$ 	$  >>##"8}}2288(3B3-QVAW8X8X%8  (  Y 0?K   
 0=  $  j  !N9k  "&!4!C    	
r*   r#   )NNN)F)FrT   )rR  )NrR  )Xr+   r,   r-   r.   r   r&   propertyr   classmethodr:   rx   r   r   r   r   r   r   r   r   r   rD   r   r   r   r   r   	WKT2_2019boolr   staticmethodr	  rH   r  r$  r)  r   r   r   r   r   r6  r   r  r	   r  r   r<  r   r   r   r   r   r   r   r   r
   r   rD  rF  r   rN  r   r   PROJ_5r   rT  r   r   rY  r]  r`  r   r   r   r   r   rg  ri  rl  rn  rp  objectrr  ru  ry  r|  r~  r  r9   r*   r)   r}   r}      sm
        &e- e-3: e-4 e- e- e- e-N   X Ms M#) M M M M [M& =S3Y =5 = = = [= N N N N N [N& HS HU H H H [H& H H H H H [H*3    & $C $e $ $ $ [$6
$+ 
 
 
 
 B$ B5 B B B [B" > > > > > [>" 9d 9u 9 9 9 [9", , , , ,` )3(<A A#%A A 
	A A A AF  &*#'"&	|
 |
|
d
|
 Dj|
 4Z	|

 
|
 |
 |
 \|
|<$t* < < < <|33 34 3 3 3 3*Q QC QD QT Q Q Q Q4 
huo 
 
 
 X
  
HUO 
 
 
 X
 
HUO 
 
 
 X
  Od5k O O O XO #*    X0 c    X #3 # # # X# #4: # # # X# %Y- % % % X% 	#9t+ 	# 	# 	# X	# 	( 4 	( 	( 	( X	( ut|    X +#3d#: + + + X+ .&9D&@ . . . X. 	! 	! 	! 	! X	! 	s 	 	 	 X	 %/$8(,	* *c!* * +	*
 
* * * *X d  S    ,
(d 
( 
( 
( 
( 5@4F  c 1 3    0#@ #@c #@3: #@ #@ #@ #@J(
 (
cDj (
 (
 (
 (
 (
V CE*
 *
t*
<?*
	 	!*
 *
 *
 *
X: :#* : : : : :,: :#* : : : : :" 't ' ' ' X' &d & & & X& %T % % % X%  "$ " " " X" 	%T 	% 	% 	% X	% 	( 	( 	( 	( X	( 
't 
' 
' 
' X
' 	$ 	$ X	$ 
't 
' 
' 
' X
'
.DK 
. 
. 
. 
."F "t " " " "!d38n ! ! ! !!$sCx. ! ! ! !## # # # #    7
# 7
 7
 7
 7
 7
 7
r*   r}   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                 b    | 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  r  r   r   s    r)   _check_typez CustomConstructorCRS._check_type  sI    
 >!555RRR4;ORRR   65r*   rO   r}   c                     t          ||           r|S |                     |           } t          t          |          j        |fi | |                                 |S r   )rC   __new__r%   r  r&   r  )r   rO   r   r$   r(   s       r)   r   z$CustomConstructorCRS.from_user_input  sh    0 eS!! 	Lkk#1"C((1%BB6BBB
r*   c                 P    | j         j        dnt          | j         j                  S r+  )r   r   r}   r   s    r)   r   z!CustomConstructorCRS.geodetic_crs  s%     y-5tt3ty?U;V;VVr*   c                 P    | j         j        dnt          | j         j                  S r-  )r   r   r}   r   s    r)   r   zCustomConstructorCRS.source_crs  s%     y+3ttTY=Q9R9RRr*   c                 P    | j         j        dnt          | j         j                  S r/  )r   r   r}   r   s    r)   r   zCustomConstructorCRS.target_crs  s%     y+3ttTY=Q9R9RRr*   c                 .    d | j         j        D             S )r1  c                 ,    g | ]}t          |          S r9   )r}   )r;   r   s     r)   r=   z5CustomConstructorCRS.sub_crs_list.<locals>.<listcomp>  s    CCCGCCCr*   r3  r   s    r)   r   z!CustomConstructorCRS.sub_crs_list  s     DCDI,BCCCCr*   Nr   c                 R    t          | j                            |                    S r[  )r}   r   r]  r^  s     r)   r]  zCustomConstructorCRS.to_3d  s"    ( 49???--...r*   r#   )r+   r,   r-   r.   r  rI   r:   r  r  r  r   r   r   r   r   r   rH   r   r]  r/   r0   s   @r)   r  r    s         "sCx " " " X"   C e      [< 
Whuo 
W 
W 
W X
W 	SHUO 	S 	S 	S X	S 
SHUO 
S 
S 
S X
S Dd5k D D D X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 CRSr   urn:ogc:def:ensemble:EPSG::6326Nr   r   r   r3   c                 6   t          j        |                                          }dd|t          j        |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   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3/"3"3" "lnn
 
 =O++49 011+0(,-----r*   )r   r  N	r+   r,   r-   r.   r  r:   r   r&   r/   r0   s   @r)   r   r     s          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   r   r3   c           	      \   dd|t                               |                                          t          j        |                                          t	          j        |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  r  r   r   r   r   N)r}   r   r   r
   r   r   r%   r&   )r'   r   r   r   r   derived_geographic_crs_jsonr(   s         r)   r&   zDerivedGeographicCRS.__init__?  s    0 L*++H55BBDD-= lnn!1!A3/"3"3" "lnn'
 '
# 	455555r*   )Nr   	r+   r,   r-   r.   r  r   r:   r&   r/   r0   s   @r)   r   r   2  s         O &*#6 #6#6 #6 d
	#6
 #6 
#6 #6 #6 #6 #6 #6 #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   urn:ogc:def:datum:EPSG::6326r   r   r3   Nc                     dd|t          j        |                                          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  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1>>@@& !/(+%2 '	  !/(+%2 '	  !/(+%2 '	 " "
 
: 	,-----r*   )r   r  r  r0   s   @r)   r  r  e  sw          *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 CRSr   Nr   r   r   r   r3   c           	      x   dd|t                               |pt                                                                t	          j        |                                          t          j        |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   r  N)	r}   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"++/ lnn-= lnn!1!A/" "lnn
 
 	'''''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        |                                          t          j        |pt	                                                                d}|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   r  Nr   r   )r   r   r   r   r   r%   r&   )r'   r   r   r   r   vert_crs_jsonr(   s         r)   r&   zVerticalCRS.__init__  s    , L!*511>>@@!1!A+z||" "lnn
 
 ",2K+@M-('''''r*   )NNr  r0   s   @r)   r   r     s          (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                 l    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                 f    g | ].}t                               |                                          /S r9   )r}   r   r   )r;   	components     r)   r=   z(CompoundCRS.__init__.<locals>.<listcomp>  sB        ##I..;;==  r*   )r  r  r   r   N)r%   r&   )r'   r   r   compound_crs_jsonr(   s       r)   r&   zCompoundCRS.__init__  sY     L! !+  	
 
 	*+++++r*   )
r+   r,   r-   r.   r  r:   rH   r   r&   r/   r0   s   @r)   r   r     sg          (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                 J   ddt                               |                                          t                               |                                          t          j        |                                          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  r  r   r   r   N)r}   r   r   r
   r%   r&   )r'   r   r   r   bound_crs_jsonr(   s        r)   r&   zBoundCRS.__init__&  s     L--j99FFHH--j99FFHH1A lnn
 
 	(((((r*   )r+   r,   r-   r.   r  r   r&   r/   r0   s   @r)   r   r     sk          %O)3 )C ) )QU ) ) ) ) ) ) ) ) ) )r*   r   )T)Cr.   rE   rV   	threadingr^   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!   rD   r  r:   rP   re   rL   rx   rq   ru   r{   r}   r  r   r   r  r   r   r   r   r9   r*   r)   <module>r     ss     				      $ $ $ $ $ $                                                           B A A A A A S S S S S S S S S S 0 0 0 0 0 0 0 0 & & & & & &       D	 	
 
 
 
 
y 
 
 
2 24 2T 2S 2 2 2 2,#S #S # # # #L     (&s &sSy & & & &6#) 6 6 6 6S T    [
 [
 [
 [
 [
 [
 [
 [
|.@/ @/ @/ @/ @/3 @/ @/ @/F). ). ). ). ).( ). ). ).X06 06 06 06 06/ 06 06 06f4. 4. 4. 4. 4.( 4. 4. 4.n.( .( .( .( .(' .( .( .(b-( -( -( -( -(& -( -( -(`, , , , ,& , , ,@) ) ) ) )# ) ) ) ) )r*   