o
    Nrf                     @   s0   d dl Zd dlm  mZ dddZdd ZdS )    N   c                 C   s   t | |||\}}}t| || }|jjdkr|d}|dur?t|r?t||| }	t|	ddd d| }
nt	|| }	tj
||d |td| }
dd t||
  ||
  |	|
  D S )	z
    Return tiles from the array. If importances are provided,
    then they will be used to prioritize entries. Otherwise we'll
    assign random importances to the entire array.
    SUN   )dtypec                 S   s   g | ]\}}}|||d qS ))xlabel
importance ).0r   r	   r
   r   r   _/var/www/html/software/conda/envs/catlas/lib/python3.10/site-packages/clodius/tiles/nplabels.py
<listcomp>   s    
ztiles.<locals>.<listcomp>)ctnZmax_zoom_and_data_boundsnpZasarrayr   kindZastypelenZargsortZzerosZlinspaceintziptolist)labelszr   importancesZ	tile_sizeZmax_zoomZx_startZx_endZtile_labelsZtile_importancesindicesr   r   r   tiles   s    



r   c           	      C   sd   g }|D ]+}| d}t|dk rtdt|d }t|d }t| |||}|||fg7 }q|S )N.   zNot enough tile info presentr      )splitr   
IndexErrorr   r   )	arrayZtile_idsr   Ztile_valuesZtile_idpartsr   r   Z	ret_arrayr   r   r   tiles_wrapper"   s   
r"   )Nr   )numpyr   Zclodius.tiles.npvectorr   Znpvectorr   r"   r   r   r   r   <module>   s    
