
    !\iw*                         S r SSKJs  Jr  SSKJr  SSKJr  SSK	J
r
Jr  SSKJr  SSKJr  SSKJr   " S	 S
\\\5      rSSSSSSS\R&                  4S jrg)z/rasterio.vrt: a module concerned with GDAL VRTs    N)WarpedVRTReaderBase)_gdal_typename)	MaskFlags
Resampling)_parse_path)TransformMethodsMixin)WindowMethodsMixinc                   0    \ rS rSrSrS rS rS rS rSr	g)		WarpedVRT   a  A virtual warped dataset.

Abstracts the details of raster warping and allows access to data
that is reprojected when read.

This class is backed by an in-memory GDAL VRTWarpedDataset VRT file.

Parameters
----------
src_dataset : dataset object
    The warp source.
src_crs : CRS or str, optional
    Overrides the coordinate reference system of `src_dataset`.
src_transform : Affine, optional
    Overrides the transform of `src_dataset`.
src_nodata : float, optional
    Overrides the nodata value of `src_dataset`, which is the
    default.
crs : CRS or str, optional
    The coordinate reference system at the end of the warp
    operation.  Default: the crs of `src_dataset`. dst_crs was
    a deprecated alias for this parameter.
transform : Affine, optional
    The transform for the virtual dataset. Default: will be
    computed from the attributes of `src_dataset`. dst_transform
    was a deprecated alias for this parameter.
height, width: int, optional
    The dimensions of the virtual dataset. Defaults: will be
    computed from the attributes of `src_dataset`. dst_height
    and dst_width were deprecated alias for these parameters.
nodata : float, optional
    Nodata value for the virtual dataset. Default: the nodata
    value of `src_dataset` or 0.0. dst_nodata was a deprecated
    alias for this parameter.
resampling : Resampling, optional
    Warp resampling algorithm. Default: `Resampling.nearest`.
tolerance : float, optional
    The maximum error tolerance in input pixels when
    approximating the warp transformation. Default: 0.125,
    or one-eigth of a pixel.
src_alpha : int, optional
    Index of a source band to use as an alpha band for warping.
dst_alpha : int, optional
    Index of a destination band to use as an alpha band for warping.
add_alpha : bool, optional
    Whether to add an alpha masking band to the virtual dataset.
    Default: False. This option will cause deletion of the VRT
    nodata value.
init_dest_nodata : bool, optional
    Whether or not to initialize output to `nodata`. Default:
    True.
warp_mem_limit : int, optional
    The warp operation's memory limit in MB. The default (0)
    means 64 MB with GDAL 2.2.
dtype : str, optional
    The working data type for warp operation and output.
warp_extras : dict
    GDAL extra warp options. See
    https://gdal.org/doxygen/structGDALWarpOptions.html.

Attributes
----------
src_dataset : dataset
    The dataset object to be virtually warped.
resampling : int
    One of the values from rasterio.enums.Resampling. The default is
    `Resampling.nearest`.
tolerance : float
    The maximum error tolerance in input pixels when approximating
    the warp transformation. The default is 0.125.
src_nodata: int or float, optional
    The source nodata value.  Pixels with this value will not be
    used for interpolation. If not set, it will be default to the
    nodata value of the source image, if available.
dst_nodata: int or float, optional
    The nodata value used to initialize the destination; it will
    remain in all areas not covered by the reprojected source.
    Defaults to the value of src_nodata, or 0 (gdal default).
working_dtype : str, optional
    The working data type for warp operation and output.
warp_extras : dict
    GDAL extra warp options. See
    https://gdal.org/doxygen/structGDALWarpOptions.html.

Examples
--------

>>> with rasterio.open('tests/data/RGB.byte.tif') as src:
...     with WarpedVRT(src, crs='EPSG:3857') as vrt:
...         data = vrt.read()

c                     SR                  U R                  =(       a    S=(       d    SU R                  U R                  5      $ )Nz"<{} WarpedVRT name='{}' mode='{}'>closedopen)formatr   namemodeselfs    O/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/rasterio/vrt.py__repr__WarpedVRT.__repr__k   s4    3::KK$H.		499F 	F    c                 &    U R                  5         U $ N)startr   s    r   	__enter__WarpedVRT.__enter__o   s    

r   c                 H    U R                   (       d  U R                  5         g g r   _closedclose)r   argskwargss      r   __exit__WarpedVRT.__exit__s       ||JJL r   c                 H    U R                   (       d  U R                  5         g g r   r   r   s    r   __del__WarpedVRT.__del__w   r&   r    N)
__name__
__module____qualname____firstlineno____doc__r   r   r$   r(   __static_attributes__r*   r   r   r   r      s    [zFr   r   Fc	                    Ub  UOU R                   nU=(       d    U R                  nU=(       d    U R                  nU=(       d    U R                  n[        R
                  " S5      n	[        U5      U	R                  S'   [        U5      U	R                  S'   [        R                  " U	S5      n
U R                  (       a  U R                  R                  OSU
l        [        R                  " U	S5      nSR                  UR                  5        Vs/ s H  n[        U5      PM     sn5      Ul        [        U R                  U R                   U R"                  U R$                  5       GH  u  pnn[        R                  " U	S5      n['        U5      UR                  S	'   [        U5      UR                  S
'   Uc  UbU  [        R                  " US5      n[        U=(       d    U5      Ul        U(       a  [        R                  " US5      nSUl        [        R                  " US5      nUR(                  R+                  5       Ul        [        R                  " US5      nUR(                  R-                  SS5      UR                  S'   [        R                  " US5      nSUR                  S'   SUR                  S'   [/        U R(                  5      R1                  5       Ul        [        R                  " US5      n[        U5      Ul        [        R                  " US5      n[        U5      UR                  S'   [        U5      UR                  S'   ['        U5      UR                  S	'   [        US   5      UR                  S'   [        US   5      UR                  S'   [        R                  " US5      nSUR                  S'   SUR                  S '   [        U R                  5      UR                  S!'   [        U R                  5      UR                  S"'   [        R                  " US#5      n[        U R                  R2                  UR2                  -
  UR4                  -  5      UR                  S'   [        U R                  R6                  UR6                  -
  UR8                  -  5      UR                  S '   [        U R                  U R                  R4                  -  UR4                  -  5      UR                  S!'   [        U R                  U R                  R8                  -  UR8                  -  5      UR                  S"'   Ub'  [        R                  " US$5      n[        U5      Ul        U R:                  bz  [        R                  " US%5      nU R:                  R=                  5        HE  u  nn[        R                  " US&5      n[        U5      UR                  S''   [        U5      Ul        MG     U(       d  GM  [        R                  " US(5      n SU l        [        R                  " US)5      n!S*U!l        GM     [?        S+ U R@                   5       5      (       Ga  [        R                  " U	S,5      n"[        R                  " U"S5      nS-UR                  S	'   [        R                  " US.5      n#[        R                  " U#S5      nSUR                  S'   SUR                  S'   [/        U R(                  5      R1                  5       Ul        [        R                  " U#S5      nS/Ul        [        R                  " U#S5      n[        U5      UR                  S'   [        U5      UR                  S'   S-UR                  S	'   [        WS   5      UR                  S'   [        US   5      UR                  S'   [        R                  " U#S5      nSUR                  S'   SUR                  S '   [        U R                  5      UR                  S!'   [        U R                  5      UR                  S"'   [        R                  " U#S#5      n[        U R                  R2                  UR2                  -
  UR4                  -  5      UR                  S'   [        U R                  R6                  UR6                  -
  UR8                  -  5      UR                  S '   [        U R                  5      UR                  S!'   [        U R                  5      UR                  S"'   [        RB                  " U	5      RE                  S05      $ s  snf )1a4  Make a VRT XML document.

Parameters
----------
src_dataset : Dataset
    The dataset to wrap.
background : int or float, optional
    The background fill value for the boundless VRT.
masked : bool
    If True, the src_dataset is replaced by its valid data mask.

Returns
-------
str
    An XML text string.

VRTDatasetrasterYSizerasterXSizeSRS GeoTransform,VRTRasterBanddataTypebandNoDataValueHideNoDataValue1ColorInterpComplexSource_
resamplingSourceFilename0relativeToVRTshared
SourceBandSourcePropertiesRasterXSizeRasterYSizer   
BlockYSize   
BlockXSizeSrcRectxOffyOffxSizeySizeDstRectNODATAOpenOptionsOOIkey
ScaleRatioScaleOffset255c              3   H   #    U  H  n[         R                  U;   v   M     g 7fr   )r   per_dataset).0flagss     r   	<genexpr>%_boundless_vrt_doc.<locals>.<genexpr>   s     
S7Re9  E)7Rs    "MaskBandByteSimpleSourcezmask,1ascii)#nodatawidthheight	transformETElementstrattrib
SubElementcrswkttextjointo_gdalzipindexescolorinterpblock_shapesdtypesr   r   
capitalizereplacer   as_vsixoffayoffeoptionsitemsallmask_flag_enumstostringdecode)$src_datasetre   
background
hidenodatarf   rg   rh   maskedrB   
vrtdatasetsrsgeotransformvbidxciblock_shapedtypevrtrasterbandnodatavaluehidenodatavalueru   complexsourcesourcefilename
sourcebandsourcepropertiessrcrectdstrectnodata_elemopenoptionsookeyoovalueooi
scaleratioscaleoffsetmaskbandsimplesources$                                       r   _boundless_vrt_docr   |   sO   6 )V{/A/AF&[&&E){))F2[22IL)J'*6{Jm$'*5zJm$
--
E
*C&1oo{""2CH==^<L)2C2C2E!F2EQ#a&2E!FGL(+  	)$+u j/B+9%+@Z('*4yV$!V%7--}EK":#78K"$--?P"Q'*$mmM=A77--/m_E-7__-D-DS"-M\*}6FG14o.*-h')+*:*:;BBD]]=,?
d)
==8JK14U.14V..<U.C
+03KN0C-03KN0C---y9!$v!$v"%k&7&7"8w"%k&8&8"9w--y9!$k&;&;&@&@9>>&QU^U`U`%`!av!$k&;&;&@&@9>>&QU^U`U`%`!av"%k&7&7+:O:O:Q:Q&QT]T_T_&_"`w"%k&8&8;;P;P;R;R&RU^U`U`&`"aw--x@K"6{K*--}EK"-"5"5";";"=wmmK7$'J

5!w< #> 6}lCJ!JO--}EK$KA)D 
S{7R7R
SSS==Z8h@+1Z(}}]NC|5EF14o.*-h')+*:*:;BBD]]<>
"
==7IJ14U.14V..4
+03KN0C-03KN0C---i8!$v!$v"%k&7&7"8w"%k&8&8"9w--i8!$k&;&;&@&@9>>&QU^U`U`%`!av!$k&;&;&@&@9>>&QU^U`U`%`!av"%k&7&7"8w"%k&8&8"9w;;z"))'22E "Gs   e)r/   xml.etree.ElementTreeetreeElementTreeri   rasterio._warpr   rasterio.dtypesr   rasterio.enumsr   r   rasterio._pathr   rasterio.transformr   rasterio.windowsr	   r   nearestr   r*   r   r   <module>r      s\    5 " " . * 0 & 4 /l#%79N lb 
!!H3r   