
    !\i
                     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 r
S rS	S jrg)
    N)islice)	MaskFlags)Window)rowcolc              #      #    U R                   n[        U5      n [        [        USS5      5      nU(       d  g [	        U/[        U6 Q76 u  pV[        XV5       S h  vN   MG   N7f)Nr      )	transformitertupler   r   zip)datasetxydt_xybufxys          R/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/rasterio/sample.py_transform_xyr      sc      
		B
r(C
F33'(b%39%q8 
 	s   AA$A"A$c                     [        [        U 6 5      u  p/ n[        R                  " X!/5       H  nUR	                  X   X$   45        M     U$ )zSort x, y coordinates by x then y

Parameters
----------
xy : iterable
    Pairs of x, y coordinates

Returns
-------
list
    A list of sorted x, y coordinates
)r   r   nplexsortappend)r   r   r   rvinds        r   sort_xyr      sG     b?DA	Bzz1&!
		1616"# "I    c              #     #    U R                   nU R                  nU R                  nUc  U R                  nO[	        U[
        5      (       a  U/n[        R                  " [        U5      U R                  =(       d    SU R                  S   S9nU(       a  U Vs/ s H  n[        U R                  US-
     5      PM      n	n[        S U	 5       5      n
U	 Vs/ s H#  nU
(       a  U[        R                  1:X  a  SOSPM%     nn[        R                   R#                  X|S9n[%        X5       HK  u  pSUs=::  a  U:  a5  O  O2SUs=::  a  U:  a%  O  O"['        XSS5      nU" X/US	9nUSS2SS4   v   MG  Uv   MM     gs  snf s  snf 7f)
a  Sample pixels from a dataset

Parameters
----------
dataset : rasterio Dataset
    Opened in "r" mode.
xy : iterable
    Pairs of x, y coordinates in the dataset's reference system.

    Note: Sorting coordinates can often yield better performance.
    A sort_xy function is provided in this module for convenience.
indexes : int or list of int
    Indexes of dataset bands to sample.
masked : bool, default: False
    Whether to mask samples that fall outside the extent of the
    dataset.

Yields
------
array
    A array of length equal to the number of specified indexes
    containing the dataset values for the bands corresponding to
    those indexes.

Nr   )dtype   c              3      #    U  H7  n[         R                  [         R                  [         R                  1U-  v   M9     g 7f)N)r   alphaper_datasetnodata).0enumss     r   	<genexpr>sample_gen.<locals>.<genexpr>R   s3       
# __i33Y5E5EFN#s   ?AFT)mask)windowmasked)readheightwidthindexes
isinstanceintr   fulllenr$   dtypessetmask_flag_enumsanyr   	all_validmaarrayr   r   )r   r   r/   r+   r,   r-   r.   r$   i
mask_flagsdataset_is_maskedr&   r)   rowcolwindatas                    r   
sample_genrB   +   sc    4 <<D^^FMME//	GS	!	!)WWS\GNN$7aPQARSFCJK7ac'11!a%897
K  
# 
 
 $
# '5Y5H5H4I+IEtS# 	 
 V/!'.fc!1E!11a(CF;Dq!Qw-L / L

s   BF%E:>F*E? BF)NF)numpyr   	itertoolsr   rasterio.enumsr   rasterio.windowsr   rasterio.transformr   r   r   rB    r   r   <module>rI      s%      $ # %
(7r   