
    \iGk                        S r SSKrSSKJrJrJr  SSKJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  SSKJrJrJr  SSKJr  S r S r!S	 r"S
 r#S r$S r%S r&S r'S r(S r)S r*S r+S r,S r-S r.S r/S r0S r1\#\$\%\&\'\(\)\*\+\,\-\.\/\0S.r2S\10r3S r4S r5S r6S r7S r8S  r9S! r:S" r;S# r<S$ r=S% r>S& r?S' r@S( rAS) rBS* rCS+ rD0 S,\5_S-\6_S.\6_S/\7_S0\7_S1\8_S2\9_S3\9_S4\:_S5\;_S6\;_S7\<_S8\=_S9\>_S:\>_S;\?_S<\@_\A\BS=.ErE\C\C\C\C\DS>.rFg)?z
This module contains mappings necessary to convert from
a CRS to a CF-1.8 compliant projection.

http://cfconventions.org/cf-conventions/cf-conventions.html#appendix-grid-mappings

    N)Datum	EllipsoidPrimeMeridian)AlbersEqualAreaConversionAzimuthalEquidistantConversion GeostationarySatelliteConversion HotineObliqueMercatorBConversion#LambertAzimuthalEqualAreaConversion"LambertConformalConic1SPConversion"LambertConformalConic2SPConversion%LambertCylindricalEqualAreaConversion*LambertCylindricalEqualAreaScaleConversionMercatorAConversionMercatorBConversionOrthographicConversionPolarStereographicAConversionPolarStereographicBConversionPoleRotationNetCDFCFConversionSinusoidalConversionStereographicConversionTransverseMercatorConversionVerticalPerspectiveConversion)CustomDatumCustomEllipsoidCustomPrimeMeridian)CRSErrorc           	         U R                  S5      nU(       a  US;  a   [        R                  " U5      $ S nU R                  S5      n [	        U=(       d    SU R                  S5      U R                  S5      U R                  S5      U R                  S5      S	9nS nU R                  S
5      n [        U=(       d    SU S   S9nU(       d  U(       a&  [        U=(       d    SU=(       d    SU=(       d    SS9$ g ! [         a     Nf = f! [         a&    U(       a  US;  a  [
        R                  " U5      n Nf = f! [         a&    U(       a  US;  a  [        R                  " U5      n Nf = f)Nhorizontal_datum_name)	undefinedunknownreference_ellipsoid_namer   semi_major_axissemi_minor_axisinverse_flatteningearth_radius)namer"   r#   r$   radiusprime_meridian_namelongitude_of_prime_meridian)r&   	longitudezWGS 84	Greenwich)r&   	ellipsoidprime_meridian)
getr   	from_namer   r   r   r   KeyErrorr   r   )	cf_params
datum_namer,   ellipsoid_namer-   r(   s         T/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/pyproj/crs/_cf1x8.py_horizontal_datum_from_paramsr5   %   sj   67Jj(@@	??:.. I]]#=>N
<#.;%MM*;<%MM*;<(}}-AB==0
	 N#--(=>J,$3 =>
 N*{+8)8[
 	

 I  		  <n4LL!++N;I<  J#6>V#V*445HINJs6   C; 
AD 0D> ;
DD-D;:D;>-E.-E.c                     [        U [        5      (       d  U $ U R                  S5      n[        U5      S:  a*  U Vs/ s H  n[	        UR                  5       5      PM     sn$ U $ s  snf )z5
Attempt to convert string to list if it is a string
,   )
isinstancestrsplitlenfloatstrip)	input_str	val_splitsvals      r4   _try_list_if_stringrB   Q   s\     i%%$I
9~09:	djjl#	:: ;s   #A$c                 f    [        U 5      n  [        U 5      nS nX4$ ! [         a	    U u  p X4$ f = f)N)rB   r=   	TypeError)standard_parallelfirst_parallelsecond_parallels      r4   _get_standard_parallelsrH   ]   sR    +,=><01 **  <*;'**<s    00c                     [        U S   5      u  p[        UU=(       d    SU R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )zP
http://cfconventions.org/cf-conventions/cf-conventions.html#_albers_equal_area
rE           latitude_of_projection_originlongitude_of_central_meridianfalse_eastingfalse_northinglatitude_first_parallellatitude_second_parallellatitude_false_originlongitude_false_origineasting_false_originnorthing_false_origin)rH   r   r.   r1   rF   rG   s      r4   _albers_conical_equal_arearW   g   so     '>%&'#N % .!0!7C'mm,KSQ(}}-LcR&]]?C@'mm,<cB     c           	          [        U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )S
http://cfconventions.org/cf-conventions/cf-conventions.html#azimuthal-equidistant
rK   rJ   longitude_of_projection_originrM   rN   latitude_natural_originlongitude_natural_originrM   rN   )r   r.   r1   s    r4   _azimuthal_equidistantr`   x   sM     * ).Ms S!*/OQT!UmmOS9 }}%5s;	 rX   c                     U S   n[        UU S   U R                  SS5      U R                  S	S5      U R                  S
S5      U R                  SS5      S9$ ! [          a    SSS.U S   R                  5          n Nvf = f)W
http://cfconventions.org/cf-conventions/cf-conventions.html#_geostationary_projection
sweep_angle_axisyx)re   rd   fixed_angle_axisperspective_point_heightrK   rJ   r[   rM   rN   )rc   satellite_heightr]   r^   rM   rN   )r0   lowerr   r.   )r1   rc   s     r4   _geostationaryrj      s    W$%78 ,)"#=> ).Ms S!*/OQT!UmmOS9 }}%5s;   W!$3/	:L0M0S0S0UVWs   A #A>=A>c           	          [        U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )Z
http://cfconventions.org/cf-conventions/cf-conventions.html#lambert-azimuthal-equal-area
rK   rJ   r[   rM   rN   r\   )r
   r.   r_   s    r4   _lambert_azimuthal_equal_arearm      sM     / ).Ms S!*/OQT!UmmOS9 }}%5s;	 rX   c                 <   [        U S   5      u  pUbN  [        UUU R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ [        UU R                  SS5      U R                  SS5      U R                  SS5      S9$ )	P
http://cfconventions.org/cf-conventions/cf-conventions.html#_lambert_conformal
rE   rK   rJ   rL   rM   rN   rO   r\   )rH   r   r.   r   rV   s      r4   _lambert_conformal_conicrp      s     '>%&'#N "1$2%4"+--0OQT"U#,==1PRU#V!*!D"+--0@#"F
 	
 . .!*/NPS!TmmOS9 }}%5s;	 rX   c           	      $   SU ;   a?  [        U S   U R                  SS5      U R                  SS5      U R                  SS5      S9$ [        U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )	]
http://cfconventions.org/cf-conventions/cf-conventions.html#_lambert_cylindrical_equal_area
!scale_factor_at_projection_originrL   rJ   rM   rN   )scale_factor_natural_originr^   rM   rN   rE   rP   r^   rM   rN   )r   r.   r   r_   s    r4   _lambert_cylindrical_equal_arearv      s     +i79(12U(V%.]]/& $--=$==)93?
 	
 1 ).A3 G!*/NPS!TmmOS9 }}%5s;	 rX   c           	      F   SU ;   aP  [        U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      U S   S9$ [        U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )	G
http://cfconventions.org/cf-conventions/cf-conventions.html#_mercator
rs   rE   rJ   r[   rM   rN   r]   r^   rM   rN   rt   ru   )r   r.   r   r_   s    r4   	_mercatorrz      s     +i7"$-MM2Es$K%.]]0#& $--=$==)93?(12U(V
 	
  ).A3 G!*/OQT!UmmOS9 }}%5s;	 rX   c                     [        U S   U S   U S   SU R                  SS5      U R                  SS5      U R                  SS5      S	9$ )
O
http://cfconventions.org/cf-conventions/cf-conventions.html#_oblique_mercator
rK   r[   azimuth_of_central_linerJ   rs         ?rM   rN   )latitude_projection_centrelongitude_projection_centreazimuth_projection_centre!angle_from_rectified_to_skew_gridscale_factor_projection_centreeasting_projection_centrenorthing_projection_centre)r	   r.   r_   s    r4   _oblique_mercatorr      s_     ,#,-L#M$-.N$O"+,E"F*-'0}}/(
 #,--"E#,==1A3#G
 
rX   c           	          [        U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )K
http://cfconventions.org/cf-conventions/cf-conventions.html#_orthographic
rK   rJ   r[   rM   rN   r\   )r   r.   r_   s    r4   _orthographicr      sM     " ).Ms S!*/OQT!UmmOS9 }}%5s;	 rX   c           
          SU ;   a2  [        U S   U S   U R                  SS5      U R                  SS5      S9$ [        U S   U S   U R                  SS5      U R                  SS5      U R                  SS	5      S
9$ )Q
http://cfconventions.org/cf-conventions/cf-conventions.html#polar-stereographic
rE   %straight_vertical_longitude_from_polerM   rJ   rN   )latitude_standard_parallellongitude_originrM   rN   rK   rs   r~   ry   )r   r.   r   r_   s    r4   _polar_stereographicr     s     i','01D'E&'NO#--=$==)93?	
 	
 ) )*I J!*+R!SmmOS9 }}%5s;$-MM/%
 rX   c                 x    [        U R                  SS5      U R                  SS5      U R                  SS5      S9$ )I
http://cfconventions.org/cf-conventions/cf-conventions.html#_sinusoidal
r[   rJ   rM   rN   )r^   rM   rN   )r   r.   r_   s    r4   _sinusoidalr     s>      !*/OQT!UmmOS9 }}%5s; rX   c           
          [        U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )	L
http://cfconventions.org/cf-conventions/cf-conventions.html#_stereographic
rK   rJ   r[   rM   rN   rs   r~   ry   )r   r.   r_   s    r4   _stereographicr   #  s^     # ).Ms S!*/OQT!UmmOS9 }}%5s;$-MM/%
 rX   c           
          [        U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )	R
http://cfconventions.org/cf-conventions/cf-conventions.html#_transverse_mercator
rK   rJ   rL   rM   rN    scale_factor_at_central_meridianr~   ry   )r   r.   r_   s    r4   _transverse_mercatorr   2  s^     ( ).Ms S!*/NPS!TmmOS9 }}%5s;$-MM.%
 rX   c           
          [        U S   U R                  SS5      U R                  SS5      U R                  SS5      U R                  SS5      S9$ )R
http://cfconventions.org/cf-conventions/cf-conventions.html#vertical-perspective
rg   rK   rJ   r[   rM   rN   )viewpoint_heightlatitude_topocentric_originlongitude_topocentric_originrM   rN   )r   r.   r_   s    r4   _vertical_perspectiver   A  sZ     )"#=>$-MM2QSV$W%.]],c&
  mmOS9 }}%5s; rX   c                 D    [        U S   U S   U R                  SS5      S9$ )K
http://cfconventions.org/cf-conventions/cf-conventions.html#_rotated_pole
grid_north_pole_latitudegrid_north_pole_longitudenorth_pole_grid_longituderJ   )r   r   r   )r   r.   r_   s    r4   _rotated_latitude_longituder   P  s2     *!*+E!F"+,G"H"+--0KS"Q rX   )albers_conical_equal_areaazimuthal_equidistantgeostationarylambert_azimuthal_equal_arealambert_conformal_coniclambert_cylindrical_equal_areamercatoroblique_mercatororthographicpolar_stereographic
sinusoidalstereographictransverse_mercatorvertical_perspectiverotated_latitude_longitudec                     0 nU R                    H9  nUR                  XR                  R                  5       R	                  SS5      '   M;     U$ )N _)paramsvaluer&   ri   replace)	operation
param_dictparams      r4   _to_dictr   q  sC    J!!;@;;
::##%--c378 "rX   c                 R    [        U 5      nSUS   US   4US   US   US   US   S.$ )	zQ
http://cfconventions.org/cf-conventions/cf-conventions.html#_albers_equal_area

r   !latitude_of_1st_standard_parallel!latitude_of_2nd_standard_parallellatitude_of_false_originlongitude_of_false_origineasting_at_false_originnorthing_at_false_origingrid_mapping_namerE   rK   rL   rM   rN   r   
conversionr   s     r4   !_albers_conical_equal_area__to_cfr   x  sX    
 j!F86767
 *00J)K)/0K)L 9: !;<
 
rX   c                 @    [        U 5      nSUS   US   US   US   S.$ )rZ   r   latitude_of_natural_originlongitude_of_natural_originrM   rN   r   rK   r[   rM   rN   r   r   s     r4   _azimuthal_equidistant__to_cfr     s>     j!F4)/0L)M*01N*O0 !12 rX   c                     [        U 5      nSnU R                  R                  5       R                  SS5      R	                  S5      (       a  SnSUUS   UR                  SS	5      US
   US   US   S.$ )rb   rd   r   r   z	(sweep_x)re   r   rh   r   rJ   r   rM   rN   )r   rc   rg   rK   r[   rM   rN   )r   method_nameri   r   endswithr.   )r   r   rc   s      r4   _geostationary__to_cfr     s     j!F##%--c37@@MM,,$*+=$> *04PRU)V*01N*O0 !12
 
rX   c                 @    [        U 5      nSUS   US   US   US   S.$ )rl   r   r   r   rM   rN   r   r   r   s     r4   $_lambert_azimuthal_equal_area__to_cfr     s>     j!F;)/0L)M*01N*O0 !12 rX   c                     [        U 5      nU R                  R                  5       R                  S5      (       a  SUS   US   4US   US   US   US   S	.$ SUS
   US   US   US   S.$ )ro   z(2sp)r   r   r   r   r   r   r   r   r   r   rM   rN   r   rE   rL   rM   rN   r   r   ri   r   r   s     r4   _lambert_conformal_conic__to_cfr     s     j!F##%..w77!::;:;" .44N-O-34O-P#$=>$%?@

 
	
 7#$@A)/0M)N0 !12 rX   c                 @    [        U 5      nSUS   US   US   US   S.$ )rr   r   r   r   rM   rN   r   r   r   s     r4   &_lambert_cylindrical_equal_area__to_cfr     s>     j!F=#$GH)/0M)N0 !12 rX   c                     [        U 5      nU R                  R                  5       R                  SS5      R	                  S5      (       a  SUS   US   US   US   US	   S
.$ SUS   US   US   US   S.$ )rx   r   r   z(variant_a)r   r   r   rM   rN   scale_factor_at_natural_origin)r   rE   r[   rM   rN   rs   r   )r   rE   r[   rM   rN   )r   r   ri   r   r   r   s     r4   _mercator__to_cfr     s     j!F##%--c37@@OO!+!'(D!E.45R.S#O4$%561702	
 		
 (#$GH*01N*O0 !12 rX   c                     [        U 5      nUS   S:w  a  [        R                  " S5         US   n US   nSUS	   US
   UUUS   US   S.$ ! [         a    US   n N-f = f! [         a    US   n N<f = f)r|   r   r   zDangle from rectified to skew grid parameter lost in conversion to CFazimuth_of_initial_lineazimuth_at_projection_centrescale_factor_on_initial_line!scale_factor_at_projection_centrer   latitude_of_projection_centrelongitude_of_projection_centreeasting_at_projection_centrenorthing_at_projection_centre)r   rK   r[   r}   rs   rM   rN   )r   warningswarnr0   )r   r   r}   rs   s       r4   _oblique_mercator__to_cfr     s     j!F12a7R	
I"()B"CX,23Q,R) 0)/0O)P*01Q*R#:-N >? !@A   I"()G"HI  X,23V,W)Xs"   A A" AA"A43A4c                 @    [        U 5      nSUS   US   US   US   S.$ )r   r   r   r   rM   rN   r   r   r   s     r4   _orthographic__to_cfr     s>     j!F+)/0L)M*01N*O0 !12 rX   c                     [        U 5      nU R                  R                  5       R                  S5      (       a  SUS   US   US   US   S.$ SUS   US	   US   US   US
   S.$ )r   z(variant b)r   latitude_of_standard_parallellongitude_of_originrM   rN   )r   rE   r   rM   rN   r   r   r   )r   rK   r   rM   rN   rs   r   r   s     r4   _polar_stereographic__to_cfr   '  s     j!F##%..}==!6!'(G!H5;<Q5R#O4$%56
 	
 3)/0L)M178U1V0 !12-34T-U rX   c                 8    [        U 5      nSUS   US   US   S.$ )r   r   r   rM   rN   )r   r[   rM   rN   r   r   s     r4   _sinusoidal__to_cfr   >  s5     j!F)*01N*O0 !12	 rX   c                 H    [        U 5      nSUS   US   US   US   US   S.$ )r   r   r   r   rM   rN   r   )r   rK   r[   rM   rN   rs   r   r   s     r4   _stereographic__to_cfr   K  sG     j!F,)/0L)M*01N*O0 !12-34T-U rX   c                 H    [        U 5      nSUS   US   US   US   US   S.$ )r   r   r   r   rM   rN   r   )r   rK   rL   rM   rN   r   r   r   s     r4   _transverse_mercator__to_cfr   Z  sG     j!F2)/0L)M)/0M)N0 !12,23S,T rX   c                 H    [        U 5      nSUS   US   US   US   US   S.$ )r   r   r   latitude_of_topocentric_originlongitude_of_topocentric_originrM   rN   )r   rg   rK   r[   rM   rN   r   r   s     r4   _vertical_perspective__to_cfr   i  sG     j!F3$*+=$>)/0P)Q*01R*S0 !12 rX   c                 >    [        U 5      nSUS   US   S-
  US   S.$ )r   r   o_lat_plon_0   o_lon_pr   r   r   r   r   r   s     r4   "_rotated_latitude_longitude__to_cfr  x  s7     j!F9$*9$5%+G_s%:%+I%6 rX   c                 8    [        U 5      nSUS   US   US   S.$ )zt
http://cfconventions.org/cf-conventions/cf-conventions.html#_rotated_pole

https://github.com/OSGeo/PROJ/pull/2835
r   z/grid_north_pole_latitude_(netcdf_cf_convention)z0grid_north_pole_longitude_(netcdf_cf_convention)z0north_pole_grid_longitude_(netcdf_cf_convention)r  r   r   s     r4   _pole_rotation_netcdf__to_cfr    s@     j!F9$*=%
 &,>&
 &,>&
 rX   albers_equal_areamodified_azimuthal_equidistantr   z!geostationary_satellite_(sweep_x)z!geostationary_satellite_(sweep_y)r   zlambert_conic_conformal_(2sp)zlambert_conic_conformal_(1sp)r   zmercator_(variant_a)zmercator_(variant_b)z#hotine_oblique_mercator_(variant_b)r   zpolar_stereographic_(variant_a)zpolar_stereographic_(variant_b)r   r   )r   r   )zproj ob_tran o_proj=longlatzproj ob_tran o_proj=lonlatzproj ob_tran o_proj=latlonzproj ob_tran o_proj=latlongz$pole rotation (netcdf cf convention))G__doc__r   pyproj._crsr   r   r   pyproj.crs.coordinate_operationr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   pyproj.crs.datumr   r   r   pyproj.exceptionsr   r5   rB   rH   rW   r`   rj   rm   rp   rv   rz   r   r   r   r   r   r   r   r   _GRID_MAPPING_NAME_MAP!_GEOGRAPHIC_GRID_MAPPING_NAME_MAPr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  _INVERSE_GRID_MAPPING_NAME_MAP)_INVERSE_GEOGRAPHIC_GRID_MAPPING_NAME_MAP rX   r4   <module>r     s;    7 7     * O N &)X	+"	$	0*,"	, "<3#$A7&E)!/#/1 $ !"=% !
&*428.
*":"$&C" :" ()>	"
 ()>" #$H" $%D" $%D" %&L" ," ," *+C" (" &'B" &'B"  $!"" *#"$ 78'" . $F"D"D#E,H- )rX   