-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Currently one gets a deprecation warning when using xarray.ufuncs.angle on a DataArray with xarray 0.11 and numpy 1.15, e.g.
PendingDeprecationWarning: xarray.ufuncs will be deprecated when xarray no longer supports versions of numpy older than v1.13. Instead, use numpy ufuncs directly.
X_tr = xr.ufuncs.angle(X)
however, np.angle still casts the input to ndarray, apparently.
Code Sample, a copy-pastable example if possible
>>> import xarray as xr
>>> import numpy as np
>>> X = xr.DataArray(np.ones(10))
>>> X
<xarray.DataArray (dim_0: 10)>
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])
Dimensions without coordinates: dim_0
>>> xr.ufuncs.angle(X) # expected output
<xarray.DataArray (dim_0: 10)>
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
Dimensions without coordinates: dim_0
>>> np.angle(X) # actual output
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
>>> np.__version__
'1.15.4'
>>> xr.__version__
'0.11.0'
>>> np.sin(X) # other ufuns work
<xarray.DataArray (dim_0: 10)>
array([0.841471, 0.841471, 0.841471, 0.841471, 0.841471, 0.841471, 0.841471,
0.841471, 0.841471, 0.841471])
Dimensions without coordinates: dim_0Problem description
I have not investigated yet why happens in numpy, but opening this issue to indicate that currently I can't really do much about this DeprecationWarning sort of silencing it (unless I'm missing something).
Output of xr.show_versions()
Details
INSTALLED VERSIONS ------------------ commit: None python: 3.7.1.final.0 python-bits: 64 OS: Linux OS-release: 4.18.8-gentoo machine: x86_64 processor: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8xarray: 0.11.0
pandas: 0.23.4
numpy: 1.15.4
scipy: 1.1.0
netCDF4: None
h5netcdf: 0.6.2
h5py: 2.8.0
Nio: None
zarr: None
cftime: None
PseudonetCDF: None
rasterio: None
iris: None
bottleneck: None
cyordereddict: None
dask: 1.0.0
distributed: None
matplotlib: 3.0.2
cartopy: None
seaborn: None
setuptools: 40.6.2
pip: 18.1
conda: None
pytest: 4.0.1
IPython: None
sphinx: None