HOME


sh-3ll 1.0
DIR:/opt/cloudlinux/venv/lib64/python3.11/site-packages/xarray/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/xarray/__pycache__/ufuncs.cpython-311.pyc
�

���h�����dZddlZddlmZddlmZddl	m
Zddlm
ZddlmZdd	lmZeeeefZejefezZd
�Zd�Zd���ZeD]Zee��e��e<�dS)
arxarray specific universal functions

Handles unary and binary operations for the following types, in ascending
priority order:
- scalars
- numpy.ndarray
- dask.array.Array
- xarray.Variable
- xarray.DataArray
- xarray.Dataset
- xarray.core.groupby.GroupBy

Once NumPy 1.10 comes out with support for overriding ufuncs, this module will
hopefully no longer be necessary.
�N�)�Variable)�Dataset)�	DataArray)�GroupBy)�dask_array_type)�_dask_or_eager_funcc�b�tt��D]\}}t||��r|cS�dS)N���)�	enumerate�_dispatch_order�
isinstance)�obj�priority�clss   �B/opt/cloudlinux/venv/lib/python3.11/site-packages/xarray/ufuncs.py�_dispatch_priorityrsB��"�?�3�3���
��#��c�3���	��O�O�O�	�
�2�c�r�����fd����_tt���j}d��d|���_�S)Nc
�>��|}t���}t|��dkst|��dkr"tdt|���d������t|��dkr7t|dt��r|d����}n�t
t|��\}}||kr7t|dt��r|d����}nTt|dt��r9|d��d���}tt|����}||i|��}|tur>t��dt|d���d	t|d���d
����|S)N�rzcannot handle z arguments for rT)�	reflexivez not implemented for types (z, �))
r	�len�	TypeErrorr�
_xarray_types�	_unary_op�mapr�
_binary_op�tuple�reversed�NotImplemented�type)	�args�kwargs�new_args�f�p1�p2�res�func�names	       ��rr+z_create_op.<locals>.func(s��������%�%���t�9�9�q�=�=�C��I�I��N�N��)� ��Y�Y�Y�Y���.�/�/�
/�
��Y�Y�!�^�^��$�q�'�=�1�1�
,���G�%�%�d�+�+����+�T�2�2�F�B���R�x�x��d�1�g�}�5�5�1��Q��*�*�4�0�0�A���d�1�g�}�5�5�5��Q��*�*�4�4�*�@�@�A�$�X�d�^�^�4�4�H��a��$�V�$�$���.� � ��#�t�t�T�$�q�'�]�]�]�]�D��a��M�M�M�M�C�D�D�
D��
rz!xarray specific variant of numpy.z�. Handles xarray.Dataset, xarray.DataArray, xarray.Variable, numpy.ndarray and dask.array.Array objects with automatic dispatching.

Documentation from numpy:

)�__name__�getattr�_np�__doc__)r,�docr+s` @r�
_create_opr2&s]����������0�D�M�
�#�t�
�
�
$�C�C�
:>���s�s�	D�D�L�
�Kra�logaddexp logaddexp2 conj exp log log2 log10 log1p expm1 sqrt
             square sin cos tan arcsin arccos arctan arctan2 hypot sinh cosh
             tanh arcsinh arccosh arctanh deg2rad rad2deg logical_and
             logical_or logical_xor logical_not maximum minimum fmax fmin
             isreal iscomplex isfinite isinf isnan signbit copysign nextafter
             ldexp fmod floor ceil trunc degrees radians rint fix angle real
             imag fabs sign frexp fmod
             )r0�numpyr/�
core.variabler�	_Variable�core.datasetr�_Dataset�core.dataarrayr�
_DataArray�core.groupbyr�_GroupBy�
core.pycompatr�_dask_array_type�core.opsr	r�ndarrayr
rr2�split�__all__r,�globals�rr�<module>rDs��������0�0�0�0�0�0�-�-�-�-�-�-�3�3�3�3�3�3�-�-�-�-�-�-�>�>�>�>�>�>�)�)�)�)�)�)��J��(�;�
��;� 0�1�M�A�����!�!�!�H������
�'�'�D� �j��&�&�G�G�I�I�d�O�O�'�'r