
    +d
                     2    d dl mZmZ  G d de          ZdS )   )
DataSourceSchemac                   X     e Zd ZdZdZdZdZdZd fd	Zd Z	d	 Z
d
 Zd Zd Zd Z xZS )ZarrArraySourcezRead Zarr format files into an array

    Zarr is an numerical array storage format which works particularly well
    with remote and parallel access.
    For specifics of the format, see https://zarr.readthedocs.io/en/stable/
    ndarrayndzarrz0.0.1TNc                     || _         |pi | _        || _        || _        d| _        d| _        t          t          |                               |           dS )ax  
        The parameters dtype and shape will be determined from the first
        file, if not given.

        Parameters
        ----------
        urlpath : str
            Location of data file(s), possibly including protocol
            information
        storage_options : dict
            Passed on to storage backend for remote files
        component : str or None
            If None, assume the URL points to an array. If given, assume
            the URL points to a group, and descend the group to find the
            array at this location in the hierarchy.
        kwargs : passed on to dask.array.from_zarr
        N)metadata)	urlpathstorage_options	componentkwargschunks_arrsuperr   __init__)selfr   r   r   r
   r   	__class__s         2lib/python3.11/site-packages/intake/source/zarr.pyr   zZarrArraySource.__init__   s\    $ .4""	ot$$--x-@@@@@    c                 l   dd l m} | j        n |j        | j        f| j        | j        d| j        | _        | j        j        | _        | j        j	        | _	        | j        j
        | _
        | j        j        | _        t          t          | j
                  | j	        | j        | j        | j                  S )N    )r   r   )dtypeshapeextra_metadatanpartitionsr   )
dask.arrayarrayr   	from_zarrr   r   r   r   r   r   r   r   r   strr
   )r   das     r   _get_schemazZarrArraySource._get_schema2   s    9 	5$T\  BT^]a]q  B  Buy  vA  B  BDI)*DKDJDJ#y4DC
OO4:dmimiy  CG  CN  O  O  O  	Or   c                     t          |t                    rt          |          }| j        j        |                                         S N)
isinstancelisttupler   blockscomputer   is     r   _get_partitionzZarrArraySource._get_partition=   s;    a 	aAy"**,,,r   c                 T    |                                   |                     |          S r$   )r"   r,   r*   s     r   read_partitionzZarrArraySource.read_partitionB   s(    ""1%%%r   c                 8    |                                   | j        S r$   )r"   r   r   s    r   to_daskzZarrArraySource.to_daskF   s    yr   c                 \    |                                   | j                                        S r$   )r"   r   r)   r0   s    r   readzZarrArraySource.readJ   s(    y  """r   c                 "    d | _         d | _        d S r$   )r   _mapperr0   s    r   _closezZarrArraySource._closeN   s    	r   )NNN)__name__
__module____qualname____doc__	containernameversionpartition_accessr   r"   r,   r.   r1   r3   r6   __classcell__)r   s   @r   r   r      s          IDGA A A A A A4	O 	O 	O- - -
& & &  # # #      r   r   N)baser   r   r    r   r   <module>rB      s]    % $ $ $ $ $ $ $E E E E Ej E E E E Er   