
    !\i9                        S r SSKrSSKrSSKJrJr  SSKrSSKrSSKrSSK	J
r
  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJrJrJrJrJrJr  \R>                  " \ 5      r!\RD                  " SS9\RF                  \RH                  \RJ                  \RL                  " S\RN                  " SS9SS9\RL                  " SSSS9\RP                  \RL                  " SS\)SSS9\RL                  " SSSS\)SSS9\RT                  \RL                  " S\RV                  " \ V s/ s H  o RX                  PM     sn 5      SS SS!9\RL                  " S"SS\)S#S$9\RL                  " S%SS\)S&S$9\RL                  " S'\-S(S)S*9\RL                  " S+SS,S9\RL                  " S-S.S/S9\R\                  \R^                  \RL                  " S0S1S2S3S4S5S\S6S79	\RL                  " S8SS9S:9\R`                  S; 5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       5       r1gs  sn f )<z'rio warp: CLI for reprojecting rasters.    N)ceilfloor)CRS)setenv)CRSError)options)resolve_inout)_cb_key_val)Affine)	reproject
ResamplingSUPPORTED_RESAMPLINGtransform_boundsaligned_targetcalculate_default_transformzWarp a raster dataset.)
short_helpz--likeT)existszdRaster dataset to use as a template for obtaining affine transform (bounds and resolution), and crs.)typehelpz	--dst-crsz#Target coordinate reference system.)defaultr   z--src-bounds   zlDetermine output extent from source bounds: left bottom right top . Cannot be used with destination --bounds)nargsr   r   r   z--boundsz--dst-bounds
dst_boundszFDetermine output extent from destination bounds: left bottom right topz--resamplingnearestzResampling method.)r   r   r   show_defaultz--src-nodatazManually override source nodata)r   r   r   r   z--dst-nodataz$Manually override destination nodataz	--threads   zNumber of processing threads.)r   r   r   z*--check-invert-proj/--no-check-invert-projz6Constrain output to valid coordinate region in dst-crsz2--target-aligned-pixels/--no-target-aligned-pixelsFz/align the output bounds based on the resolutionz--toz--woz--transformer-optionz--warper-optionwarper_optionsz
NAME=VALUEz/GDAL warper and coordinate transformer options.)metavarmultiplecallbackr   z	--dry-runzXDo not create an output file, but report on its expected size and other characteristics.)is_flagr   c                 H   [        XUS9u  p![        U
   n
[        U	5      (       d  Sn	O[        U	5      S:X  a
  U	S   U	S   4OU	n	U(       a  U	(       d  [        R                  " S5      eU(       a2  XhXY4n[        S U 5       5      (       a  [        R                  " S5      eO7U(       a0  X4n[        S U 5       5      (       a  [        R                  " S	5      eU R                  S
      [        US9  [        R                  " US   5       nUR                  u  nnnnUR                  nUR                  SS5        U(       a  UUS'   U(       a  U(       a  [        R                  " S5      eU(       aQ  [        R                  " U5       nUR                  nUR                  nUR                  nUR                   nSSS5        GOUGb   ["        R$                  " U5      nU(       ag  Uu  nnU=(       d    UR                  n  [+        UR                  U/U Q76 u  n!n"n#n$[/        U#U!-
  [1        U5      -  SU!SU"U$-
  [1        U5      -  U$5      nGOjU(       d  U(       a  U	(       d  [        R                  " SSSS9eU(       a   [+        UR                  U/UQ76 u  n!n"n#n$OUu  n!n"n#n$[/        U	S   SU!SU	S   * U$5      n[3        [5        [7        U#U!-
  U	S   -  5      5      S5      n[3        [5        [7        U$U"-
  U	S   -  5      5      S5      nGO UR                  R8                  (       a2  UR:                  (       a!  UR:                  S   n%SUR:                  S   0n&O&UR                  n%UR                  R=                  5       n&[?        U%UUR                   UR                  4SU	0U&DUD6u  nnnGOU(       aU  UR                  nUu  nnU=(       d    UUUU4u  n'n(n)n*[/        U)U'-
  [1        U5      -  SU'SU(U*-
  [1        U5      -  U*5      nGOU(       d  U(       a  U	(       d-  UR                  R@                  UR                  RB                  * 4n	UR                  nU=(       d    Uu  n!n"n#n$[/        U	S   SU!SU	S   * U$5      n[3        [5        [E        U#U!-
  U	S   -  5      5      S5      n[3        [5        [E        U$U"-
  U	S   -  5      5      S5      nGOU	(       as  UR                  n[/        U	S   SUSU	S   * U5      n[3        [5        [E        UU-
  U	S   -  5      5      S5      n[3        [5        [E        UU-
  U	S   -  5      5      S5      nGOpUR                  nUR                  ) n+[F        RH                  RJ                  n,U+UU,-   UU,-   4-  u  n-n.U+UU,-   UU,-   4-  u  n/n0U+UU,-   UU,-   4-  u  n1n2U+UU,-   UU,-   4-  u  n3n4[M        U-U/U1U35      n5[3        U-U/U1U35      n6[M        U.U0U2U45      n7[3        U.U0U2U45      n8[O        U55      n5[7        U65      n6[O        U75      n7[7        U85      n8UU-
  U6U5-
  -  n9UU-
  U8U7-
  -  n:[3        U9U:5      n	[3        [5        [E        UU-
  U	-  5      5      S5      n[3        [5        [E        UU-
  U	-  5      5      S5      n[.        RP                  " UU5      [.        RR                  " X* 5      -  nU(       a  [U        WWWU	5      u  nnnUb  URW                  US9  Ub8  Uc&  URX                  S   c  [        R                  " S5      eURW                  US9  URW                  UWWWS9  SU;   a*  U[5        US   5      :  a  US	 [Z        R]                  S5        SU;   a*  U[5        US   5      :  a  US	 [Z        R]                  S5        URV                  " S$0 UD6  U(       a  UR_                  SS5      n;U;(       aG  UR                  Ra                  5       n<U<(       a	  SU< 3US'   OUR                  Rc                  5       US'   [        Rd                  " S5        [        Rd                  " [f        Rh                  " [k        S$0 UD6SS 95        O[        R                  " US!40 UD6 n=[m        S$[        Rn                  " U[q        [s        SURt                  S-   5      5      5      [        Rn                  " U=[q        [s        SURt                  S-   5      5      5      UR                  UR                  UUS"   US   UU
US#.
UD6  SSS5        SSS5        SSS5        g! , (       d  f       GNu= f! [&         a$  n[        R                  " [)        U5      SSS9eSnAff = f! [,         a$  n[        R                  " [)        U5      SSS9eSnAff = f! [,         a$  n[        R                  " [)        U5      SSS9eSnAff = f! [,         a$  n[        R                  " [)        U5      SSS9eSnAff = f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       g= f)%a  
Warp a raster dataset.

If a template raster is provided using the --like option, the
coordinate reference system, affine transform, and dimensions of
that raster will be used for the output.  In this case --dst-crs,
--bounds, --res, and --dimensions options are not applicable and
an exception will be raised.


    $ rio warp input.tif output.tif --like template.tif

The destination's coordinate reference system may be an authority
name, PROJ4 string, JSON-encoded PROJ4, or WKT.


    --dst-crs EPSG:4326
    --dst-crs '+proj=longlat +ellps=WGS84 +datum=WGS84'
    --dst-crs '{"proj": "utm", "zone": 18, ...}'

If --dimensions are provided, --res and --bounds are not applicable
and an exception will be raised.  Resolution is calculated based on
the relationship between the raster bounds in the target coordinate
system and the dimensions, and may produce rectangular rather than
square pixels.


    $ rio warp input.tif output.tif --dimensions 100 200 \
    > --dst-crs EPSG:4326

If --bounds are provided, --res is required if --dst-crs is provided
(defaults to source raster resolution otherwise).


    $ rio warp input.tif output.tif \
    > --bounds -78 22 -76 24 --res 0.1 --dst-crs EPSG:4326

)filesoutput	overwriteNr   r   z7--target-aligned-pixels requires a specified resolutionc              3   .   #    U  H  oc  M  Uv   M     g 7fN .0ps     T/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/rasterio/rio/warp.py	<genexpr>warp.<locals>.<genexpr>        :.Qqq.   	zM--like cannot be used with any of --dimensions, --bounds, --dst-crs, or --resc              3   .   #    U  H  oc  M  Uv   M     g 7fr'   r(   r)   s     r,   r-   r.      r/   r0   z2--dimensions cannot be used with --bounds or --resenv)CHECK_WITH_INVERT_PROJdriverzJ--src-bounds and destination --bounds may not be specified simultaneously.dst_crs)param
param_hintzRequired when using --bounds.resgcps
resolution)nodatar;   z<--src-nodata must be provided because dst-nodata is not None)crs	transformwidthheight
blockxsizezJBlockxsize removed from creation options to accommodate small output width
blockysizezKBlockxsize removed from creation options to accommodate small output heightr<   zEPSG:zOutput dataset profile:   )indentwr=   )
sourcedestinationsrc_transformsrc_crs
src_nodatadst_transformr5   
dst_nodata
resamplingnum_threadsr(   );r	   r   lenclickBadParameteranyobjr   rasterioopenboundsprofilepopr<   r=   r?   r>   r   from_string
ValueErrorstrr   r   r   floatmaxintr   is_identityr9   _asdictcalcdtaeroundsys
float_infoepsilonminr   translationscaler   updatemetaloggerwarninggetto_epsg	to_stringechojsondumpsdictr   bandlistrangecount)>ctxr#   r$   r4   liker5   
dimensions
src_boundsr   r8   rL   rI   rK   threadscheck_invert_projr%   creation_optionstarget_aligned_pixelsr   dry_runinvalid_combossrcleftbottomrighttop
out_kwargstemplate_dsrJ   
dst_height	dst_widtherrrU   xminyminxmaxymaxrH   kwargslbrtinv_transformepsc1r1c2r2c3r3c4r4col1col2row1row2pxpyr<   epsgdsts>                                                                 r,   warpr      s	   H "i9MF J'Js88 #&c(a-s1vs1vS$$IK K $'?:.:::$$&' ' ;
 
$*:.:::$$DF F 
&78]]58$'*zz$D&%JNN8T*'-
8$ j((01 1 ]]4(K)ooG$/$9$9M!,!3!3J + 1 1I	 )( $I!oog6G
  -7)Iz'53::FM1AGGW27/527.dD$
 %+i(884j(99	%M  :#00;"'E; ; "65E #6?3=6?2D$d 2<.dD$$*3q61dAAw$MM #CdTkSV-C(D$Eq II!$Std{c!f.D)E%F!JJM==44&)hhqkG&,chhqk%:F&)ggG%(ZZ%7%7%9F?E##IIJJ	@
 (+@ %@ -@<y* ''(2%	:'ED&%+E
1a &UeI..q!UeJ//	! z ==??S]]__,<=C''*4*B
&dD$ &s1vq$CF7D IE4$;#a&*@$A BAF	 UD4K3q6+A%B!CQG
'' &s1vq$CF7C HE54<3q6*A$B CQG	 UC&LCF+B%C!DaH
 ''!$nn,,&$*cCi)@@B&%#+sSy)AAB&%#+v|)DDB&$*fsl)CCB2r2r*2r2r*2r2r*2r2r*T{DzT{Dzdltd{3Fltd{3"bkE54<3*>$? @!D	 UC&LC+?%@!A1E
 & 2 24 =SRV@W W$7E!9j#84y* %!!!4 %%#((8*<*D,,VX X %%Z%8'!	   z)i#j>V:W.W|,` z)j3<(< / |,a 1 01 nnUD177??,D.3D6N
5),/GG,=,=,?
5)

45

4::d&8Z&8CD]]63=*= '}}S$uQ		A7N2OP$,MM#tE!SYYQR]<S7T$U&)mm ##-&0&= *5 1#-#-$+ ) >M % 
$ )( " I,,C	iI II $ M#00HI)M MM(  ( 6"'"4"4 #C	+4#6 668 $ M#00HI)M MMd >=M %$ 
s   '#h
A=h1d8hd-!h?eA"h>fA/h
Bg (R?h'Bg1h
h
d*%h-
e7eeh
f(ffh
f=f88f==h 
g.
g))g..h1
g?;h
h	h
h!)2__doc__rr   loggingmathr   r   rd   rO   rS   rasterio.crsr   rasterio.envr   rasterio.errorsr   rasterio.rior   rasterio.rio.helpersr	   rasterio.rio.optionsr
   rasterio.transformr   rasterio.warpr   r   r   r   r   r   r`   	getLogger__name__rl   commandfiles_inout_arg
output_opt
format_optoptionPathdimensions_optr[   resolution_optChoicenamer]   overwrite_optr   pass_contextr   )r   s   0r,   <module>r      s   -    
     $   . , %; ; 
		8	$ 23	4	 
78
 k48:
%
67
 AE4	QS 		';<';!vv';<	=	 		* 		/ kQ5TU0	A
 8	:
 	

	:
 	c
 q 
   V S7 :8    4Pqc =s   &I"