o
    ðËhu  ã                   @   s8   d Z ddlmZmZ dadd„ ZdZG dd„ deƒZdS )	z» Read GDAL files.

Backend: `GDAL <https://gdal.org/>`_

.. note::
    To use this plugin you have to install its backend::

        pip install imageio[gdal]

Parameters
----------
none
é   )ÚFormatÚ
has_moduleNc                   C   s*   z	dd l ma W tS  ty   tdƒ‚w )Né    zhThe GDAL format relies on the GDAL package.Please refer to http://www.gdal.org/for further instructions.)Ú
osgeo.gdalÚgdalÚ_gdalÚImportError© r	   r	   úO/var/www/html/scripts/venv/lib/python3.10/site-packages/imageio/plugins/gdal.pyÚload_lib   s   úÿÿr   )z.tiffz .tifz.imgú.ecwz.jpgz.jpegc                   @   s2   e Zd ZdZdd„ Zdd„ ZG dd„ dejƒZdS )	Ú
GdalFormatzSee :mod:`imageio.plugins.gdal`c                 C   s&   |j dv rdS tdƒr|j | jv S d S )N)r   Tz
osgeo.gdal)Ú	extensionr   Ú
extensions©ÚselfÚrequestr	   r	   r
   Ú	_can_read*   s
   
ÿzGdalFormat._can_readc                 C   ó   dS )NFr	   r   r	   r	   r
   Ú
_can_write0   ó   zGdalFormat._can_writec                   @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )zGdalFormat.Readerc                 C   s    t stƒ  t  | j ¡ ¡| _d S ©N)r   r   ÚOpenr   Úget_local_filenameÚ_ds©r   r	   r	   r
   Ú_open6   s   zGdalFormat.Reader._openc                 C   s   | ` d S r   )r   r   r	   r	   r
   Ú_close;   s   zGdalFormat.Reader._closec                 C   r   )Né   r	   r   r	   r	   r
   Ú_get_length>   r   zGdalFormat.Reader._get_lengthc                 C   s$   |dkrt dƒ‚| j ¡ |  |¡fS )Nr   z#Gdal file contains only one dataset)Ú
IndexErrorr   ÚReadAsArrayÚ_get_meta_data©r   Úindexr	   r	   r
   Ú	_get_dataA   s   zGdalFormat.Reader._get_datac                 C   s
   | j  ¡ S r   )r   ÚGetMetadatar#   r	   r	   r
   r"   F   s   
z GdalFormat.Reader._get_meta_dataN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r%   r"   r	   r	   r	   r
   ÚReader5   s    r*   N)r'   r(   r)   Ú__doc__r   r   r   r*   r	   r	   r	   r
   r   '   s
    r   )r+   Úcorer   r   r   r   ÚGDAL_FORMATSr   r	   r	   r	   r
   Ú<module>   s   