
    d                        d dl mZ d dlZd dlZd dlZd dlZ ej	        d          Z
ej        d             Zd
dZd
dZd
d	ZdS )    )annotationsNcupyc                    t           j                            d           t          j        ddd          } t          j        dt           j        z  | j        j        dz  dz
  z            }d	d
|	                    dd          z  z   }|dt           j        
                    |j        d          z  z   }|d	z   dt           j        
                    |j        d          z  z   }t          j        d|fd|fd| g dd          }t                              |j        j                  |j        _        t                              |j        j                  |j        _        |S )zConstruct the example DataSet from the Toy weather data example.

    https://docs.xarray.dev/en/stable/examples/weather-data.html

    Here we construct the DataSet exactly as shown in the example and then
    convert the numpy arrays to cupy.

    {   z
2000-01-01z
2001-12-31time)name   g     v@gQ?
            )r   location)tmintmax)IAINIL)nprandomseedpd
date_rangesinpi	dayofyearvaluesreshaperandnsizexrDatasetcpasarrayr   datar   )timesannual_cyclebasetmin_valuestmax_valuesdss         6lib/python3.11/site-packages/xarray/tests/test_cupy.pytoy_weather_datar-      s6    INN3M,6BBBE6!be)u'='F'MNOOL\))"a0000DRY__\->BBBBK)a")//,2CQ"G"GGGK	);7);7	
 	
 $6$6$677
 
B ::bgl++BGL::bgl++BGLI    returnNonec                     t           sJ dS )zCheck the import worked.N)r#    r.   r,   test_cupy_importr3   ,   s    IIIIIr.   c                    | d         dk                         d                              d          }t          |j        t          j                  sJ dS )z<Perform some operations and check the data stays on the GPU.r   r   z
time.monthr   N)groupbymean
isinstancer%   r#   ndarray)r-   freezes     r,   test_check_data_stays_on_gpur:   1   sM    v&!+44\BBGGOOFfk2:.......r.   c                     ddl m}  t                              d          } | |dk     d|                                          }|sJ t          |t          j                  sJ d S )Nr   )wherer
   r   )xarray.core.duck_array_opsr<   r#   zerosallr7   r8   )r<   r%   outputs      r,   
test_whererA   7   sm    00000088B<<DU4!8Q%%))++FMMMfbj)))))))r.   )r/   r0   )
__future__r   numpyr   pandasr   pytestxarrayr!   importorskipr#   fixturer-   r3   r:   rA   r2   r.   r,   <module>rI      s    " " " " " "             V     >   
/ / / /* * * * * *r.   