U
    ?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   s2   zdd l ma W n tk
r,   tdY nX tS )N    zhThe GDAL format relies on the GDAL package.Please refer to http://www.gdal.org/for further instructions.)Z
osgeo.gdalZgdal_gdalImportError r   r   F/var/www/html/venv/lib/python3.8/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krdS tdr"|j | jkS d S )N)r
   Tz
osgeo.gdal)	extensionr   
extensionsselfrequestr   r   r   	_can_read*   s    
zGdalFormat._can_readc                 C   s   dS )NFr   r   r   r   r   
_can_write0   s    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	   ZOpenr   Z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   s   dS )N   r   r   r   r   r   _get_length>   s    zGdalFormat.Reader._get_lengthc                 C   s$   |dkrt d| j | |fS )Nr   z#Gdal file contains only one dataset)
IndexErrorr   ZReadAsArray_get_meta_datar   indexr   r   r   	_get_dataA   s    zGdalFormat.Reader._get_datac                 C   s
   | j  S r   )r   Z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	   ZGDAL_FORMATSr   r   r   r   r   <module>   s
   