
    d6              
      \   d Z ddlmZ ddlZddlZddlmZmZm	Z	m
Z
mZ ddlmZmZ ddlmZmZmZ ddlmZmZ ddlmZ  G d	 d
          Z G d deeeeee          Z G d deee
          Z G d deeee          Z G d dee          Z G d dee	          Z G d de          ZdS )z8Base classes implementing arithmetic for xarray objects.    )annotationsN)DataArrayGroupByOpsMixinDataArrayOpsMixinDatasetGroupByOpsMixinDatasetOpsMixinVariableOpsMixin)ImplementsArrayReduceImplementsDatasetReduce)IncludeCumMethodsIncludeNumpySameMethodsIncludeReduceMethods)OPTIONS_get_keep_attrs)is_duck_arrayc                  <    e Zd ZdZdZej        ej        e	e
fZd ZdS )SupportsArithmeticzpBase class for xarray types that support arithmetic.

    Used by Dataset, DataArray, Variable and GroupBy.
     c                >   ddl m} |                    dd          }||z   D ]8}t          |          s't	          || j        t          fz             s	t          c S 9|j        "t          d
                    |                    |dk    r#t          d
                    ||                    t          d |D                       rt          d	          t          d
         x}}	 ||g|R d|j        z  d|j        z  ||	t          j        |dt#          d          dS )Nr   )apply_ufuncoutr   z{} not supported: xarray objects do not directly implement generalized ufuncs. Instead, use xarray.apply_ufunc or explicitly convert to xarray objects to NumPy arrays (e.g., with `.values`).__call__z{} method for ufunc {} is not implemented on xarray objects, which currently only support the __call__ method. As an alternative, consider explicitly converting xarray objects to NumPy arrays (e.g., with `.values`).c              3  @   K   | ]}t          |t                    V  d S )N)
isinstancer   ).0os     6lib/python3.11/site-packages/xarray/core/arithmetic.py	<genexpr>z5SupportsArithmetic.__array_ufunc__.<locals>.<genexpr>J   s-      >>Qz!/00>>>>>>    zxarray objects are not yet supported in the `out` argument for ufuncs. As an alternative, consider explicitly converting xarray objects to NumPy arrays (e.g., with `.values`).arithmetic_join)r   allowedT)default)input_core_dimsoutput_core_dimsjoindataset_joindataset_fill_valuekwargsdask
keep_attrs)xarray.core.computationr   getr   r   _HANDLED_TYPESr   NotImplemented	signatureNotImplementedErrorformatanyr   ninnoutnpnanr   )
selfufuncmethodinputsr'   r   r   xr$   r%   s
             r   __array_ufunc__z"SupportsArithmetic.__array_ufunc__.   s   777777 jj### 	& 	&A ## &J4&*<)>>- - & &%%%?&%* +1&--	   Z%: ;A&:O:O	   >>#>>>>> 	 &   &&788|{

 
 "EI-"UZ/%!v&t444
 
 
 	
r   N)__name__
__module____qualname____doc__	__slots__r4   genericnumbersNumberbytesstrr,   r;   r   r   r   r   r      sM         
 I 	
	N3
 3
 3
 3
 3
r   r   c                      e Zd ZdZdZdS )VariableArithmeticr   2   Nr<   r=   r>   r@   __array_priority__r   r   r   rG   rG   d   s         Ir   rG   c                      e Zd ZdZdZdS )DatasetArithmeticr   rH   NrI   r   r   r   rL   rL   q   s        
 Ir   rL   c                      e Zd ZdZdZdS )DataArrayArithmeticr   <   NrI   r   r   r   rN   rN   z   s         Ir   rN   c                      e Zd ZdZdS )DataArrayGroupbyArithmeticr   Nr<   r=   r>   r@   r   r   r   rQ   rQ               IIIr   rQ   c                      e Zd ZdZdS )DatasetGroupbyArithmeticr   NrR   r   r   r   rU   rU      rS   r   rU   c                      e Zd ZdZdS )CoarsenArithmeticr   NrR   r   r   r   rW   rW      s        IIIr   rW   )r?   
__future__r   rB   numpyr4   xarray.core._typed_opsr   r   r   r   r   xarray.core.commonr	   r
   xarray.core.opsr   r   r   xarray.core.optionsr   r   xarray.core.pycompatr   r   rG   rL   rN   rQ   rU   rW   r   r   r   <module>r_      sR   > > " " " " " "                   N M M M M M M M         
 9 8 8 8 8 8 8 8 . . . . . .G
 G
 G
 G
 G
 G
 G
 G
T
 
 
 
 

 
 
          	                  ,     r   