
    `j 6                     Z   S r SSKrSSKrSSKrSSKrSSKrSSK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  SSKJrJr  \R.                  " \5      rS rS rS rS rS	 rS
 rS r S r!S r"S r#\RH                  " S\S9r%\RH                  " S\RL                  " 5       S9r'\RH                  " SS\RL                  " 5       SS\S9r(\RH                  " SS\RL                  " 5       SS\S9r)\RT                  " SS\+SSS9r,\RT                  " SS\+SSS9r-\RT                  " SSSSS 9r.\RT                  " S!S\#S"S#9r/\RT                  " S$S%\+SS&S'9r0\RT                  " S(S)\Rb                  " \\	\
\\\\\\\\\\/5      SS*S9r2\RT                  " S+\RL                  " SS,9S-S.9r3\RT                  " S/SS0S19r4\RT                  " S2S3S\RL                  " 5       S4S59r5\RT                  " S6S7S\6SS8S99r7\RT                  " S:S;S<S=S\S>S?9r8\RT                  " S@SASBSCSD9r9\RT                  " SESFS\:SGSHSI9r;\RT                  " SJ\!SSKSLSM9r<\RT                  " SJ\"SSNSOSM9r=\RT                  " S+\RL                  " SS,9\ SSPSQ9r>\RT                  " SRSSSTSUSSGSVSW9r?\RT                  " SXSSYS19r@\RT                  " SZS[S\S]S^S_9rAS` rBg)aa+	  
Registry of common rio CLI options.  See cligj for more options.

.. code-block:: none

    -a, --all: Use all pixels touched by features.  In rio-mask, rio-rasterize
    --as-mask/--not-as-mask: interpret band as mask or not.  In rio-shapes
    --band/--mask: use band or mask.  In rio-shapes
    --bbox:
    -b, --bidx: band index(es) (singular or multiple value versions).
        In rio-info, rio-sample, rio-shapes, rio-stack (different usages)
    --bounds: bounds in world coordinates.
        In rio-info, rio-rasterize (different usages)
    --count: count of bands.  In rio-info
    --crop: Crop raster to extent of features.  In rio-mask
    --crs: CRS of input raster.  In rio-info
    --default-value: default for rasterized pixels.  In rio-rasterize
    --dimensions: Output width, height.  In rio-rasterize
    --dst-crs: destination CRS.  In rio-transform
    --fill: fill value for pixels not covered by features.  In rio-rasterize
    --formats: list available formats.  In rio-info
    --height: height of raster.  In rio-info
    -i, --invert: Invert mask created from features: In rio-mask
    -j, --geojson-mask: GeoJSON for masking raster.  In rio-mask
    --lnglat: geographic coordinates of center of raster.  In rio-info
    --masked/--not-masked: read masked data from source file.
        In rio-calc, rio-info
    -m, --mode: output file mode (r, r+).  In rio-insp
    --name: input file name alias.  In rio-calc
    --nodata: nodata value.  In rio-info, rio-merge (different usages)
    --photometric: photometric interpretation.  In rio-stack
    --property: GeoJSON property to use as values for rasterize.  In rio-rasterize
    -r, --res: output resolution.
        In rio-info, rio-rasterize (different usages.  TODO: try to combine
        usages, prefer rio-rasterize version)
    --sampling: Inverse of sampling fraction.  In rio-shapes
    --shape: shape (width, height) of band.  In rio-info
    --src-crs: source CRS.
        In rio-insp, rio-rasterize (different usages.  TODO: consolidate usages)
    --stats: print raster stats.  In rio-inf
    -t, --dtype: data type.  In rio-calc, rio-info (different usages)
    --width: width of raster.  In rio-info
    --with-nodata/--without-nodata: include nodata regions or not.  In rio-shapes.
    -v, --tell-me-more, --verbose
    --vfs: virtual file system.
    N)ubyteuint8uint16uint32uint64int8int16int32int64float16float32float64)_parse_path_UnparsedPathc                    U(       d  0 $ 0 nU Hp  nSU;  a  [         R                  " SU 35      eUR                  SS5      u  pVUR                  5       nUR                  5       nUR                  5       S;   a  SOUX5'   Mr     U$ )aV  
click callback to validate `--opt KEY1=VAL1 --opt KEY2=VAL2` and collect
in a dictionary like the one below, which is what the CLI function receives.
If no value or `None` is received then an empty dictionary is returned.

    {
        'KEY1': 'VAL1',
        'KEY2': 'VAL2'
    }

Note: `==VAL` breaks this as `str.split('=', 1)` is used.
=z Invalid syntax for KEY=VAL arg:    )nonenullnilnadaN)clickBadParametersplitlower)ctxparamvalueoutpairkvs          W/var/www/html/Sattelite-Image/venv/lib/python3.13/site-packages/rasterio/rio/options.py_cb_key_valr$   L   s     	D$((+KD6)RSSzz#q)GGIGGI!".M!MST  
    c                     SR                  [        R                  R                  U 5      R	                  [        R                  R
                  5      5      $ )z1Return forward-slashed version of os.path.abspath/)joinospathabspathr   sep)r*   s    r#   abspath_forward_slashesr-   j   s1    88BGGOOD)//<==r%   c                 2    [        U5      n[        U[        5      (       as  [        R                  R                  UR                  5      (       a9  [        R                  R                  U5      (       a  [        UR                  5      $ UR                  $ UR                  (       a  UR                  (       a  UR                  $ UR                  (       a  [        R                  R                  UR                  5      (       aW  [        R                  R                  U5      (       a3  [        UR                  5      nUR                   SU SUR                   3$ [        SUR                   S35      e[        R                  R                  UR                  5      (       a9  [        R                  R                  U5      (       a  [        UR                  5      $ [        SUR                   S35      e! [         a    [        R                   " U S35      ef = f)z+Normalize ordinary filesystem and VFS pathsz://!zInput archive z does not existzInput file z is not a valid input file)r   
isinstancer   r)   r*   existsrasterioshutilr-   namescheme	is_remotearchiveOSError	Exceptionr   r   )r   r   r   r*   r7   s        r#   file_in_handlerr:   o   so   G5!dM**ww~~dii((X__-C-CE-J-J.tyy99yy [[T^^99\\ww~~dll++0F0Fu0M0M1$,,?++c'!DII;??t||nOLMM ww~~dii((X__-C-CE-J-J.tyy99DII;oFGG G  E7*D!EFFGs,   BG2 	G2 -G2 BG2 A?G2 G2 2$Hc                 2   ^ ^ [        U U4S jU 5       5      $ )%Process and validate input file namesc              3   >   >#    U  H  n[        TTU5      v   M     g 7fNr:   .0itemr   r   s     r#   	<genexpr>#files_in_handler.<locals>.<genexpr>   s     EuteT22u   tupler   r   r   s   `` r#   files_in_handlerrI      s    EuEEEr%   c                 V   ^ ^ [        U U4S jUSS  5       5      [        USS 5      -   $ )r<   c              3   >   >#    U  H  n[        TTU5      v   M     g 7fr>   r?   r@   s     r#   rC   &files_inout_handler.<locals>.<genexpr>   s     JzteT22zrE   NrF   rH   s   `` r#   files_inout_handlerrN      s.    JuSbzJJUSXY[Y\S]M^^^r%   c                     U R                   (       ab  U R                   R                  S5      (       aB  US:X  d   U R                   R                  S5      (       a  U R                   S   UR                     $ g)zdReturn the value for an option from the context if the option
or `--all` is given, else return None.likeall_likeN)objgetr4   rH   s      r#   from_like_contextrT      sP     ww377;;v&&VOsww{{:66wwvuzz**r%   c                 r   U R                   c  0 U l         U(       a  [        R                  " U5       nUR                  nX@R                   S'   US   U R                   S   S'   UR	                  5       U R                   S   S'   UR
                  U R                   S   S'   SSS5        gg! , (       d  f       g= f)zVCopy a dataset's meta property to the command context for access
from other callbacks.NrP   	transformtagscolorinterpTF)rR   r2   openmetarW   rX   )r   r   r   srcmetadatas        r#   like_handlerr]      s     ww]]5!SxxH&GGFO+3K+@CGGFOK(&)hhjCGGFOF#-0__CGGFOM* "  "! s   A,B((
B6c                     Ub  UR                  5       S;   a  g [        U5      $ ! [        [        4 a    [        R
                  " U< S3USS9ef = f)zReturn a float or NoneN)r   r   r   r   z is not a numbernodata)r   
param_hint)r   float	TypeError
ValueErrorr   r   rH   s      r#   nodata_handlerrd      s]    })HH	<:& 	$$)+,Eh 	s	   
% +Ac                 N    US:X  d  Uc  [        XU5      nUb  U$ [        XU5      $ )zGet nodata value from a template file or command line.

Expected values are 'like', 'null', a numeric value, 'nan', or None.

Returns
-------
float or None

Raises
------
click.BadParameter

rP   )rT   rd   r   r   r   retvals       r#   edit_nodata_handlerrh      s3     %-"3u5M#e,,r%   c                 (   [        XU5      nUcO  UbL   UR                  S5      n[        S [        R                  " SU5       5       5      n[        U5      S:X  d   eU$ U$ ! [         a&    [        R                  " SR                  U5      5      ef = f)z!Handle different forms of bounds.z, []c              3   8   #    U  H  n[        U5      v   M     g 7fr>   )ra   )rA   xs     r#   rC   !bounds_handler.<locals>.<genexpr>   s     H-G588-Gs   z[,\s]+   z/{!r} is not a valid bounding box representation)
rT   striprG   rer   lenr9   r   r   formatrf   s       r#   bounds_handlerrr      s    s51F~%+	KK'EHRXXi-GHHFv;!###M   	$$AHHO 	s   A
A! !0BINPUT)callbackOUTPUT)typefilesrM   Tz	INPUTS...)nargsrv   requiredmetavarrt   zINPUTS... OUTPUTz-bz--bidxr   z#Input file band index (default: 1).)rv   defaulthelpzIndexes of input file bands.)rv   multipler|   )r}   r|   z--boundsz@Bounds: 'left bottom right top' or '[left, bottom, right, top]'.)r{   rt   r|   z--dimensions   z1Output dataset width, height in number of pixels.)rx   rv   r{   r|   z-tz--dtypezOutput data type.z--like)r1   zRaster dataset to use as a template for obtaining affine transform (bounds and resolution), crs, data type, and driver used to create the output.)rv   r|   z--masked/--not-maskedzPEvaluate expressions using masked arrays (the default) or ordinary numpy arrays.)r{   r|   z-oz--outputz?Path to output file (optional alternative to a positional arg).)r{   rv   r|   z-rz--reszOutput dataset resolution in units of coordinate reference system. Pixels assumed to be square if this option is used once, otherwise use: --res pixel_width --res pixel_height.)r}   rv   r{   r|   z--coz	--profilecreation_optionsz
NAME=VALUEzlDriver specific creation options. See the documentation for the selected output driver for more information.)rz   r}   rt   r|   z--rgbphotometricrgbz#Set RGB photometric interpretation.)
flag_valuer|   z--overwrite	overwriteFz)Always overwrite an existing output file.)is_flagrv   r{   r|   z--nodataz
NUMBER|nanzSet a Nodata value.)rt   r{   rz   r|   zNUMBER|nan|nullzModify the Nodata value.zsRaster dataset to use as a template for obtaining affine transform (bounds and resolution), crs, and nodata values.)rv   rt   is_eagerr|   z-az--allz--all_touchedall_touchedzUse all pixels touched by features, otherwise (default) use only pixels whose center is within the polygon or that are selected by Bresenhams line algorithm)r   r{   r|   z--sequence/--collectionzWrite a LF-delimited sequence of texts containing individual objects (the default) or write a single JSON text containing a feature collection object.z-fz--formatz--driverdriverzOutput format driver.)r|   c                 *   ^ ^^ U U4S jmU UU4S jnU$ )zGeoJSON output modec                   > U R                   R                  S0 5      nX#UR                  '   [        U5      [        T5      :X  a  UR	                  5        VVs/ s H  u  pBU(       d  M  UR                  S5      PM!     nnn[        U5      S:  a2  SR                  S U 5       5      n[        R                  " SU S35      eU(       a  US   OTU R                   S'   g g s  snnf )	Ngeojson_typegeojson_type_r   ,c              3   ,   #    U  H
  nS U 3v   M     g7f)--N )rA   r4   s     r#   rC   @geojson_type_opt.<locals>.verify_geojson_type.<locals>.<genexpr>  s      C2dVs   z!too many GeoJSON output formats: z may not be specified togetherr   )	params
setdefaultr4   rp   itemsremoveprefixr(   r   r   )	r   r   r   r   r4   	specifiednamesallowedr{   s	          r#   verify_geojson_type-geojson_type_opt.<locals>.verify_geojson_type  s    zz,,^R@#(UZZ |G, $0#5#5#7#7KD 3!!/2#7  
 9~! C CC((7w>\]  :C1CJJ~& -s   C(Cc                    > SSSS.nT HY  nX!;  a  [         R                  " U S35      eUT:X  a  SOSn[         R                  " SU 3S	U 3S
STSX    U 3S9nU" U 5      n M[     U $ )Nzfeature collection(s)z
feature(s)zbounding box array(s))
collectionfeaturebboxz# is not a valid GeoJSON output modez
 (default) r   r   TFzOutput as GeoJSON )r   expose_valuert   r|   )r   
UsageErroroption)funcoptionsr4   help_suffixoptr   r{   r   s        r#   wrapper!geojson_type_opt.<locals>.wrapper  s    1#+
 D"&&$/R'STT*.'/,rK,,TFv&",)'-FC t9D  r%   r   )r   r{   r   r   s   `` @r#   geojson_type_optr     s    P", Nr%   )C__doc__loggingr)   ro   r   r2   rasterio.shutilrasterio.dtypesr   r   r   r   r   r   r	   r
   r   r   r   r   rasterio._pathr   r   	getLogger__name__loggerr$   r-   r:   rI   rN   rT   r]   rd   rh   rr   argumentfile_in_argPathfile_out_argfiles_in_argfiles_inout_argr   intbidx_optbidx_mult_optbidx_magic_opt
bounds_optdimensions_optChoice	dtype_optlike_file_opt
masked_opt
output_optra   resolution_optr   rgb_optbooloverwrite_opt
nodata_optedit_nodata_optlike_optall_touched_optsequence_opt
format_optr   r   r%   r#   <module>r      s  -^  	 	       6 
		8	$<>
G@F
_
"
-,$ nnW? ~~hUZZ\: ~~
	 ..
	 " <<(		.	0 (		'	) (	') \\	K	
 
#t	<>
 LL)	 
 	%	( 	4	 
&' \\

 \\*		J	L
 't
12 <<
K+
  ,,]	.0
 ;tU	46
 \\	
 ,, 	# <<	4	 
FG ,,'?M
%	& ||
&' \\*j(1H

)r%   