
    !\i^                        S r SSKrSSKrSSKJr  SSKJ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  \R                  " \5      r\R$                  " S
SSSS9r\R$                  " SSSSSS9r\R$                  " SSSS9r\R,                  " SS9\R.                  " SS\R0                  " 5       SSS9\R2                  \R4                  \\R$                  " S\R0                  " SS9SS 9\R6                  \R8                  \\\R:                  \R<                  \R$                  " S!S"S#S$9\R>                  S% 5       5       5       5       5       5       5       5       5       5       5       5       5       5       r g)&zFile translation command    N   )resolve_inout)options)disjoint_bounds)CRS)	MaskFlags)windowsz--geographic
projection
geographicz!Bounds in geographic coordinates.)
flag_valuehelpz--projected	projectedTz:Bounds in input's own projected coordinates (the default).)r   defaultr   z--to-data-window
datawindowz[Clip the raster to the region of valid data by removing areas of surrounding NoData values.zClip a raster to given bounds.)
short_helpfileszINPUT OUTPUT)nargstyperequiredmetavar--like)existsz.Raster dataset to use as a template for bounds)r   r   z&--with-complement/--without-complementFzInclude the relative complement of the raster in the given bounds (giving a larger result), else return results only from the intersection of the raster and the bounds (the default).)r   r   c                 
   SSK Jn  U R                  S      [        XUS9u  p!US   n[        R
                  " U5       nUR                  R                  (       d  [        R                  " S5      eU(       ao  US:X  a(  U" [        R                  " S5      UR                  /UQ76 n[        X>R                  5      (       a  [        R                  " SS	S	S
9eUR                  " U6 nGOU(       a  [        R
                  " U5       nUR                  nUR                  UR                  :w  a  U" UR                  UR                  /UQ76 n[        X>R                  5      (       a  [        R                  " SSSS
9e SSS5        UR                  " U6 nGO/U(       Ga  [         R"                  " SSUR$                  UR&                  S9n/ n[         R(                  " USS5       H  n[         R*                  " UR-                  SSUS95      nUR$                  UR&                  -  S:  d  MG  [         R"                  " UR.                  UR.                  -   UR0                  UR0                  -   UR$                  UR&                  S9nUR3                  U5        M     [         R4                  " U5      nO[        R6                  " S5      eU
(       d<  UR9                  [         R"                  " SSUR$                  UR&                  5      5      nUR;                  5       nUR=                  5       n[?        UR&                  5      n[?        UR$                  5      nUR@                  nU(       a  UUS'   Ub  UUS'   URC                  UUURE                  U5      S.5        URB                  " S0 U	D6  SU;   a*  [?        US   5      U:  a  US	 [F        RI                  S5        SU;   a*  [?        US   5      U:  a  US	 [F        RI                  S5        [        R
                  " US40 UD6 n[         R"                  " SSUU5      n[K        [         R(                  " USS5      [         R(                  " USS5      5       H  u  nnURL                  UR&                  UR$                  4nURO                  UR-                  UUSSS9US9  [P        RR                  URT                  S   ;   d  Ml  URW                  URY                  UUSS9S   US9  M     SSS5        SSS5        SSS5        g! , (       d  f       GN= f! , (       d  f       N1= f! , (       d  f       N:= f! , (       d  f       g= f) a%  Clips a raster using projected or geographic bounds.

The values of --bounds are presumed to be from the coordinate
reference system of the input dataset unless the --geographic option
is used, in which case the values may be longitude and latitude
bounds. Either JSON, for example "[west, south, east, north]", or
plain text "west south east north" representations of a bounding box
are acceptable.

If using --like, bounds will automatically be transformed to match
the coordinate reference system of the input.

Datasets with non-rectilinear geo transforms (i.e. with rotation
and/or shear) may not be cropped using this command. They must be
processed with rio-warp.

Examples
--------
$ rio clip input.tif output.tif --bounds xmin ymin xmax ymax

$ rio clip input.tif output.tif --like template.tif

r   )transform_boundsenv)r   output	overwritezGNon-rectilinear rasters (i.e. with rotation or shear) cannot be clippedr   i  z+must overlap the extent of the input rasterz--bounds)param
param_hintr   N)widthheighti   r   T)maskedwindow)col_offrow_offr!   r"   z.--bounds, --like, or --to-data-window requireddrivernodata)r"   r!   	transform
blockxsizezJBlockxsize removed from creation options to accommodate small output width
blockysizezKBlockysize removed from creation options to accommodate small output heightw)r$   	out_shape	boundlessr#   )r$   )r$   r-   r.    )-rasterio.warpr   objr   rasterioopenr)   is_rectilinearclickBadParameterr   	from_epsgcrsr   boundsr$   r	   Windowr!   r"   	subdivideget_data_windowreadr%   r&   appendunion
UsageErrorintersectionround_lengthsround_offsetsintprofileupdatewindow_transformloggerwarningzipcountwriter   per_datasetmask_flag_enums
write_mask
read_masks)ctxr   r   r9   liker'   r(   r
   r   creation_optionswith_complementto_data_windowr   inputsrcbounds_windowtemplate_dssrc_win	data_winsswdw
out_windowr"   r!   
out_kwargsoutdest_winr-   s                               T/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/rasterio/rio/clip.pycliprc   &   s   @ /	%EIVa]]5!S==//((]  --cmmD.A377TVTF"6::66,,H(#- 
 !$

F 3]]4(K(//F"#''1!1+//377 ";39"; 'vzz::#00L"*'/  ; ) !$

F 3!..ASYYszzR	!++GS#>B 00!DQS1TUBxx"))+a/$^^BJJ4K46JJ4K24((299N "((, ? !(i 8 &&'WXX" - : :NN1aCJJ?!
 '446J#113J**+F
(()EJ'-
8$!'-
8$  11*=? @
 1 01z)c*\2J.Ke.S|,` z)c*\2J.Kf.T|,a vs9j9S">>!Qv>!'"3"3Hc3"GIZIZ[egjloIpqFB!$BIIrxx @III#%&/&*#'	 !   "   !,,0C0CA0FFNN')*3*. +   	!
 $& '  r :k " 
, )(H :9k "! 
sc   (UCT<A5T9B)T<&G6T<B:T+&T+ T<U
T(#T<+
T95T<<
U
	U
U)!__doc__loggingr5   helpersr    r   r2   rasterio.coordsr   rasterio.crsr   rasterio.enumsr   r	   	getLogger__name__rH   optionprojection_geographic_optprojection_projected_optdata_window_optionscommandargumentPath
output_opt
bounds_opt
format_opt
nodata_optoverwrite_optrS   pass_contextrc   r/       rb   <module>r{      s      "   +  $ 			8	$ "LL	,	.  !<<	EG  ll	f  :;
	 		4	 	9
 	, 
B
 W           <6Wrz   